From c1fd444caac49aa1c827d8d09ac6998e941e4fc3 Mon Sep 17 00:00:00 2001 From: Ivan T. Ivanov Date: May 16 2023 09:02:15 +0000 Subject: Merge branch 'users/jgross/SLE12-SP5/for-next' into SLE12-SP5 Resolve conflict in series.conf --- diff --git a/patches.suse/ACPI-processor-Fix-evaluating-_PDC-method-when-runni.patch b/patches.suse/ACPI-processor-Fix-evaluating-_PDC-method-when-runni.patch new file mode 100644 index 0000000..5f87fa1 --- /dev/null +++ b/patches.suse/ACPI-processor-Fix-evaluating-_PDC-method-when-runni.patch @@ -0,0 +1,145 @@ +Patch-mainline: v6.4-rc1 +Git-commit: 073828e954459b883f23e53999d31e4c55ab9654 +References: git-fixes +From: Roger Pau Monne +Date: Wed, 22 Mar 2023 12:13:29 +0100 +Subject: [PATCH] ACPI: processor: Fix evaluating _PDC method when running as + Xen dom0 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In ACPI systems, the OS can direct power management, as opposed to the +firmware. This OS-directed Power Management is called OSPM. Part of +telling the firmware that the OS going to direct power management is +making ACPI "_PDC" (Processor Driver Capabilities) calls. These _PDC +methods must be evaluated for every processor object. If these _PDC +calls are not completed for every processor it can lead to +inconsistency and later failures in things like the CPU frequency +driver. + +In a Xen system, the dom0 kernel is responsible for system-wide power +management. The dom0 kernel is in charge of OSPM. However, the +number of CPUs available to dom0 can be different than the number of +CPUs physically present on the system. + +This leads to a problem: the dom0 kernel needs to evaluate _PDC for +all the processors, but it can't always see them. + +In dom0 kernels, ignore the existing ACPI method for determining if a +processor is physically present because it might not be accurate. +Instead, ask the hypervisor for this information. + +Fix this by introducing a custom function to use when running as Xen +dom0 in order to check whether a processor object matches a CPU that's +online. Such checking is done using the existing information fetched +by the Xen pCPU subsystem, extending it to also store the ACPI ID. + +This ensures that _PDC method gets evaluated for all physically online +CPUs, regardless of the number of CPUs made available to dom0. + +Fixes: 5d554a7bb064 ("ACPI: processor: add internal processor_physically_present()") +Signed-off-by: Roger Pau Monné +Reviewed-by: Juergen Gross +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Juergen Gross +--- + drivers/acpi/processor_pdc.c | 11 +++++++++++ + drivers/xen/pcpu.c | 20 ++++++++++++++++++++ + include/xen/xen.h | 11 +++++++++++ + 3 files changed, 42 insertions(+) + +diff --git a/drivers/acpi/processor_pdc.c b/drivers/acpi/processor_pdc.c +index 8c3f82c9fff3..18fb04523f93 100644 +--- a/drivers/acpi/processor_pdc.c ++++ b/drivers/acpi/processor_pdc.c +@@ -14,6 +14,8 @@ + #include + #include + ++#include ++ + #include "internal.h" + + #define _COMPONENT ACPI_PROCESSOR_COMPONENT +@@ -47,6 +49,15 @@ static bool __init processor_physically_present(acpi_handle handle) + return false; + } + ++ if (xen_initial_domain()) ++ /* ++ * When running as a Xen dom0 the number of processors Linux ++ * sees can be different from the real number of processors on ++ * the system, and we still need to execute _PDC for all of ++ * them. ++ */ ++ return xen_processor_present(acpi_id); ++ + type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0; + cpuid = acpi_get_cpuid(handle, type, acpi_id); + +diff --git a/drivers/xen/pcpu.c b/drivers/xen/pcpu.c +index fd3a644b0855..b3e3d1bb37f3 100644 +--- a/drivers/xen/pcpu.c ++++ b/drivers/xen/pcpu.c +@@ -58,6 +58,7 @@ struct pcpu { + struct list_head list; + struct device dev; + uint32_t cpu_id; ++ uint32_t acpi_id; + uint32_t flags; + }; + +@@ -249,6 +250,7 @@ static struct pcpu *create_and_register_pcpu(struct xenpf_pcpuinfo *info) + + INIT_LIST_HEAD(&pcpu->list); + pcpu->cpu_id = info->xen_cpuid; ++ pcpu->acpi_id = info->acpi_id; + pcpu->flags = info->flags; + + /* Need hold on xen_pcpu_lock before pcpu list manipulations */ +@@ -381,3 +383,21 @@ static int __init xen_pcpu_init(void) + return ret; + } + arch_initcall(xen_pcpu_init); ++ ++#ifdef CONFIG_ACPI ++bool __init xen_processor_present(uint32_t acpi_id) ++{ ++ const struct pcpu *pcpu; ++ bool online = false; ++ ++ mutex_lock(&xen_pcpu_lock); ++ list_for_each_entry(pcpu, &xen_pcpus, list) ++ if (pcpu->acpi_id == acpi_id) { ++ online = pcpu->flags & XEN_PCPU_FLAGS_ONLINE; ++ break; ++ } ++ mutex_unlock(&xen_pcpu_lock); ++ ++ return online; ++} ++#endif +diff --git a/include/xen/xen.h b/include/xen/xen.h +index 7adf59837c25..0efeb652f9b8 100644 +--- a/include/xen/xen.h ++++ b/include/xen/xen.h +@@ -71,4 +71,15 @@ static inline void xen_free_unpopulated_pages(unsigned int nr_pages, + bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, + const struct bio_vec *vec2); + ++#if defined(CONFIG_XEN_DOM0) && defined(CONFIG_ACPI) && defined(CONFIG_X86) ++bool __init xen_processor_present(uint32_t acpi_id); ++#else ++#include ++static inline bool xen_processor_present(uint32_t acpi_id) ++{ ++ BUG(); ++ return false; ++} ++#endif ++ + #endif /* _XEN_XEN_H */ +-- +2.35.3 + diff --git a/patches.suse/xen-netback-don-t-do-grant-copy-across-page-boundary.patch b/patches.suse/xen-netback-don-t-do-grant-copy-across-page-boundary.patch new file mode 100644 index 0000000..d1a29aa --- /dev/null +++ b/patches.suse/xen-netback-don-t-do-grant-copy-across-page-boundary.patch @@ -0,0 +1,122 @@ +Patch-mainline: v6.3-rc5 +Git-commit: 05310f31ca74673a96567fb14637b7d5d6c82ea5 +References: git-fixes +From: Juergen Gross +Date: Mon, 27 Mar 2023 10:36:45 +0200 +Subject: [PATCH] xen/netback: don't do grant copy across page boundary + +Fix xenvif_get_requests() not to do grant copy operations across local +page boundaries. This requires to double the maximum number of copy +operations per queue, as each copy could now be split into 2. + +Make sure that struct xenvif_tx_cb doesn't grow too large. + +Cc: stable@vger.kernel.org +Fixes: ad7f402ae4f4 ("xen/netback: Ensure protocol headers don't fall in the non-linear area") +Signed-off-by: Juergen Gross +Reviewed-by: Paul Durrant +Signed-off-by: Paolo Abeni +--- + drivers/net/xen-netback/common.h | 2 +- + drivers/net/xen-netback/netback.c | 25 +++++++++++++++++++++++-- + 2 files changed, 24 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h +index 3dbfc8a6924e..1fcbd83f7ff2 100644 +--- a/drivers/net/xen-netback/common.h ++++ b/drivers/net/xen-netback/common.h +@@ -166,7 +166,7 @@ struct xenvif_queue { /* Per-queue data for xenvif */ + struct pending_tx_info pending_tx_info[MAX_PENDING_REQS]; + grant_handle_t grant_tx_handle[MAX_PENDING_REQS]; + +- struct gnttab_copy tx_copy_ops[MAX_PENDING_REQS]; ++ struct gnttab_copy tx_copy_ops[2 * MAX_PENDING_REQS]; + struct gnttab_map_grant_ref tx_map_ops[MAX_PENDING_REQS]; + struct gnttab_unmap_grant_ref tx_unmap_ops[MAX_PENDING_REQS]; + /* passed to gnttab_[un]map_refs with pages under (un)mapping */ +diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c +index 1b42676ca141..111c179f161b 100644 +--- a/drivers/net/xen-netback/netback.c ++++ b/drivers/net/xen-netback/netback.c +@@ -334,6 +334,7 @@ static int xenvif_count_requests(struct xenvif_queue *queue, + struct xenvif_tx_cb { + u16 copy_pending_idx[XEN_NETBK_LEGACY_SLOTS_MAX + 1]; + u8 copy_count; ++ u32 split_mask; + }; + + #define XENVIF_TX_CB(skb) ((struct xenvif_tx_cb *)(skb)->cb) +@@ -361,6 +362,8 @@ static inline struct sk_buff *xenvif_alloc_skb(unsigned int size) + struct sk_buff *skb = + alloc_skb(size + NET_SKB_PAD + NET_IP_ALIGN, + GFP_ATOMIC | __GFP_NOWARN); ++ ++ BUILD_BUG_ON(sizeof(*XENVIF_TX_CB(skb)) > sizeof(skb->cb)); + if (unlikely(skb == NULL)) + return NULL; + +@@ -396,11 +399,13 @@ static void xenvif_get_requests(struct xenvif_queue *queue, + nr_slots = shinfo->nr_frags + 1; + + copy_count(skb) = 0; ++ XENVIF_TX_CB(skb)->split_mask = 0; + + /* Create copy ops for exactly data_len bytes into the skb head. */ + __skb_put(skb, data_len); + while (data_len > 0) { + int amount = data_len > txp->size ? txp->size : data_len; ++ bool split = false; + + cop->source.u.ref = txp->gref; + cop->source.domid = queue->vif->domid; +@@ -413,6 +418,13 @@ static void xenvif_get_requests(struct xenvif_queue *queue, + cop->dest.u.gmfn = virt_to_gfn(skb->data + skb_headlen(skb) + - data_len); + ++ /* Don't cross local page boundary! */ ++ if (cop->dest.offset + amount > XEN_PAGE_SIZE) { ++ amount = XEN_PAGE_SIZE - cop->dest.offset; ++ XENVIF_TX_CB(skb)->split_mask |= 1U << copy_count(skb); ++ split = true; ++ } ++ + cop->len = amount; + cop->flags = GNTCOPY_source_gref; + +@@ -420,7 +432,8 @@ static void xenvif_get_requests(struct xenvif_queue *queue, + pending_idx = queue->pending_ring[index]; + callback_param(queue, pending_idx).ctx = NULL; + copy_pending_idx(skb, copy_count(skb)) = pending_idx; +- copy_count(skb)++; ++ if (!split) ++ copy_count(skb)++; + + cop++; + data_len -= amount; +@@ -441,7 +454,8 @@ static void xenvif_get_requests(struct xenvif_queue *queue, + nr_slots--; + } else { + /* The copy op partially covered the tx_request. +- * The remainder will be mapped. ++ * The remainder will be mapped or copied in the next ++ * iteration. + */ + txp->offset += amount; + txp->size -= amount; +@@ -539,6 +553,13 @@ static int xenvif_tx_check_gop(struct xenvif_queue *queue, + pending_idx = copy_pending_idx(skb, i); + + newerr = (*gopp_copy)->status; ++ ++ /* Split copies need to be handled together. */ ++ if (XENVIF_TX_CB(skb)->split_mask & (1U << i)) { ++ (*gopp_copy)++; ++ if (!newerr) ++ newerr = (*gopp_copy)->status; ++ } + if (likely(!newerr)) { + /* The first frag might still have this slot mapped */ + if (i < copy_count(skb) - 1 || !sharedslot) +-- +2.35.3 + diff --git a/patches.suse/xen-netback-use-same-error-messages-for-same-errors.patch b/patches.suse/xen-netback-use-same-error-messages-for-same-errors.patch new file mode 100644 index 0000000..f057fa2 --- /dev/null +++ b/patches.suse/xen-netback-use-same-error-messages-for-same-errors.patch @@ -0,0 +1,39 @@ +Patch-mainline: v6.3-rc5 +Git-commit: 2eca98e5b24d01c02b46c67be05a5f98cc9789b1 +References: git-fixes +From: Juergen Gross +Date: Wed, 29 Mar 2023 10:02:59 +0200 +Subject: [PATCH] xen/netback: use same error messages for same errors + +Issue the same error message in case an illegal page boundary crossing +has been detected in both cases where this is tested. + +Suggested-by: Jan Beulich +Signed-off-by: Juergen Gross +Reviewed-by: Jan Beulich +Link: https://lore.kernel.org/r/20230329080259.14823-1-jgross@suse.com +Signed-off-by: Paolo Abeni +--- + drivers/net/xen-netback/netback.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c +index 4943be4fd99d..c1501f41e2d8 100644 +--- a/drivers/net/xen-netback/netback.c ++++ b/drivers/net/xen-netback/netback.c +@@ -994,10 +994,8 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, + + /* No crossing a page as the payload mustn't fragment. */ + if (unlikely((txreq.offset + txreq.size) > XEN_PAGE_SIZE)) { +- netdev_err(queue->vif->dev, +- "txreq.offset: %u, size: %u, end: %lu\n", +- txreq.offset, txreq.size, +- (unsigned long)(txreq.offset&~XEN_PAGE_MASK) + txreq.size); ++ netdev_err(queue->vif->dev, "Cross page boundary, txreq.offset: %u, size: %u\n", ++ txreq.offset, txreq.size); + xenvif_fatal_tx_err(queue->vif); + break; + } +-- +2.35.3 + diff --git a/series.conf b/series.conf index 615e946..7a09ba5 100644 --- a/series.conf +++ b/series.conf @@ -63317,6 +63317,8 @@ patches.suse/power-supply-da9150-Fix-use-after-free-bug-in-da9150.patch patches.suse/usb-chipidea-core-fix-possible-concurrent-when-switc.patch patches.suse/s390-vfio-ap-fix-memory-leak-in-vfio_ap-device-drive.patch + patches.suse/xen-netback-don-t-do-grant-copy-across-page-boundary.patch + patches.suse/xen-netback-use-same-error-messages-for-same-errors.patch patches.suse/NFSv4-Fix-hangs-when-recovering-open-state-after-a-s.patch patches.suse/powerpc-Don-t-try-to-copy-PPR-for-task-with-NULL-pt_.patch patches.suse/ring-buffer-Fix-race-while-reader-and-writer-are-on-the-same-page.patch @@ -63326,6 +63328,7 @@ patches.suse/cgroup-cpuset-Wake-up-cpuset_attach_wq-tasks-in-cpuset_cancel_attach.patch patches.suse/cifs-fix-negotiate-context-parsing.patch patches.suse/powerpc-papr_scm-Update-the-NUMA-distance-table-for-.patch + patches.suse/ACPI-processor-Fix-evaluating-_PDC-method-when-runni.patch patches.suse/0001-wifi-brcmfmac-slab-out-of-bounds-read-in-brcmf_get_a.patch patches.suse/wifi-ath5k-fix-an-off-by-one-check-in-ath5k_eeprom_r.patch patches.suse/ipmi-fix-SSIF-not-responding-under-certain-cond.patch