Skip to content

Commit

Permalink
Merge branch 'SLE15-SP1' into SLE15-SP1-AZURE
Browse files Browse the repository at this point in the history
suse-commit: 8fa306690f3a2397a832d25fcbdfefa7d1f3b4a0
  • Loading branch information
Kernel Build Daemon committed Oct 8, 2019
2 parents 5607dda + 078049f commit 5f05cae
Show file tree
Hide file tree
Showing 16 changed files with 120 additions and 28 deletions.
17 changes: 16 additions & 1 deletion arch/powerpc/mm/init_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,21 @@ static __meminit void vmemmap_list_populate(unsigned long phys,
vmemmap_list = vmem_back;
}

static bool altmap_cross_boundary(struct vmem_altmap *altmap, unsigned long start,
unsigned long page_size)
{
unsigned long nr_pfn = page_size / sizeof(struct page);
unsigned long start_pfn = page_to_pfn((struct page *)start);

if ((start_pfn + nr_pfn) > altmap->end_pfn)
return true;

if (start_pfn < altmap->base_pfn)
return true;

return false;
}

int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
struct vmem_altmap *altmap)
{
Expand All @@ -178,7 +193,7 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
* fail due to alignment issues when using 16MB hugepages, so
* fall back to system memory if the altmap allocation fail.
*/
if (altmap) {
if (altmap && !altmap_cross_boundary(altmap, start, page_size)) {
p = altmap_alloc_block_buf(page_size, altmap);
if (!p)
pr_debug("altmap block allocation failed, falling back to system memory");
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/pseries/papr_scm.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static int papr_scm_meta_get(struct papr_scm_priv *p,
int len, read;
int64_t ret;

if ((hdr->in_offset + hdr->in_length) >= p->metadata_size)
if ((hdr->in_offset + hdr->in_length) > p->metadata_size)
return -EINVAL;

for (len = hdr->in_length; len; len -= read) {
Expand Down Expand Up @@ -178,7 +178,7 @@ static int papr_scm_meta_set(struct papr_scm_priv *p,
__be64 data_be;
int64_t ret;

if ((hdr->in_offset + hdr->in_length) >= p->metadata_size)
if ((hdr->in_offset + hdr->in_length) > p->metadata_size)
return -EINVAL;

for (len = hdr->in_length; len; len -= wrote) {
Expand Down
3 changes: 0 additions & 3 deletions arch/x86/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <linux/init.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/memory.h>

#include <trace/syscall.h>

Expand All @@ -35,7 +34,6 @@

int ftrace_arch_code_modify_prepare(void)
{
mutex_lock(&text_mutex);
set_kernel_text_rw();
set_all_modules_text_rw();
return 0;
Expand All @@ -45,7 +43,6 @@ int ftrace_arch_code_modify_post_process(void)
{
set_all_modules_text_ro();
set_kernel_text_ro();
mutex_unlock(&text_mutex);
return 0;
}

Expand Down
17 changes: 9 additions & 8 deletions drivers/net/xen-netfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,9 +885,9 @@ static int xennet_set_skb_gso(struct sk_buff *skb,
return 0;
}

static RING_IDX xennet_fill_frags(struct netfront_queue *queue,
struct sk_buff *skb,
struct sk_buff_head *list)
static int xennet_fill_frags(struct netfront_queue *queue,
struct sk_buff *skb,
struct sk_buff_head *list)
{
RING_IDX cons = queue->rx.rsp_cons;
struct sk_buff *nskb;
Expand All @@ -906,7 +906,7 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue,
if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) {
queue->rx.rsp_cons = ++cons + skb_queue_len(list);
kfree_skb(nskb);
return ~0U;
return -ENOENT;
}

skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
Expand All @@ -917,7 +917,9 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue,
kfree_skb(nskb);
}

return cons;
queue->rx.rsp_cons = cons;

return 0;
}

static int checksum_setup(struct net_device *dev, struct sk_buff *skb)
Expand Down Expand Up @@ -1043,8 +1045,7 @@ static int xennet_poll(struct napi_struct *napi, int budget)
skb->data_len = rx->status;
skb->len += rx->status;

i = xennet_fill_frags(queue, skb, &tmpq);
if (unlikely(i == ~0U))
if (unlikely(xennet_fill_frags(queue, skb, &tmpq)))
goto err;

if (rx->flags & XEN_NETRXF_csum_blank)
Expand All @@ -1054,7 +1055,7 @@ static int xennet_poll(struct napi_struct *napi, int budget)

__skb_queue_tail(&rxq, skb);

queue->rx.rsp_cons = ++i;
i = ++queue->rx.rsp_cons;
work_done++;
}

Expand Down
2 changes: 2 additions & 0 deletions drivers/nvdimm/pfn_devs.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,11 @@ static int __nvdimm_setup_pfn(struct nd_pfn *nd_pfn, struct dev_pagemap *pgmap)
struct nd_namespace_common *ndns = nd_pfn->ndns;
struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev);
resource_size_t base = nsio->res.start + start_pad;
resource_size_t end = nsio->res.end - end_trunc;
struct vmem_altmap __altmap = {
.base_pfn = init_altmap_base(base),
.reserve = init_altmap_reserve(base),
.end_pfn = PHYS_PFN(end),
};

memcpy(res, &nsio->res, sizeof(*res));
Expand Down
44 changes: 44 additions & 0 deletions drivers/pci/quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2231,6 +2231,12 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005f, quirk_blacklist_vpd);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, PCI_ANY_ID,
quirk_blacklist_vpd);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_QLOGIC, 0x2261, quirk_blacklist_vpd);
/*
* The Amazon Annapurna Labs 0x0031 device id is reused for other non Root Port
* device types, so the quirk is registered for the PCI_CLASS_BRIDGE_PCI class.
*/
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031,
PCI_CLASS_BRIDGE_PCI, 8, quirk_blacklist_vpd);

/*
* For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the
Expand Down Expand Up @@ -2853,6 +2859,24 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, 0x10a1,
quirk_msi_intx_disable_qca_bug);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, 0xe091,
quirk_msi_intx_disable_qca_bug);

/*
* Amazon's Annapurna Labs 1c36:0031 Root Ports don't support MSI-X, so it
* should be disabled on platforms where the device (mistakenly) advertises it.
*
* Notice that this quirk also disables MSI (which may work, but hasn't been
* tested), since currently there is no standard way to disable only MSI-X.
*
* The 0031 device id is reused for other non Root Port device types,
* therefore the quirk is registered for the PCI_CLASS_BRIDGE_PCI class.
*/
static void quirk_al_msi_disable(struct pci_dev *dev)
{
dev->no_msi = 1;
pci_warn(dev, "Disabling MSI/MSI-X\n");
}
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031,
PCI_CLASS_BRIDGE_PCI, 8, quirk_al_msi_disable);
#endif /* CONFIG_PCI_MSI */

/* Allow manual resource allocation for PCI hotplug bridges
Expand Down Expand Up @@ -4520,6 +4544,24 @@ static int pci_quirk_qcom_rp_acs(struct pci_dev *dev, u16 acs_flags)
return ret;
}

static int pci_quirk_al_acs(struct pci_dev *dev, u16 acs_flags)
{
if (pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT)
return -ENOTTY;

/*
* Amazon's Annapurna Labs root ports don't include an ACS capability,
* but do include ACS-like functionality. The hardware doesn't support
* peer-to-peer transactions via the root port and each has a unique
* segment number.
*
* Additionally, the root ports cannot send traffic to each other.
*/
acs_flags &= ~(PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF);

return acs_flags ? 0 : 1;
}

/*
* Sunrise Point PCH root ports implement ACS, but unfortunately as shown in
* the datasheet (Intel 100 Series Chipset Family PCH Datasheet, Vol. 2,
Expand Down Expand Up @@ -4711,6 +4753,8 @@ static const struct pci_dev_acs_enabled {
{ PCI_VENDOR_ID_AMPERE, 0xE00A, pci_quirk_xgene_acs },
{ PCI_VENDOR_ID_AMPERE, 0xE00B, pci_quirk_xgene_acs },
{ PCI_VENDOR_ID_AMPERE, 0xE00C, pci_quirk_xgene_acs },
/* Amazon Annapurna Labs */
{ PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, pci_quirk_al_acs },
{ 0 }
};

Expand Down
20 changes: 18 additions & 2 deletions drivers/xen/xenbus/xenbus_dev_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/miscdevice.h>
#include <linux/workqueue.h>

#include <xen/xenbus.h>
#include <xen/xen.h>
Expand Down Expand Up @@ -113,6 +114,8 @@ struct xenbus_file_priv {
wait_queue_head_t read_waitq;

struct kref kref;

struct work_struct wq;
};

/* Read out any raw xenbus messages queued up. */
Expand Down Expand Up @@ -297,14 +300,14 @@ static void watch_fired(struct xenbus_watch *watch,
mutex_unlock(&adap->dev_data->reply_mutex);
}

static void xenbus_file_free(struct kref *kref)
static void xenbus_worker(struct work_struct *wq)
{
struct xenbus_file_priv *u;
struct xenbus_transaction_holder *trans, *tmp;
struct watch_adapter *watch, *tmp_watch;
struct read_buffer *rb, *tmp_rb;

u = container_of(kref, struct xenbus_file_priv, kref);
u = container_of(wq, struct xenbus_file_priv, wq);

/*
* No need for locking here because there are no other users,
Expand All @@ -330,6 +333,18 @@ static void xenbus_file_free(struct kref *kref)
kfree(u);
}

static void xenbus_file_free(struct kref *kref)
{
struct xenbus_file_priv *u;

/*
* We might be called in xenbus_thread().
* Use workqueue to avoid deadlock.
*/
u = container_of(kref, struct xenbus_file_priv, kref);
schedule_work(&u->wq);
}

static struct xenbus_transaction_holder *xenbus_get_transaction(
struct xenbus_file_priv *u, uint32_t tx_id)
{
Expand Down Expand Up @@ -626,6 +641,7 @@ static int xenbus_file_open(struct inode *inode, struct file *filp)
INIT_LIST_HEAD(&u->watches);
INIT_LIST_HEAD(&u->read_buffers);
init_waitqueue_head(&u->read_waitq);
INIT_WORK(&u->wq, xenbus_worker);

mutex_init(&u->reply_mutex);
mutex_init(&u->msgbuffer_mutex);
Expand Down
5 changes: 4 additions & 1 deletion fs/btrfs/qgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -3452,6 +3452,9 @@ int btrfs_qgroup_reserve_data(struct inode *inode,
clear_extent_bit(&BTRFS_I(inode)->io_tree, unode->val,
unode->aux, EXTENT_QGROUP_RESERVED, 0, 0, NULL,
GFP_NOFS);
/* Also free data bytes of already reserved one */
btrfs_qgroup_free_refroot(root->fs_info, root->root_key.objectid,
orig_reserved, BTRFS_QGROUP_RSV_DATA);
extent_changeset_release(reserved);
return ret;
}
Expand Down Expand Up @@ -3496,7 +3499,7 @@ static int qgroup_free_reserved_data(struct inode *inode,
* EXTENT_QGROUP_RESERVED, we won't double free.
* So not need to rush.
*/
ret = clear_record_extent_bits(&BTRFS_I(inode)->io_failure_tree,
ret = clear_record_extent_bits(&BTRFS_I(inode)->io_tree,
free_start, free_start + free_len - 1,
EXTENT_QGROUP_RESERVED, &changeset);
if (ret < 0)
Expand Down
9 changes: 8 additions & 1 deletion fs/btrfs/relocation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,13 @@ int btrfs_init_reloc_root(struct btrfs_trans_handle *trans,
int clear_rsv = 0;
int ret;

/*
* The subvolume has reloc tree but the swap is finished, no need to
* create/update the dead reloc tree
*/
if (test_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state))
return 0;

if (root->reloc_root) {
reloc_root = root->reloc_root;
reloc_root->last_trans = trans->transid;
Expand Down Expand Up @@ -2228,7 +2235,6 @@ static int clean_dirty_subvols(struct reloc_control *rc)
/* Merged subvolume, cleanup its reloc root */
struct btrfs_root *reloc_root = root->reloc_root;

clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state);
list_del_init(&root->reloc_dirty_list);
root->reloc_root = NULL;
if (reloc_root) {
Expand All @@ -2237,6 +2243,7 @@ static int clean_dirty_subvols(struct reloc_control *rc)
if (ret2 < 0 && !ret)
ret = ret2;
}
clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state);
btrfs_put_fs_root(root);
} else {
/* Orphan reloc tree, just clean it up */
Expand Down
10 changes: 8 additions & 2 deletions fs/ceph/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,13 +531,16 @@ static void ceph_i_callback(struct rcu_head *head)
kmem_cache_free(ceph_inode_cachep, ci);
}

void ceph_destroy_inode(struct inode *inode)
void ceph_evict_inode(struct inode *inode)
{
struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_inode_frag *frag;
struct rb_node *n;

dout("destroy_inode %p ino %llx.%llx\n", inode, ceph_vinop(inode));
dout("evict_inode %p ino %llx.%llx\n", inode, ceph_vinop(inode));

truncate_inode_pages_final(&inode->i_data);
clear_inode(inode);

ceph_fscache_unregister_inode_cookie(ci);

Expand Down Expand Up @@ -579,7 +582,10 @@ void ceph_destroy_inode(struct inode *inode)
ceph_buffer_put(ci->i_xattrs.prealloc_blob);

ceph_put_string(rcu_dereference_raw(ci->i_layout.pool_ns));
}

void ceph_destroy_inode(struct inode *inode)
{
call_rcu(&inode->i_rcu, ceph_i_callback);
}

Expand Down
1 change: 1 addition & 0 deletions fs/ceph/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,7 @@ static const struct super_operations ceph_super_ops = {
.destroy_inode = ceph_destroy_inode,
.write_inode = ceph_write_inode,
.drop_inode = ceph_drop_inode,
.evict_inode = ceph_evict_inode,
.sync_fs = ceph_sync_fs,
.put_super = ceph_put_super,
.remount_fs = ceph_remount,
Expand Down
1 change: 1 addition & 0 deletions fs/ceph/super.h
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ static inline bool __ceph_have_pending_cap_snap(struct ceph_inode_info *ci)
extern const struct inode_operations ceph_file_iops;

extern struct inode *ceph_alloc_inode(struct super_block *sb);
extern void ceph_evict_inode(struct inode *inode);
extern void ceph_destroy_inode(struct inode *inode);
extern int ceph_drop_inode(struct inode *inode);

Expand Down
3 changes: 3 additions & 0 deletions include/linux/memremap.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ struct vmem_altmap {
unsigned long free;
unsigned long align;
unsigned long alloc;
#ifndef __GENKSYMS__
const unsigned long end_pfn;
#endif
};

/*
Expand Down
2 changes: 2 additions & 0 deletions include/linux/pci_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -2551,6 +2551,8 @@

#define PCI_VENDOR_ID_ASMEDIA 0x1b21

#define PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS 0x1c36

#define PCI_VENDOR_ID_CIRCUITCO 0x1cc8
#define PCI_SUBSYSTEM_ID_CIRCUITCO_MINNOWBOARD 0x0001

Expand Down
Loading

0 comments on commit 5f05cae

Please sign in to comment.