* Re: [PATCH -next] PCI: rpaphp: remove set but not used variable 'value'
From: Bjorn Helgaas @ 2020-03-12 14:41 UTC (permalink / raw)
To: Chen Zhou; +Cc: tyreld, linux-pci, linux-kernel, paulus, linuxppc-dev
In-Reply-To: <20200312143800.GA109542@google.com>
On Thu, Mar 12, 2020 at 09:38:02AM -0500, Bjorn Helgaas wrote:
> On Thu, Mar 12, 2020 at 10:04:12PM +0800, Chen Zhou wrote:
> > Fixes gcc '-Wunused-but-set-variable' warning:
> >
> > drivers/pci/hotplug/rpaphp_core.c: In function is_php_type:
> > drivers/pci/hotplug/rpaphp_core.c:291:16: warning:
> > variable value set but not used [-Wunused-but-set-variable]
> >
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
>
> Michael, if you want this:
>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
>
> If you don't mind, edit the subject to follow the convention, e.g.,
>
> PCI: rpaphp: Remove unused variable 'value'
>
> Apparently simple_strtoul() is deprecated and we're supposed to use
> kstrtoul() instead. Looks like kstrtoul() might simplify the code a
> little, too, e.g.,
>
> if (kstrtoul(drc_type, 0, &value) == 0)
> return 1;
>
> return 0;
I guess there are several other uses of simple_strtoul() in this file.
Not sure if it's worth changing them all, just this one, or just the
patch below as-is.
> > ---
> > drivers/pci/hotplug/rpaphp_core.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
> > index e408e40..5d871ef 100644
> > --- a/drivers/pci/hotplug/rpaphp_core.c
> > +++ b/drivers/pci/hotplug/rpaphp_core.c
> > @@ -288,11 +288,10 @@ EXPORT_SYMBOL_GPL(rpaphp_check_drc_props);
> >
> > static int is_php_type(char *drc_type)
> > {
> > - unsigned long value;
> > char *endptr;
> >
> > /* PCI Hotplug nodes have an integer for drc_type */
> > - value = simple_strtoul(drc_type, &endptr, 10);
> > + simple_strtoul(drc_type, &endptr, 10);
> > if (endptr == drc_type)
> > return 0;
> >
> > --
> > 2.7.4
> >
^ permalink raw reply
* Re: [PATCH -next] PCI: rpaphp: remove set but not used variable 'value'
From: Bjorn Helgaas @ 2020-03-12 14:38 UTC (permalink / raw)
To: Chen Zhou; +Cc: tyreld, linux-pci, linux-kernel, paulus, linuxppc-dev
In-Reply-To: <20200312140412.32373-1-chenzhou10@huawei.com>
On Thu, Mar 12, 2020 at 10:04:12PM +0800, Chen Zhou wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/pci/hotplug/rpaphp_core.c: In function is_php_type:
> drivers/pci/hotplug/rpaphp_core.c:291:16: warning:
> variable value set but not used [-Wunused-but-set-variable]
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Michael, if you want this:
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
If you don't mind, edit the subject to follow the convention, e.g.,
PCI: rpaphp: Remove unused variable 'value'
Apparently simple_strtoul() is deprecated and we're supposed to use
kstrtoul() instead. Looks like kstrtoul() might simplify the code a
little, too, e.g.,
if (kstrtoul(drc_type, 0, &value) == 0)
return 1;
return 0;
> ---
> drivers/pci/hotplug/rpaphp_core.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
> index e408e40..5d871ef 100644
> --- a/drivers/pci/hotplug/rpaphp_core.c
> +++ b/drivers/pci/hotplug/rpaphp_core.c
> @@ -288,11 +288,10 @@ EXPORT_SYMBOL_GPL(rpaphp_check_drc_props);
>
> static int is_php_type(char *drc_type)
> {
> - unsigned long value;
> char *endptr;
>
> /* PCI Hotplug nodes have an integer for drc_type */
> - value = simple_strtoul(drc_type, &endptr, 10);
> + simple_strtoul(drc_type, &endptr, 10);
> if (endptr == drc_type)
> return 0;
>
> --
> 2.7.4
>
^ permalink raw reply
* [PATCH -next] PCI: rpaphp: remove set but not used variable 'value'
From: Chen Zhou @ 2020-03-12 14:04 UTC (permalink / raw)
To: paulus, mpe, tyreld, bhelgaas
Cc: chenzhou10, linux-pci, linuxppc-dev, linux-kernel
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/pci/hotplug/rpaphp_core.c: In function is_php_type:
drivers/pci/hotplug/rpaphp_core.c:291:16: warning:
variable value set but not used [-Wunused-but-set-variable]
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
---
drivers/pci/hotplug/rpaphp_core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index e408e40..5d871ef 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -288,11 +288,10 @@ EXPORT_SYMBOL_GPL(rpaphp_check_drc_props);
static int is_php_type(char *drc_type)
{
- unsigned long value;
char *endptr;
/* PCI Hotplug nodes have an integer for drc_type */
- value = simple_strtoul(drc_type, &endptr, 10);
+ simple_strtoul(drc_type, &endptr, 10);
if (endptr == drc_type)
return 0;
--
2.7.4
^ permalink raw reply related
* Re: [PATCH 1/3] powerpc/numa: Set numa_node for all possible cpus
From: Vlastimil Babka @ 2020-03-12 13:51 UTC (permalink / raw)
To: Srikar Dronamraju
Cc: Sachin Sant, linuxppc-dev, LKML, Michal Hocko, linux-mm,
Mel Gorman, Joonsoo Kim, Kirill A. Shutemov, Andrew Morton,
Linus Torvalds, Christopher Lameter
In-Reply-To: <20200312131438.GB3277@linux.vnet.ibm.com>
On 3/12/20 2:14 PM, Srikar Dronamraju wrote:
> * Vlastimil Babka <vbabka@suse.cz> [2020-03-12 10:30:50]:
>
>> On 3/12/20 9:23 AM, Sachin Sant wrote:
>> >> On 12-Mar-2020, at 10:57 AM, Srikar Dronamraju <srikar@linux.vnet.ibm.com> wrote:
>> >> * Michal Hocko <mhocko@kernel.org> [2020-03-11 12:57:35]:
>> >>> On Wed 11-03-20 16:32:35, Srikar Dronamraju wrote:
>> >>>> To ensure a cpuless, memoryless dummy node is not online, powerpc need
>> >>>> to make sure all possible but not present cpu_to_node are set to a
>> >>>> proper node.
>> >>>
>> >>> Just curious, is this somehow related to
>> >>> http://lkml.kernel.org/r/20200227182650.GG3771@dhcp22.suse.cz?
>> >>>
>> >>
>> >> The issue I am trying to fix is a known issue in Powerpc since many years.
>> >> So this surely not a problem after a75056fc1e7c (mm/memcontrol.c: allocate
>> >> shrinker_map on appropriate NUMA node").
>> >>
>> >> I tried v5.6-rc4 + a75056fc1e7c but didnt face any issues booting the
>> >> kernel. Will work with Sachin/Abdul (reporters of the issue).
>
> I had used v1 and not v2. So my mistake.
>
>> > I applied this 3 patch series on top of March 11 next tree (commit d44a64766795 )
>> > The kernel still fails to boot with same call trace.
>>
>
> While I am not an expert in the slub area, I looked at the patch
> a75056fc1e7c and had some thoughts on why this could be causing this issue.
>
> On the system where the crash happens, the possible number of nodes is much
> greater than the number of onlined nodes. The pdgat or the NODE_DATA is only
> available for onlined nodes.
>
> With a75056fc1e7c memcg_alloc_shrinker_maps, we end up calling kzalloc_node
> for all possible nodes and in ___slab_alloc we end up looking at the
> node_present_pages which is NODE_DATA(nid)->node_present_pages.
> i.e for a node whose pdgat struct is not allocated, we are trying to
> dereference.
From what we saw, the pgdat does exist, the problem is that slab's per-node data
doesn't exist for a node that doesn't have present pages, as it would be a waste
of memory.
Uh actually you are probably right, the NODE_DATA doesn't exist anymore? In
Sachin's first report [1] we have
[ 0.000000] numa: NODE_DATA [mem 0x8bfedc900-0x8bfee3fff]
[ 0.000000] numa: NODE_DATA(0) on node 1
[ 0.000000] numa: NODE_DATA [mem 0x8bfed5200-0x8bfedc8ff]
But in this thread, with your patches Sachin reports:
[ 0.000000] numa: NODE_DATA [mem 0x8bfedc900-0x8bfee3fff]
So I assume it's just node 1. In that case, node_present_pages is really dangerous.
[1]
https://lore.kernel.org/linux-next/3381CD91-AB3D-4773-BA04-E7A072A63968@linux.vnet.ibm.com/
> Also for a memoryless/cpuless node or possible but not present nodes,
> node_to_mem_node(node) will still end up as node (atleast on powerpc).
I think that's the place where this would be best to fix.
> I tried with this hunk below and it works.
>
> But I am not sure if we need to check at other places were
> node_present_pages is being called.
I think this seems to defeat the purpose of node_to_mem_node()? Shouldn't it
return only nodes that are online with present memory?
CCing Joonsoo who seems to have introduced this in ad2c8144418c ("topology: add
support for node_to_mem_node() to determine the fallback node")
I think we do need well defined and documented rules around node_to_mem_node(),
cpu_to_node(), existence of NODE_DATA, various node_states bitmaps etc so
everyone handles it the same, safe way.
> diff --git a/mm/slub.c b/mm/slub.c
> index 626cbcbd977f..bddb93bed55e 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -2571,9 +2571,13 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
> if (unlikely(!node_match(page, node))) {
> int searchnode = node;
>
> - if (node != NUMA_NO_NODE && !node_present_pages(node))
> - searchnode = node_to_mem_node(node);
> -
> + if (node != NUMA_NO_NODE) {
> + if (!node_online(node) || !node_present_pages(node)) {
> + searchnode = node_to_mem_node(node);
> + if (!node_online(searchnode))
> + searchnode = first_online_node;
> + }
> + }
> if (unlikely(!node_match(page, searchnode))) {
> stat(s, ALLOC_NODE_MISMATCH);
> deactivate_slab(s, page, c->freelist, c);
>
>> >
>>
>
^ permalink raw reply
* [PATCH v3 6/6] asm-generic/tlb: avoid potential double flush
From: Santosh Sivaraj @ 2020-03-12 13:27 UTC (permalink / raw)
To: stable, linuxppc-dev
Cc: Sasha Levin, Peter Zijlstra, Aneesh Kumar K . V, Greg KH
In-Reply-To: <20200312132740.225241-1-santosh@fossix.org>
From: Peter Zijlstra <peterz@infradead.org>
commit 0758cd8304942292e95a0f750c374533db378b32 upstream.
Aneesh reported that:
tlb_flush_mmu()
tlb_flush_mmu_tlbonly()
tlb_flush() <-- #1
tlb_flush_mmu_free()
tlb_table_flush()
tlb_table_invalidate()
tlb_flush_mmu_tlbonly()
tlb_flush() <-- #2
does two TLBIs when tlb->fullmm, because __tlb_reset_range() will not
clear tlb->end in that case.
Observe that any caller to __tlb_adjust_range() also sets at least one of
the tlb->freed_tables || tlb->cleared_p* bits, and those are
unconditionally cleared by __tlb_reset_range().
Change the condition for actually issuing TLBI to having one of those bits
set, as opposed to having tlb->end != 0.
Link: http://lkml.kernel.org/r/20200116064531.483522-4-aneesh.kumar@linux.ibm.com
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Reported-by: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: <stable@vger.kernel.org> # 4.19
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
[santosh: backported to 4.19 stable]
---
include/asm-generic/tlb.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index 19934cdd143e..427a70c56ddd 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -179,7 +179,12 @@ static inline void __tlb_reset_range(struct mmu_gather *tlb)
static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb)
{
- if (!tlb->end)
+ /*
+ * Anything calling __tlb_adjust_range() also sets at least one of
+ * these bits.
+ */
+ if (!(tlb->freed_tables || tlb->cleared_ptes || tlb->cleared_pmds ||
+ tlb->cleared_puds || tlb->cleared_p4ds))
return;
tlb_flush(tlb);
--
2.24.1
^ permalink raw reply related
* [PATCH v3 5/6] mm/mmu_gather: invalidate TLB correctly on batch allocation failure and flush
From: Santosh Sivaraj @ 2020-03-12 13:27 UTC (permalink / raw)
To: stable, linuxppc-dev
Cc: Sasha Levin, Peter Zijlstra, Aneesh Kumar K . V, Greg KH
In-Reply-To: <20200312132740.225241-1-santosh@fossix.org>
From: Peter Zijlstra <peterz@infradead.org>
commit 0ed1325967ab5f7a4549a2641c6ebe115f76e228 upstream.
Architectures for which we have hardware walkers of Linux page table
should flush TLB on mmu gather batch allocation failures and batch flush.
Some architectures like POWER supports multiple translation modes (hash
and radix) and in the case of POWER only radix translation mode needs the
above TLBI. This is because for hash translation mode kernel wants to
avoid this extra flush since there are no hardware walkers of linux page
table. With radix translation, the hardware also walks linux page table
and with that, kernel needs to make sure to TLB invalidate page walk cache
before page table pages are freed.
More details in commit d86564a2f085 ("mm/tlb, x86/mm: Support invalidating
TLB caches for RCU_TABLE_FREE")
The changes to sparc are to make sure we keep the old behavior since we
are now removing HAVE_RCU_TABLE_NO_INVALIDATE. The default value for
tlb_needs_table_invalidate is to always force an invalidate and sparc can
avoid the table invalidate. Hence we define tlb_needs_table_invalidate to
false for sparc architecture.
Link: http://lkml.kernel.org/r/20200116064531.483522-3-aneesh.kumar@linux.ibm.com
Fixes: a46cc7a90fd8 ("powerpc/mm/radix: Improve TLB/PWC flushes")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: <stable@vger.kernel.org> # 4.19
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
[santosh: backported to 4.19 stable]
---
arch/Kconfig | 3 ---
arch/powerpc/Kconfig | 1 -
arch/powerpc/include/asm/tlb.h | 11 +++++++++++
arch/sparc/Kconfig | 1 -
arch/sparc/include/asm/tlb_64.h | 9 +++++++++
include/asm-generic/tlb.h | 15 +++++++++++++++
mm/memory.c | 16 ++++++++--------
7 files changed, 43 insertions(+), 13 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index 061a12b8140e..3abbdb0cea44 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -363,9 +363,6 @@ config HAVE_ARCH_JUMP_LABEL
config HAVE_RCU_TABLE_FREE
bool
-config HAVE_RCU_TABLE_NO_INVALIDATE
- bool
-
config ARCH_HAVE_NMI_SAFE_CMPXCHG
bool
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 1a00ce4b0040..e5bc0cfea2b1 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -216,7 +216,6 @@ config PPC
select HAVE_PERF_REGS
select HAVE_PERF_USER_STACK_DUMP
select HAVE_RCU_TABLE_FREE
- select HAVE_RCU_TABLE_NO_INVALIDATE if HAVE_RCU_TABLE_FREE
select HAVE_REGS_AND_STACK_ACCESS_API
select HAVE_RELIABLE_STACKTRACE if PPC64 && CPU_LITTLE_ENDIAN
select HAVE_SYSCALL_TRACEPOINTS
diff --git a/arch/powerpc/include/asm/tlb.h b/arch/powerpc/include/asm/tlb.h
index f0e571b2dc7c..63418275f402 100644
--- a/arch/powerpc/include/asm/tlb.h
+++ b/arch/powerpc/include/asm/tlb.h
@@ -30,6 +30,17 @@
#define tlb_remove_check_page_size_change tlb_remove_check_page_size_change
extern void tlb_flush(struct mmu_gather *tlb);
+/*
+ * book3s:
+ * Hash does not use the linux page-tables, so we can avoid
+ * the TLB invalidate for page-table freeing, Radix otoh does use the
+ * page-tables and needs the TLBI.
+ *
+ * nohash:
+ * We still do TLB invalidate in the __pte_free_tlb routine before we
+ * add the page table pages to mmu gather table batch.
+ */
+#define tlb_needs_table_invalidate() radix_enabled()
/* Get the generic bits... */
#include <asm-generic/tlb.h>
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index d90d632868aa..e6f2a38d2e61 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -64,7 +64,6 @@ config SPARC64
select HAVE_KRETPROBES
select HAVE_KPROBES
select HAVE_RCU_TABLE_FREE if SMP
- select HAVE_RCU_TABLE_NO_INVALIDATE if HAVE_RCU_TABLE_FREE
select HAVE_MEMBLOCK_NODE_MAP
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
select HAVE_DYNAMIC_FTRACE
diff --git a/arch/sparc/include/asm/tlb_64.h b/arch/sparc/include/asm/tlb_64.h
index a2f3fa61ee36..8cb8f3833239 100644
--- a/arch/sparc/include/asm/tlb_64.h
+++ b/arch/sparc/include/asm/tlb_64.h
@@ -28,6 +28,15 @@ void flush_tlb_pending(void);
#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
#define tlb_flush(tlb) flush_tlb_pending()
+/*
+ * SPARC64's hardware TLB fill does not use the Linux page-tables
+ * and therefore we don't need a TLBI when freeing page-table pages.
+ */
+
+#ifdef CONFIG_HAVE_RCU_TABLE_FREE
+#define tlb_needs_table_invalidate() (false)
+#endif
+
#include <asm-generic/tlb.h>
#endif /* _SPARC64_TLB_H */
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index f2b9dc9cbaf8..19934cdd143e 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -61,8 +61,23 @@ struct mmu_table_batch {
extern void tlb_table_flush(struct mmu_gather *tlb);
extern void tlb_remove_table(struct mmu_gather *tlb, void *table);
+/*
+ * This allows an architecture that does not use the linux page-tables for
+ * hardware to skip the TLBI when freeing page tables.
+ */
+#ifndef tlb_needs_table_invalidate
+#define tlb_needs_table_invalidate() (true)
#endif
+#else
+
+#ifdef tlb_needs_table_invalidate
+#error tlb_needs_table_invalidate() requires HAVE_RCU_TABLE_FREE
+#endif
+
+#endif /* CONFIG_HAVE_RCU_TABLE_FREE */
+
+
/*
* If we can't allocate a page to make a big batch of page pointers
* to work on, then just handle a few from the on-stack structure.
diff --git a/mm/memory.c b/mm/memory.c
index ba5689610c04..7daa7ae1b046 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -327,14 +327,14 @@ bool __tlb_remove_page_size(struct mmu_gather *tlb, struct page *page, int page_
*/
static inline void tlb_table_invalidate(struct mmu_gather *tlb)
{
-#ifndef CONFIG_HAVE_RCU_TABLE_NO_INVALIDATE
- /*
- * Invalidate page-table caches used by hardware walkers. Then we still
- * need to RCU-sched wait while freeing the pages because software
- * walkers can still be in-flight.
- */
- tlb_flush_mmu_tlbonly(tlb);
-#endif
+ if (tlb_needs_table_invalidate()) {
+ /*
+ * Invalidate page-table caches used by hardware walkers. Then
+ * we still need to RCU-sched wait while freeing the pages
+ * because software walkers can still be in-flight.
+ */
+ tlb_flush_mmu_tlbonly(tlb);
+ }
}
static void tlb_remove_table_smp_sync(void *arg)
--
2.24.1
^ permalink raw reply related
* [PATCH v3 4/6] powerpc/mmu_gather: enable RCU_TABLE_FREE even for !SMP case
From: Santosh Sivaraj @ 2020-03-12 13:27 UTC (permalink / raw)
To: stable, linuxppc-dev; +Cc: Sasha Levin, Aneesh Kumar K.V, Greg KH
In-Reply-To: <20200312132740.225241-1-santosh@fossix.org>
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
commit 12e4d53f3f04e81f9e83d6fc10edc7314ab9f6b9 upstream.
Patch series "Fixup page directory freeing", v4.
This is a repost of patch series from Peter with the arch specific changes
except ppc64 dropped. ppc64 changes are added here because we are redoing
the patch series on top of ppc64 changes. This makes it easy to backport
these changes. Only the first 2 patches need to be backported to stable.
The thing is, on anything SMP, freeing page directories should observe the
exact same order as normal page freeing:
1) unhook page/directory
2) TLB invalidate
3) free page/directory
Without this, any concurrent page-table walk could end up with a
Use-after-Free. This is esp. trivial for anything that has software
page-table walkers (HAVE_FAST_GUP / software TLB fill) or the hardware
caches partial page-walks (ie. caches page directories).
Even on UP this might give issues since mmu_gather is preemptible these
days. An interrupt or preempted task accessing user pages might stumble
into the free page if the hardware caches page directories.
This patch series fixes ppc64 and add generic MMU_GATHER changes to
support the conversion of other architectures. I haven't added patches
w.r.t other architecture because they are yet to be acked.
This patch (of 9):
A followup patch is going to make sure we correctly invalidate page walk
cache before we free page table pages. In order to keep things simple
enable RCU_TABLE_FREE even for !SMP so that we don't have to fixup the
!SMP case differently in the followup patch
!SMP case is right now broken for radix translation w.r.t page walk
cache flush. We can get interrupted in between page table free and
that would imply we have page walk cache entries pointing to tables
which got freed already. Michael said "both our platforms that run on
Power9 force SMP on in Kconfig, so the !SMP case is unlikely to be a
problem for anyone in practice, unless they've hacked their kernel to
build it !SMP."
Link: http://lkml.kernel.org/r/20200116064531.483522-2-aneesh.kumar@linux.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: <stable@vger.kernel.org> # 4.19
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
[santosh: backported for 4.19 stable]
---
arch/powerpc/Kconfig | 2 +-
arch/powerpc/include/asm/book3s/32/pgalloc.h | 8 --------
arch/powerpc/include/asm/book3s/64/pgalloc.h | 2 --
arch/powerpc/include/asm/nohash/32/pgalloc.h | 8 --------
arch/powerpc/include/asm/nohash/64/pgalloc.h | 9 +--------
arch/powerpc/mm/pgtable-book3s64.c | 7 -------
6 files changed, 2 insertions(+), 34 deletions(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index e09cfb109b8c..1a00ce4b0040 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -215,7 +215,7 @@ config PPC
select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !HAVE_HARDLOCKUP_DETECTOR_ARCH
select HAVE_PERF_REGS
select HAVE_PERF_USER_STACK_DUMP
- select HAVE_RCU_TABLE_FREE if SMP
+ select HAVE_RCU_TABLE_FREE
select HAVE_RCU_TABLE_NO_INVALIDATE if HAVE_RCU_TABLE_FREE
select HAVE_REGS_AND_STACK_ACCESS_API
select HAVE_RELIABLE_STACKTRACE if PPC64 && CPU_LITTLE_ENDIAN
diff --git a/arch/powerpc/include/asm/book3s/32/pgalloc.h b/arch/powerpc/include/asm/book3s/32/pgalloc.h
index 82e44b1a00ae..79ba3fbb512e 100644
--- a/arch/powerpc/include/asm/book3s/32/pgalloc.h
+++ b/arch/powerpc/include/asm/book3s/32/pgalloc.h
@@ -110,7 +110,6 @@ static inline void pgtable_free(void *table, unsigned index_size)
#define check_pgt_cache() do { } while (0)
#define get_hugepd_cache_index(x) (x)
-#ifdef CONFIG_SMP
static inline void pgtable_free_tlb(struct mmu_gather *tlb,
void *table, int shift)
{
@@ -127,13 +126,6 @@ static inline void __tlb_remove_table(void *_table)
pgtable_free(table, shift);
}
-#else
-static inline void pgtable_free_tlb(struct mmu_gather *tlb,
- void *table, int shift)
-{
- pgtable_free(table, shift);
-}
-#endif
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
unsigned long address)
diff --git a/arch/powerpc/include/asm/book3s/64/pgalloc.h b/arch/powerpc/include/asm/book3s/64/pgalloc.h
index f9019b579903..1013c0214213 100644
--- a/arch/powerpc/include/asm/book3s/64/pgalloc.h
+++ b/arch/powerpc/include/asm/book3s/64/pgalloc.h
@@ -47,9 +47,7 @@ extern pmd_t *pmd_fragment_alloc(struct mm_struct *, unsigned long);
extern void pte_fragment_free(unsigned long *, int);
extern void pmd_fragment_free(unsigned long *);
extern void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift);
-#ifdef CONFIG_SMP
extern void __tlb_remove_table(void *_table);
-#endif
static inline pgd_t *radix__pgd_alloc(struct mm_struct *mm)
{
diff --git a/arch/powerpc/include/asm/nohash/32/pgalloc.h b/arch/powerpc/include/asm/nohash/32/pgalloc.h
index 8825953c225b..96eed46d5684 100644
--- a/arch/powerpc/include/asm/nohash/32/pgalloc.h
+++ b/arch/powerpc/include/asm/nohash/32/pgalloc.h
@@ -111,7 +111,6 @@ static inline void pgtable_free(void *table, unsigned index_size)
#define check_pgt_cache() do { } while (0)
#define get_hugepd_cache_index(x) (x)
-#ifdef CONFIG_SMP
static inline void pgtable_free_tlb(struct mmu_gather *tlb,
void *table, int shift)
{
@@ -128,13 +127,6 @@ static inline void __tlb_remove_table(void *_table)
pgtable_free(table, shift);
}
-#else
-static inline void pgtable_free_tlb(struct mmu_gather *tlb,
- void *table, int shift)
-{
- pgtable_free(table, shift);
-}
-#endif
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
unsigned long address)
diff --git a/arch/powerpc/include/asm/nohash/64/pgalloc.h b/arch/powerpc/include/asm/nohash/64/pgalloc.h
index e2d62d033708..e3a0caba65f4 100644
--- a/arch/powerpc/include/asm/nohash/64/pgalloc.h
+++ b/arch/powerpc/include/asm/nohash/64/pgalloc.h
@@ -142,7 +142,7 @@ static inline void pgtable_free(void *table, int shift)
}
#define get_hugepd_cache_index(x) (x)
-#ifdef CONFIG_SMP
+
static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift)
{
unsigned long pgf = (unsigned long)table;
@@ -160,13 +160,6 @@ static inline void __tlb_remove_table(void *_table)
pgtable_free(table, shift);
}
-#else
-static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift)
-{
- pgtable_free(table, shift);
-}
-#endif
-
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
unsigned long address)
{
diff --git a/arch/powerpc/mm/pgtable-book3s64.c b/arch/powerpc/mm/pgtable-book3s64.c
index 297db665d953..5b4e9fd8990c 100644
--- a/arch/powerpc/mm/pgtable-book3s64.c
+++ b/arch/powerpc/mm/pgtable-book3s64.c
@@ -432,7 +432,6 @@ static inline void pgtable_free(void *table, int index)
}
}
-#ifdef CONFIG_SMP
void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int index)
{
unsigned long pgf = (unsigned long)table;
@@ -449,12 +448,6 @@ void __tlb_remove_table(void *_table)
return pgtable_free(table, index);
}
-#else
-void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int index)
-{
- return pgtable_free(table, index);
-}
-#endif
#ifdef CONFIG_PROC_FS
atomic_long_t direct_pages_count[MMU_PAGE_COUNT];
--
2.24.1
^ permalink raw reply related
* [PATCH v3 3/6] asm-generic/tlb, arch: Invert CONFIG_HAVE_RCU_TABLE_INVALIDATE
From: Santosh Sivaraj @ 2020-03-12 13:27 UTC (permalink / raw)
To: stable, linuxppc-dev; +Cc: Sasha Levin, Peter Zijlstra, Greg KH
In-Reply-To: <20200312132740.225241-1-santosh@fossix.org>
From: Peter Zijlstra <peterz@infradead.org>
commit 96bc9567cbe112e9320250f01b9c060c882e8619 upstream.
Make issuing a TLB invalidate for page-table pages the normal case.
The reason is twofold:
- too many invalidates is safer than too few,
- most architectures use the linux page-tables natively
and would thus require this.
Make it an opt-out, instead of an opt-in.
No change in behavior intended.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: <stable@vger.kernel.org> # 4.19
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
[santosh: prerequisite for upcoming tlbflush backports]
---
arch/Kconfig | 2 +-
arch/powerpc/Kconfig | 1 +
arch/sparc/Kconfig | 1 +
arch/x86/Kconfig | 1 -
mm/memory.c | 2 +-
5 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index a336548487e6..061a12b8140e 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -363,7 +363,7 @@ config HAVE_ARCH_JUMP_LABEL
config HAVE_RCU_TABLE_FREE
bool
-config HAVE_RCU_TABLE_INVALIDATE
+config HAVE_RCU_TABLE_NO_INVALIDATE
bool
config ARCH_HAVE_NMI_SAFE_CMPXCHG
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 6f475dc5829b..e09cfb109b8c 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -216,6 +216,7 @@ config PPC
select HAVE_PERF_REGS
select HAVE_PERF_USER_STACK_DUMP
select HAVE_RCU_TABLE_FREE if SMP
+ select HAVE_RCU_TABLE_NO_INVALIDATE if HAVE_RCU_TABLE_FREE
select HAVE_REGS_AND_STACK_ACCESS_API
select HAVE_RELIABLE_STACKTRACE if PPC64 && CPU_LITTLE_ENDIAN
select HAVE_SYSCALL_TRACEPOINTS
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index e6f2a38d2e61..d90d632868aa 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -64,6 +64,7 @@ config SPARC64
select HAVE_KRETPROBES
select HAVE_KPROBES
select HAVE_RCU_TABLE_FREE if SMP
+ select HAVE_RCU_TABLE_NO_INVALIDATE if HAVE_RCU_TABLE_FREE
select HAVE_MEMBLOCK_NODE_MAP
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
select HAVE_DYNAMIC_FTRACE
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index af35f5caadbe..181d0d522977 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -181,7 +181,6 @@ config X86
select HAVE_PERF_REGS
select HAVE_PERF_USER_STACK_DUMP
select HAVE_RCU_TABLE_FREE if PARAVIRT
- select HAVE_RCU_TABLE_INVALIDATE if HAVE_RCU_TABLE_FREE
select HAVE_REGS_AND_STACK_ACCESS_API
select HAVE_RELIABLE_STACKTRACE if X86_64 && (UNWINDER_FRAME_POINTER || UNWINDER_ORC) && STACK_VALIDATION
select HAVE_STACKPROTECTOR if CC_HAS_SANE_STACKPROTECTOR
diff --git a/mm/memory.c b/mm/memory.c
index 1832c5ed6ac0..ba5689610c04 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -327,7 +327,7 @@ bool __tlb_remove_page_size(struct mmu_gather *tlb, struct page *page, int page_
*/
static inline void tlb_table_invalidate(struct mmu_gather *tlb)
{
-#ifdef CONFIG_HAVE_RCU_TABLE_INVALIDATE
+#ifndef CONFIG_HAVE_RCU_TABLE_NO_INVALIDATE
/*
* Invalidate page-table caches used by hardware walkers. Then we still
* need to RCU-sched wait while freeing the pages because software
--
2.24.1
^ permalink raw reply related
* [PATCH v3 2/6] asm-generic/tlb: Track which levels of the page tables have been cleared
From: Santosh Sivaraj @ 2020-03-12 13:27 UTC (permalink / raw)
To: stable, linuxppc-dev; +Cc: Sasha Levin, Will Deacon, Greg KH
In-Reply-To: <20200312132740.225241-1-santosh@fossix.org>
From: Will Deacon <will.deacon@arm.com>
commit a6d60245d6d9b1caf66b0d94419988c4836980af upstream
It is common for architectures with hugepage support to require only a
single TLB invalidation operation per hugepage during unmap(), rather than
iterating through the mapping at a PAGE_SIZE increment. Currently,
however, the level in the page table where the unmap() operation occurs
is not stored in the mmu_gather structure, therefore forcing
architectures to issue additional TLB invalidation operations or to give
up and over-invalidate by e.g. invalidating the entire TLB.
Ideally, we could add an interval rbtree to the mmu_gather structure,
which would allow us to associate the correct mapping granule with the
various sub-mappings within the range being invalidated. However, this
is costly in terms of book-keeping and memory management, so instead we
approximate by keeping track of the page table levels that are cleared
and provide a means to query the smallest granule required for invalidation.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Cc: <stable@vger.kernel.org> # 4.19
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
[santosh: prerequisite for upcoming tlbflush backports]
---
include/asm-generic/tlb.h | 58 +++++++++++++++++++++++++++++++++------
mm/memory.c | 4 ++-
2 files changed, 53 insertions(+), 9 deletions(-)
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index 97306b32d8d2..f2b9dc9cbaf8 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -114,6 +114,14 @@ struct mmu_gather {
*/
unsigned int freed_tables : 1;
+ /*
+ * at which levels have we cleared entries?
+ */
+ unsigned int cleared_ptes : 1;
+ unsigned int cleared_pmds : 1;
+ unsigned int cleared_puds : 1;
+ unsigned int cleared_p4ds : 1;
+
struct mmu_gather_batch *active;
struct mmu_gather_batch local;
struct page *__pages[MMU_GATHER_BUNDLE];
@@ -148,6 +156,10 @@ static inline void __tlb_reset_range(struct mmu_gather *tlb)
tlb->end = 0;
}
tlb->freed_tables = 0;
+ tlb->cleared_ptes = 0;
+ tlb->cleared_pmds = 0;
+ tlb->cleared_puds = 0;
+ tlb->cleared_p4ds = 0;
}
static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb)
@@ -197,6 +209,25 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
}
#endif
+static inline unsigned long tlb_get_unmap_shift(struct mmu_gather *tlb)
+{
+ if (tlb->cleared_ptes)
+ return PAGE_SHIFT;
+ if (tlb->cleared_pmds)
+ return PMD_SHIFT;
+ if (tlb->cleared_puds)
+ return PUD_SHIFT;
+ if (tlb->cleared_p4ds)
+ return P4D_SHIFT;
+
+ return PAGE_SHIFT;
+}
+
+static inline unsigned long tlb_get_unmap_size(struct mmu_gather *tlb)
+{
+ return 1UL << tlb_get_unmap_shift(tlb);
+}
+
/*
* In the case of tlb vma handling, we can optimise these away in the
* case where we're doing a full MM flush. When we're doing a munmap,
@@ -230,13 +261,19 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
#define tlb_remove_tlb_entry(tlb, ptep, address) \
do { \
__tlb_adjust_range(tlb, address, PAGE_SIZE); \
+ tlb->cleared_ptes = 1; \
__tlb_remove_tlb_entry(tlb, ptep, address); \
} while (0)
-#define tlb_remove_huge_tlb_entry(h, tlb, ptep, address) \
- do { \
- __tlb_adjust_range(tlb, address, huge_page_size(h)); \
- __tlb_remove_tlb_entry(tlb, ptep, address); \
+#define tlb_remove_huge_tlb_entry(h, tlb, ptep, address) \
+ do { \
+ unsigned long _sz = huge_page_size(h); \
+ __tlb_adjust_range(tlb, address, _sz); \
+ if (_sz == PMD_SIZE) \
+ tlb->cleared_pmds = 1; \
+ else if (_sz == PUD_SIZE) \
+ tlb->cleared_puds = 1; \
+ __tlb_remove_tlb_entry(tlb, ptep, address); \
} while (0)
/**
@@ -250,6 +287,7 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
#define tlb_remove_pmd_tlb_entry(tlb, pmdp, address) \
do { \
__tlb_adjust_range(tlb, address, HPAGE_PMD_SIZE); \
+ tlb->cleared_pmds = 1; \
__tlb_remove_pmd_tlb_entry(tlb, pmdp, address); \
} while (0)
@@ -264,6 +302,7 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
#define tlb_remove_pud_tlb_entry(tlb, pudp, address) \
do { \
__tlb_adjust_range(tlb, address, HPAGE_PUD_SIZE); \
+ tlb->cleared_puds = 1; \
__tlb_remove_pud_tlb_entry(tlb, pudp, address); \
} while (0)
@@ -289,7 +328,8 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
#define pte_free_tlb(tlb, ptep, address) \
do { \
__tlb_adjust_range(tlb, address, PAGE_SIZE); \
- tlb->freed_tables = 1; \
+ tlb->freed_tables = 1; \
+ tlb->cleared_pmds = 1; \
__pte_free_tlb(tlb, ptep, address); \
} while (0)
#endif
@@ -298,7 +338,8 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
#define pmd_free_tlb(tlb, pmdp, address) \
do { \
__tlb_adjust_range(tlb, address, PAGE_SIZE); \
- tlb->freed_tables = 1; \
+ tlb->freed_tables = 1; \
+ tlb->cleared_puds = 1; \
__pmd_free_tlb(tlb, pmdp, address); \
} while (0)
#endif
@@ -308,7 +349,8 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
#define pud_free_tlb(tlb, pudp, address) \
do { \
__tlb_adjust_range(tlb, address, PAGE_SIZE); \
- tlb->freed_tables = 1; \
+ tlb->freed_tables = 1; \
+ tlb->cleared_p4ds = 1; \
__pud_free_tlb(tlb, pudp, address); \
} while (0)
#endif
@@ -319,7 +361,7 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
#define p4d_free_tlb(tlb, pudp, address) \
do { \
__tlb_adjust_range(tlb, address, PAGE_SIZE); \
- tlb->freed_tables = 1; \
+ tlb->freed_tables = 1; \
__p4d_free_tlb(tlb, pudp, address); \
} while (0)
#endif
diff --git a/mm/memory.c b/mm/memory.c
index bbf0cc4066c8..1832c5ed6ac0 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -267,8 +267,10 @@ void arch_tlb_finish_mmu(struct mmu_gather *tlb,
{
struct mmu_gather_batch *batch, *next;
- if (force)
+ if (force) {
+ __tlb_reset_range(tlb);
__tlb_adjust_range(tlb, start, end - start);
+ }
tlb_flush_mmu(tlb);
--
2.24.1
^ permalink raw reply related
* [PATCH v3 1/6] asm-generic/tlb: Track freeing of page-table directories in struct mmu_gather
From: Santosh Sivaraj @ 2020-03-12 13:27 UTC (permalink / raw)
To: stable, linuxppc-dev; +Cc: Sasha Levin, Peter Zijlstra, Will Deacon, Greg KH
In-Reply-To: <20200312132740.225241-1-santosh@fossix.org>
From: Peter Zijlstra <peterz@infradead.org>
commit 22a61c3c4f1379ef8b0ce0d5cb78baf3178950e2 upstream
Some architectures require different TLB invalidation instructions
depending on whether it is only the last-level of page table being
changed, or whether there are also changes to the intermediate
(directory) entries higher up the tree.
Add a new bit to the flags bitfield in struct mmu_gather so that the
architecture code can operate accordingly if it's the intermediate
levels being invalidated.
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Cc: <stable@vger.kernel.org> # 4.19
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
[santosh: prerequisite for tlbflush backports]
---
include/asm-generic/tlb.h | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index b3353e21f3b3..97306b32d8d2 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -97,12 +97,22 @@ struct mmu_gather {
#endif
unsigned long start;
unsigned long end;
- /* we are in the middle of an operation to clear
- * a full mm and can make some optimizations */
- unsigned int fullmm : 1,
- /* we have performed an operation which
- * requires a complete flush of the tlb */
- need_flush_all : 1;
+ /*
+ * we are in the middle of an operation to clear
+ * a full mm and can make some optimizations
+ */
+ unsigned int fullmm : 1;
+
+ /*
+ * we have performed an operation which
+ * requires a complete flush of the tlb
+ */
+ unsigned int need_flush_all : 1;
+
+ /*
+ * we have removed page directories
+ */
+ unsigned int freed_tables : 1;
struct mmu_gather_batch *active;
struct mmu_gather_batch local;
@@ -137,6 +147,7 @@ static inline void __tlb_reset_range(struct mmu_gather *tlb)
tlb->start = TASK_SIZE;
tlb->end = 0;
}
+ tlb->freed_tables = 0;
}
static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb)
@@ -278,6 +289,7 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
#define pte_free_tlb(tlb, ptep, address) \
do { \
__tlb_adjust_range(tlb, address, PAGE_SIZE); \
+ tlb->freed_tables = 1; \
__pte_free_tlb(tlb, ptep, address); \
} while (0)
#endif
@@ -285,7 +297,8 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
#ifndef pmd_free_tlb
#define pmd_free_tlb(tlb, pmdp, address) \
do { \
- __tlb_adjust_range(tlb, address, PAGE_SIZE); \
+ __tlb_adjust_range(tlb, address, PAGE_SIZE); \
+ tlb->freed_tables = 1; \
__pmd_free_tlb(tlb, pmdp, address); \
} while (0)
#endif
@@ -295,6 +308,7 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
#define pud_free_tlb(tlb, pudp, address) \
do { \
__tlb_adjust_range(tlb, address, PAGE_SIZE); \
+ tlb->freed_tables = 1; \
__pud_free_tlb(tlb, pudp, address); \
} while (0)
#endif
@@ -304,7 +318,8 @@ static inline void tlb_remove_check_page_size_change(struct mmu_gather *tlb,
#ifndef p4d_free_tlb
#define p4d_free_tlb(tlb, pudp, address) \
do { \
- __tlb_adjust_range(tlb, address, PAGE_SIZE); \
+ __tlb_adjust_range(tlb, address, PAGE_SIZE); \
+ tlb->freed_tables = 1; \
__p4d_free_tlb(tlb, pudp, address); \
} while (0)
#endif
--
2.24.1
^ permalink raw reply related
* [PATCH v3 0/6] Memory corruption may occur due to incorrent tlb flush
From: Santosh Sivaraj @ 2020-03-12 13:27 UTC (permalink / raw)
To: stable, linuxppc-dev; +Cc: Sasha Levin, Greg KH
The TLB flush optimisation (a46cc7a90f: powerpc/mm/radix: Improve TLB/PWC
flushes) may result in random memory corruption. Any concurrent page-table walk
could end up with a Use-after-Free. Even on UP this might give issues, since
mmu_gather is preemptible these days. An interrupt or preempted task accessing
user pages might stumble into the free page if the hardware caches page
directories.
The series is a backport of the fix sent by Peter [1].
The first three patches are dependencies for the last patch (avoid potential
double flush). If the performance impact due to double flush is considered
trivial then the first three patches and last patch may be dropped.
This is only for v4.19 stable.
[1] https://patchwork.kernel.org/cover/11284843/
--
Changelog:
v2: Send the patches with the correct format (commit sha1 upstream) for stable
v3: Fix compilation issue on ppc40x_defconfig and ppc44x_defconfig
--
Aneesh Kumar K.V (1):
powerpc/mmu_gather: enable RCU_TABLE_FREE even for !SMP case
Peter Zijlstra (4):
asm-generic/tlb: Track freeing of page-table directories in struct
mmu_gather
asm-generic/tlb, arch: Invert CONFIG_HAVE_RCU_TABLE_INVALIDATE
mm/mmu_gather: invalidate TLB correctly on batch allocation failure
and flush
asm-generic/tlb: avoid potential double flush
Will Deacon (1):
asm-generic/tlb: Track which levels of the page tables have been
cleared
arch/Kconfig | 3 -
arch/powerpc/Kconfig | 2 +-
arch/powerpc/include/asm/book3s/32/pgalloc.h | 8 --
arch/powerpc/include/asm/book3s/64/pgalloc.h | 2 -
arch/powerpc/include/asm/nohash/32/pgalloc.h | 8 --
arch/powerpc/include/asm/nohash/64/pgalloc.h | 9 +-
arch/powerpc/include/asm/tlb.h | 11 ++
arch/powerpc/mm/pgtable-book3s64.c | 7 --
arch/sparc/include/asm/tlb_64.h | 9 ++
arch/x86/Kconfig | 1 -
include/asm-generic/tlb.h | 103 ++++++++++++++++---
mm/memory.c | 20 ++--
12 files changed, 123 insertions(+), 60 deletions(-)
--
2.24.1
^ permalink raw reply
* Re: [PATCH 1/3] powerpc/numa: Set numa_node for all possible cpus
From: Srikar Dronamraju @ 2020-03-12 13:14 UTC (permalink / raw)
To: Vlastimil Babka
Cc: Sachin Sant, linuxppc-dev, LKML, Michal Hocko, linux-mm,
Mel Gorman, Kirill A. Shutemov, Andrew Morton, Linus Torvalds,
Christopher Lameter
In-Reply-To: <5e5c736a-a88c-7c76-fc3d-7bc765e8dcba@suse.cz>
* Vlastimil Babka <vbabka@suse.cz> [2020-03-12 10:30:50]:
> On 3/12/20 9:23 AM, Sachin Sant wrote:
> >> On 12-Mar-2020, at 10:57 AM, Srikar Dronamraju <srikar@linux.vnet.ibm.com> wrote:
> >> * Michal Hocko <mhocko@kernel.org> [2020-03-11 12:57:35]:
> >>> On Wed 11-03-20 16:32:35, Srikar Dronamraju wrote:
> >>>> To ensure a cpuless, memoryless dummy node is not online, powerpc need
> >>>> to make sure all possible but not present cpu_to_node are set to a
> >>>> proper node.
> >>>
> >>> Just curious, is this somehow related to
> >>> http://lkml.kernel.org/r/20200227182650.GG3771@dhcp22.suse.cz?
> >>>
> >>
> >> The issue I am trying to fix is a known issue in Powerpc since many years.
> >> So this surely not a problem after a75056fc1e7c (mm/memcontrol.c: allocate
> >> shrinker_map on appropriate NUMA node").
> >>
> >> I tried v5.6-rc4 + a75056fc1e7c but didnt face any issues booting the
> >> kernel. Will work with Sachin/Abdul (reporters of the issue).
I had used v1 and not v2. So my mistake.
> > I applied this 3 patch series on top of March 11 next tree (commit d44a64766795 )
> > The kernel still fails to boot with same call trace.
>
While I am not an expert in the slub area, I looked at the patch
a75056fc1e7c and had some thoughts on why this could be causing this issue.
On the system where the crash happens, the possible number of nodes is much
greater than the number of onlined nodes. The pdgat or the NODE_DATA is only
available for onlined nodes.
With a75056fc1e7c memcg_alloc_shrinker_maps, we end up calling kzalloc_node
for all possible nodes and in ___slab_alloc we end up looking at the
node_present_pages which is NODE_DATA(nid)->node_present_pages.
i.e for a node whose pdgat struct is not allocated, we are trying to
dereference.
Also for a memoryless/cpuless node or possible but not present nodes,
node_to_mem_node(node) will still end up as node (atleast on powerpc).
I tried with this hunk below and it works.
But I am not sure if we need to check at other places were
node_present_pages is being called.
diff --git a/mm/slub.c b/mm/slub.c
index 626cbcbd977f..bddb93bed55e 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2571,9 +2571,13 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
if (unlikely(!node_match(page, node))) {
int searchnode = node;
- if (node != NUMA_NO_NODE && !node_present_pages(node))
- searchnode = node_to_mem_node(node);
-
+ if (node != NUMA_NO_NODE) {
+ if (!node_online(node) || !node_present_pages(node)) {
+ searchnode = node_to_mem_node(node);
+ if (!node_online(searchnode))
+ searchnode = first_online_node;
+ }
+ }
if (unlikely(!node_match(page, searchnode))) {
stat(s, ALLOC_NODE_MISMATCH);
deactivate_slab(s, page, c->freelist, c);
> >
>
--
Thanks and Regards
Srikar Dronamraju
^ permalink raw reply related
* Re: [5.6.0-rc2-next-20200218/powerpc] Boot failure on POWER9
From: Michael Ellerman @ 2020-03-12 12:18 UTC (permalink / raw)
To: Michal Hocko, Benjamin Herrenschmidt, Paul Mackerras
Cc: Sachin Sant, Pekka Enberg, Linux-Next Mailing List,
Vlastimil Babka, David Rientjes, Christopher Lameter,
linuxppc-dev, Joonsoo Kim, Kirill Tkhai
In-Reply-To: <20200310150114.GO8447@dhcp22.suse.cz>
Michal Hocko <mhocko@kernel.org> writes:
> On Thu 27-02-20 19:26:54, Michal Hocko wrote:
>> [Cc ppc maintainers]
> [...]
>> Please have a look at http://lkml.kernel.org/r/52EF4673-7292-4C4C-B459-AF583951BA48@linux.vnet.ibm.com
>> for the boot log with the debugging patch which tracks set_numa_mem.
>> This seems to lead to a crash in the slab allocator bebcause
>> node_to_mem_node(0) for memory less node resolves to the memory less
>> node http://lkml.kernel.org/r/dd450314-d428-6776-af07-f92c04c7b967@suse.cz.
>> The original report is http://lkml.kernel.org/r/3381CD91-AB3D-4773-BA04-E7A072A63968@linux.vnet.ibm.com
>
> ping
The obvious fix is:
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 37c12e3bab9e..33b1fca0b258 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -892,6 +892,7 @@ void smp_prepare_boot_cpu(void)
paca_ptrs[boot_cpuid]->__current = current;
#endif
set_numa_node(numa_cpu_lookup_table[boot_cpuid]);
+ set_numa_mem(local_memory_node(numa_cpu_lookup_table[boot_cpuid]));
current_set[boot_cpuid] = current;
}
But that doesn't work because smp_prepare_boot_cpu() is called too
early:
asmlinkage __visible void __init start_kernel(void)
{
...
smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
boot_cpu_hotplug_init();
build_all_zonelists(NULL);
And local_memory_node() uses first_zones_zonelist() which doesn't work
prior to build_all_zonelists() being called.
The patch below might work. Sachin can you test this? I tried faking up
a system with a memoryless node zero but couldn't get it to even start
booting.
cheers
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 9b4f5fb719e0..d1f11437f6c4 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -282,6 +282,9 @@ void __init mem_init(void)
*/
BUILD_BUG_ON(MMU_PAGE_COUNT > 16);
+ BUG_ON(smp_processor_id() != boot_cpuid);
+ set_numa_mem(local_memory_node(numa_cpu_lookup_table[boot_cpuid]));
+
#ifdef CONFIG_SWIOTLB
/*
* Some platforms (e.g. 85xx) limit DMA-able memory way below
^ permalink raw reply related
* Re: [PATCH v3] ima: add a new CONFIG for loading arch-specific policies
From: Michael Ellerman @ 2020-03-12 11:15 UTC (permalink / raw)
To: Nayna Jain, linux-integrity, linuxppc-dev, linux-efi, linux-s390,
x86
Cc: Nayna Jain, Nayna Jain, linux-kernel, zohar, Philipp Rudo,
Thomas Gleixner, Ard Biesheuvel
In-Reply-To: <1583715471-15525-1-git-send-email-nayna@linux.ibm.com>
Nayna Jain <nayna@linux.ibm.com> writes:
> From: Nayna Jain <nayna@linux.vnet.ibm.com>
>
> Every time a new architecture defines the IMA architecture specific
> functions - arch_ima_get_secureboot() and arch_ima_get_policy(), the IMA
> include file needs to be updated. To avoid this "noise", this patch
> defines a new IMA Kconfig IMA_SECURE_AND_OR_TRUSTED_BOOT option, allowing
> the different architectures to select it.
>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
> Acked-by: Ard Biesheuvel <ardb@kernel.org>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Philipp Rudo <prudo@linux.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> ---
> v3:
> * Removes CONFIG_IMA dependency. Thanks Ard.
> * Updated the patch with improvements suggested by Michael. It now uses
> "imply" instead of "select". Thanks Michael.
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
cheers
^ permalink raw reply
* Re: [RESEND PATCH v2 1/9] iomap: Constify ioreadX() iomem argument (as in generic implementation)
From: Michael Ellerman @ 2020-03-12 10:55 UTC (permalink / raw)
To: Krzysztof Kozlowski, Richard Henderson, Ivan Kokshaysky,
Matt Turner, Alexey Brodkin, Vineet Gupta, James E.J. Bottomley,
Helge Deller, Benjamin Herrenschmidt, Paul Mackerras,
Yoshinori Sato, Rich Felker, Dave Airlie, David Airlie,
Daniel Vetter, Ben Skeggs, Mauro Carvalho Chehab, Jiri Slaby,
Nick Kossifidis, Luis Chamberlain, Kalle Valo, David S. Miller,
Dave Jiang, Jon Mason, Allen Hubbe, Michael S. Tsirkin,
Jason Wang, Arnd Bergmann, Geert Uytterhoeven, Andrew Morton,
Thomas Gleixner, linux-alpha, linux-kernel, linux-snps-arc,
linux-parisc, linuxppc-dev, linux-sh, dri-devel, nouveau,
linux-media, linux-wireless, netdev, linux-ntb, virtualization,
linux-arch
Cc: Krzysztof Kozlowski
In-Reply-To: <20200219175007.13627-2-krzk@kernel.org>
Krzysztof Kozlowski <krzk@kernel.org> writes:
> diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c
> index 5ac84efc6ede..9fe4fb3b08aa 100644
> --- a/arch/powerpc/kernel/iomap.c
> +++ b/arch/powerpc/kernel/iomap.c
> @@ -15,23 +15,23 @@
> * Here comes the ppc64 implementation of the IOMAP
> * interfaces.
> */
> -unsigned int ioread8(void __iomem *addr)
> +unsigned int ioread8(const void __iomem *addr)
> {
> return readb(addr);
> }
> -unsigned int ioread16(void __iomem *addr)
> +unsigned int ioread16(const void __iomem *addr)
> {
> return readw(addr);
> }
> -unsigned int ioread16be(void __iomem *addr)
> +unsigned int ioread16be(const void __iomem *addr)
> {
> return readw_be(addr);
> }
> -unsigned int ioread32(void __iomem *addr)
> +unsigned int ioread32(const void __iomem *addr)
> {
> return readl(addr);
> }
> -unsigned int ioread32be(void __iomem *addr)
> +unsigned int ioread32be(const void __iomem *addr)
> {
> return readl_be(addr);
> }
> @@ -41,27 +41,27 @@ EXPORT_SYMBOL(ioread16be);
> EXPORT_SYMBOL(ioread32);
> EXPORT_SYMBOL(ioread32be);
> #ifdef __powerpc64__
> -u64 ioread64(void __iomem *addr)
> +u64 ioread64(const void __iomem *addr)
> {
> return readq(addr);
> }
> -u64 ioread64_lo_hi(void __iomem *addr)
> +u64 ioread64_lo_hi(const void __iomem *addr)
> {
> return readq(addr);
> }
> -u64 ioread64_hi_lo(void __iomem *addr)
> +u64 ioread64_hi_lo(const void __iomem *addr)
> {
> return readq(addr);
> }
> -u64 ioread64be(void __iomem *addr)
> +u64 ioread64be(const void __iomem *addr)
> {
> return readq_be(addr);
> }
> -u64 ioread64be_lo_hi(void __iomem *addr)
> +u64 ioread64be_lo_hi(const void __iomem *addr)
> {
> return readq_be(addr);
> }
> -u64 ioread64be_hi_lo(void __iomem *addr)
> +u64 ioread64be_hi_lo(const void __iomem *addr)
> {
> return readq_be(addr);
> }
> @@ -139,15 +139,15 @@ EXPORT_SYMBOL(iowrite64be_hi_lo);
> * FIXME! We could make these do EEH handling if we really
> * wanted. Not clear if we do.
> */
> -void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
> +void ioread8_rep(const void __iomem *addr, void *dst, unsigned long count)
> {
> readsb(addr, dst, count);
> }
> -void ioread16_rep(void __iomem *addr, void *dst, unsigned long count)
> +void ioread16_rep(const void __iomem *addr, void *dst, unsigned long count)
> {
> readsw(addr, dst, count);
> }
> -void ioread32_rep(void __iomem *addr, void *dst, unsigned long count)
> +void ioread32_rep(const void __iomem *addr, void *dst, unsigned long count)
> {
> readsl(addr, dst, count);
> }
This looks OK to me.
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
cheers
^ permalink raw reply
* Re: [PATCH v4 6/8] perf/tools: Enhance JSON/metric infrastructure to handle "?"
From: Jiri Olsa @ 2020-03-12 10:52 UTC (permalink / raw)
To: Kajol Jain
Cc: mark.rutland, maddy, peterz, yao.jin, mingo, kan.liang, ak,
alexander.shishkin, anju, mamatha4, sukadev, ravi.bangoria, acme,
jmario, namhyung, tglx, mpetlan, gregkh, linux-kernel,
linux-perf-users, jolsa, linuxppc-dev
In-Reply-To: <20200309062552.29911-7-kjain@linux.ibm.com>
On Mon, Mar 09, 2020 at 11:55:50AM +0530, Kajol Jain wrote:
SNIP
> diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h
> index 9377538f4097..d17664e628db 100644
> --- a/tools/perf/util/expr.h
> +++ b/tools/perf/util/expr.h
> @@ -15,6 +15,7 @@ struct parse_ctx {
> struct parse_id ids[MAX_PARSE_ID];
> };
>
> +int expr__runtimeparam;
> void expr__ctx_init(struct parse_ctx *ctx);
> void expr__add_id(struct parse_ctx *ctx, const char *id, double val);
> int expr__parse(double *final_val, struct parse_ctx *ctx, const char *expr);
> diff --git a/tools/perf/util/expr.l b/tools/perf/util/expr.l
> index 1928f2a3dddc..ec4b00671f67 100644
> --- a/tools/perf/util/expr.l
> +++ b/tools/perf/util/expr.l
> @@ -45,6 +45,21 @@ static char *normalize(char *str)
> *dst++ = '/';
> else if (*str == '\\')
> *dst++ = *++str;
> + else if (*str == '?') {
> +
> + int size = snprintf(NULL, 0, "%d", expr__runtimeparam);
> + char * paramval = (char *)malloc(size);
can't we agree that any reasonable number in here
wouldn't cross 20 bytes in string or so and use
buffer for that instead of that malloc exercise?
thanks,
jirka
> + int i = 0;
> +
> + if(!paramval)
> + *dst++ = '0';
> + else {
> + sprintf(paramval, "%d", expr__runtimeparam);
> + while(i < size)
> + *dst++ = paramval[i++];
> + free(paramval);
> + }
> + }
SNIP
^ permalink raw reply
* Re: [PATCH v4 6/8] perf/tools: Enhance JSON/metric infrastructure to handle "?"
From: Jiri Olsa @ 2020-03-12 10:52 UTC (permalink / raw)
To: Kajol Jain
Cc: mark.rutland, maddy, peterz, yao.jin, mingo, kan.liang, ak,
alexander.shishkin, anju, mamatha4, sukadev, ravi.bangoria, acme,
jmario, namhyung, tglx, mpetlan, gregkh, linux-kernel,
linux-perf-users, jolsa, linuxppc-dev
In-Reply-To: <20200309062552.29911-7-kjain@linux.ibm.com>
On Mon, Mar 09, 2020 at 11:55:50AM +0530, Kajol Jain wrote:
SNIP
> +static int metricgroup__add_metric_runtime_param(struct strbuf *events,
> + struct list_head *group_list, struct pmu_event *pe)
> +{
> + int i, count;
> + int ret = -EINVAL;
> +
> + count = arch_get_runtimeparam();
> +
> + /* This loop is added to create multiple
> + * events depend on count value and add
> + * those events to group_list.
> + */
> +
> + for (i = 0; i < count; i++) {
> + const char **ids;
> + int idnum;
> + struct egroup *eg;
> + char value[PATH_MAX];
> +
> + expr__runtimeparam = i;
> +
> + if (expr__find_other(pe->metric_expr,
> + NULL, &ids, &idnum) < 0)
> + return ret;
> +
> + if (events->len > 0)
> + strbuf_addf(events, ",");
> +
> + if (metricgroup__has_constraint(pe))
> + metricgroup__add_metric_non_group(events, ids, idnum);
> + else
> + metricgroup__add_metric_weak_group(events, ids, idnum);
> +
> + eg = malloc(sizeof(struct egroup));
> + if (!eg) {
> + ret = -ENOMEM;
> + return ret;
> + }
> + sprintf(value, "%s%c%d", pe->metric_name, '_', i);
> + eg->ids = ids;
> + eg->idnum = idnum;
> + eg->metric_name = strdup(value);
> + eg->metric_expr = pe->metric_expr;
> + eg->metric_unit = pe->unit;
> + list_add_tail(&eg->nd, group_list);
> + ret = 0;
> +
> + if (ret != 0)
> + break;
the inside loop is essentialy what you factor out to
metricgroup__add_metric_param right? please nove
addition of metricgroup__add_metric_param function
into separate patch
jirka
> + }
> + return ret;
> +}
> +static int metricgroup__add_metric_param(struct strbuf *events,
> + struct list_head *group_list, struct pmu_event *pe)
> +{
> +
> + const char **ids;
> + int idnum;
> + struct egroup *eg;
> + int ret = -EINVAL;
> +
> + if (expr__find_other(pe->metric_expr,
> + NULL, &ids, &idnum) < 0)
> + return ret;
> + if (events->len > 0)
> + strbuf_addf(events, ",");
> +
> + if (metricgroup__has_constraint(pe))
> + metricgroup__add_metric_non_group(events, ids, idnum);
> + else
> + metricgroup__add_metric_weak_group(events, ids, idnum);
> +
> + eg = malloc(sizeof(struct egroup));
> + if (!eg)
> + ret = -ENOMEM;
> +
> + eg->ids = ids;
> + eg->idnum = idnum;
> + eg->metric_name = pe->metric_name;
> + eg->metric_expr = pe->metric_expr;
> + eg->metric_unit = pe->unit;
> + list_add_tail(&eg->nd, group_list);
> + ret = 0;
> +
> + return ret;
> +}
SNIP
^ permalink raw reply
* Re: [PATCH v4 6/8] perf/tools: Enhance JSON/metric infrastructure to handle "?"
From: Jiri Olsa @ 2020-03-12 10:51 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: mark.rutland, maddy, peterz, yao.jin, mingo, kan.liang, ak,
alexander.shishkin, anju, mamatha4, sukadev, ravi.bangoria,
Kajol Jain, jmario, namhyung, tglx, mpetlan, gregkh, linux-kernel,
linux-perf-users, jolsa, linuxppc-dev
In-Reply-To: <20200310183455.GB12036@kernel.org>
On Tue, Mar 10, 2020 at 03:34:55PM -0300, Arnaldo Carvalho de Melo wrote:
SNIP
> > diff --git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c
> > index 3b4cdfc5efd6..036f6b2ce202 100644
> > --- a/tools/perf/arch/powerpc/util/header.c
> > +++ b/tools/perf/arch/powerpc/util/header.c
> > @@ -7,6 +7,11 @@
> > #include <string.h>
> > #include <linux/stringify.h>
> > #include "header.h"
> > +#include "metricgroup.h"
> > +#include "evlist.h"
> > +#include <dirent.h>
> > +#include "pmu.h"
> > +#include <api/fs/fs.h>
> >
> > #define mfspr(rn) ({unsigned long rval; \
> > asm volatile("mfspr %0," __stringify(rn) \
> > @@ -16,6 +21,8 @@
> > #define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */
> > #define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */
> >
> > +#define SOCKETS_INFO_FILE_PATH "/devices/hv_24x7/interface/"
> > +
> > int
> > get_cpuid(char *buffer, size_t sz)
> > {
> > @@ -44,3 +51,18 @@ get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
> >
> > return bufp;
> > }
> > +
> > +int arch_get_runtimeparam(void)
> > +{
> > + int count;
> > + char path[PATH_MAX];
> > + char filename[] = "sockets";
> > +
> > + snprintf(path, PATH_MAX,
> > + SOCKETS_INFO_FILE_PATH "%s", filename);
also, what's the point of using snprintf in here?
jirka
^ permalink raw reply
* Re: [PATCH v4 6/8] perf/tools: Enhance JSON/metric infrastructure to handle "?"
From: Jiri Olsa @ 2020-03-12 10:51 UTC (permalink / raw)
To: Kajol Jain
Cc: mark.rutland, maddy, peterz, yao.jin, mingo, kan.liang, ak,
alexander.shishkin, anju, mamatha4, sukadev, ravi.bangoria, acme,
jmario, namhyung, tglx, mpetlan, gregkh, linux-kernel,
linux-perf-users, jolsa, linuxppc-dev
In-Reply-To: <20200309062552.29911-7-kjain@linux.ibm.com>
On Mon, Mar 09, 2020 at 11:55:50AM +0530, Kajol Jain wrote:
SNIP
> diff --git a/tools/perf/util/expr.l b/tools/perf/util/expr.l
> index 1928f2a3dddc..ec4b00671f67 100644
> --- a/tools/perf/util/expr.l
> +++ b/tools/perf/util/expr.l
> @@ -45,6 +45,21 @@ static char *normalize(char *str)
> *dst++ = '/';
> else if (*str == '\\')
> *dst++ = *++str;
> + else if (*str == '?') {
> +
extra line ^^^
jirka
> + int size = snprintf(NULL, 0, "%d", expr__runtimeparam);
> + char * paramval = (char *)malloc(size);
> + int i = 0;
> +
> + if(!paramval)
SNIP
^ permalink raw reply
* Re: [PATCH v4 6/8] perf/tools: Enhance JSON/metric infrastructure to handle "?"
From: Jiri Olsa @ 2020-03-12 10:50 UTC (permalink / raw)
To: Kajol Jain
Cc: mark.rutland, maddy, peterz, yao.jin, mingo, kan.liang, ak,
alexander.shishkin, anju, mamatha4, sukadev, ravi.bangoria, acme,
jmario, namhyung, tglx, mpetlan, gregkh, linux-kernel,
linux-perf-users, jolsa, linuxppc-dev
In-Reply-To: <20200309062552.29911-7-kjain@linux.ibm.com>
On Mon, Mar 09, 2020 at 11:55:50AM +0530, Kajol Jain wrote:
SNIP
> diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
> index c3a8c701609a..11eeeb929b91 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -474,6 +474,98 @@ static bool metricgroup__has_constraint(struct pmu_event *pe)
> return false;
> }
>
> +int __weak arch_get_runtimeparam(void)
> +{
> + return 1;
> +}
> +
> +static int metricgroup__add_metric_runtime_param(struct strbuf *events,
> + struct list_head *group_list, struct pmu_event *pe)
> +{
> + int i, count;
> + int ret = -EINVAL;
> +
> + count = arch_get_runtimeparam();
> +
> + /* This loop is added to create multiple
> + * events depend on count value and add
> + * those events to group_list.
> + */
> +
> + for (i = 0; i < count; i++) {
> + const char **ids;
> + int idnum;
> + struct egroup *eg;
> + char value[PATH_MAX];
> +
> + expr__runtimeparam = i;
so the expr__runtimeparam is always set before we call the
expr parsing function - wither expr__find_other or expr__parse,
and it's used inside the normalize flexer function, which has
access to the passed context.. so I don't see a reason why
expr__runtimeparam couldn't be added in struct parse_ctx
and used from there..
while in this, perhaps we should rename parse_ctx to expr_ctx,
to keep the namespace straight (in separate patch)
thanks,
jirka
^ permalink raw reply
* Re: [RESEND PATCH v2 6/9] drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)
From: Thomas Zimmermann @ 2020-03-12 10:49 UTC (permalink / raw)
To: Krzysztof Kozlowski, Richard Henderson, Ivan Kokshaysky,
Matt Turner, Alexey Brodkin, Vineet Gupta, James E.J. Bottomley,
Helge Deller, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman, Yoshinori Sato, Rich Felker, Dave Airlie,
David Airlie, Daniel Vetter, Ben Skeggs, Mauro Carvalho Chehab,
Jiri Slaby, Nick Kossifidis, Luis Chamberlain, Kalle Valo,
David S. Miller, Dave Jiang, Jon Mason, Allen Hubbe,
Michael S. Tsirkin, Jason Wang, Arnd Bergmann, Geert Uytterhoeven,
Andrew Morton, Thomas Gleixner, linux-alpha, linux-kernel,
linux-snps-arc, linux-parisc, linuxppc-dev, linux-sh, dri-devel,
nouveau, linux-media, linux-wireless, netdev, linux-ntb,
virtualization, linux-arch
In-Reply-To: <20200219175007.13627-7-krzk@kernel.org>
[-- Attachment #1.1: Type: text/plain, Size: 1823 bytes --]
Hi Krzysztof,
I just received a resend email from 3 weeks ago :/
Do you want me to merge the mgag200 patch into drm-misc-next?
Best regards
Thomas
Am 19.02.20 um 18:50 schrieb Krzysztof Kozlowski:
> The ioreadX() helpers have inconsistent interface. On some architectures
> void *__iomem address argument is a pointer to const, on some not.
>
> Implementations of ioreadX() do not modify the memory under the address
> so they can be converted to a "const" version for const-safety and
> consistency among architectures.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> ---
>
> Changes since v1:
> 1. Add Thomas' review.
> ---
> drivers/gpu/drm/mgag200/mgag200_drv.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h
> index aa32aad222c2..6512b3af4fb7 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_drv.h
> +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h
> @@ -34,9 +34,9 @@
>
> #define MGAG200FB_CONN_LIMIT 1
>
> -#define RREG8(reg) ioread8(((void __iomem *)mdev->rmmio) + (reg))
> +#define RREG8(reg) ioread8(((const void __iomem *)mdev->rmmio) + (reg))
> #define WREG8(reg, v) iowrite8(v, ((void __iomem *)mdev->rmmio) + (reg))
> -#define RREG32(reg) ioread32(((void __iomem *)mdev->rmmio) + (reg))
> +#define RREG32(reg) ioread32(((const void __iomem *)mdev->rmmio) + (reg))
> #define WREG32(reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg))
>
> #define ATTR_INDEX 0x1fc0
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Re: [PATCH 1/3] powerpc/numa: Set numa_node for all possible cpus
From: Vlastimil Babka @ 2020-03-12 9:30 UTC (permalink / raw)
To: Sachin Sant, Srikar Dronamraju
Cc: linuxppc-dev, LKML, Michal Hocko, linux-mm, Mel Gorman,
Kirill A. Shutemov, Andrew Morton, Linus Torvalds,
Christopher Lameter
In-Reply-To: <C5560C71-483A-41FB-BDE9-526F1E0CFA36@linux.vnet.ibm.com>
On 3/12/20 9:23 AM, Sachin Sant wrote:
>
>
>> On 12-Mar-2020, at 10:57 AM, Srikar Dronamraju <srikar@linux.vnet.ibm.com> wrote:
>>
>> * Michal Hocko <mhocko@kernel.org> [2020-03-11 12:57:35]:
>>
>>> On Wed 11-03-20 16:32:35, Srikar Dronamraju wrote:
>>>> A Powerpc system with multiple possible nodes and with CONFIG_NUMA
>>>> enabled always used to have a node 0, even if node 0 does not any cpus
>>>> or memory attached to it. As per PAPR, node affinity of a cpu is only
>>>> available once its present / online. For all cpus that are possible but
>>>> not present, cpu_to_node() would point to node 0.
>>>>
>>>> To ensure a cpuless, memoryless dummy node is not online, powerpc need
>>>> to make sure all possible but not present cpu_to_node are set to a
>>>> proper node.
>>>
>>> Just curious, is this somehow related to
>>> http://lkml.kernel.org/r/20200227182650.GG3771@dhcp22.suse.cz?
>>>
>>
>> The issue I am trying to fix is a known issue in Powerpc since many years.
>> So this surely not a problem after a75056fc1e7c (mm/memcontrol.c: allocate
>> shrinker_map on appropriate NUMA node").
>>
>> I tried v5.6-rc4 + a75056fc1e7c but didnt face any issues booting the
>> kernel. Will work with Sachin/Abdul (reporters of the issue).
>>
>
> I applied this 3 patch series on top of March 11 next tree (commit d44a64766795 )
> The kernel still fails to boot with same call trace.
Yeah when I skimmed the patches, I don't think they address the issue where
node_to_mem_node(0) = 0 [1]. You could reapply the debug print patch to verify,
but it seems very likely. So I'm not surprised you get the same trace.
[1] https://lore.kernel.org/linux-next/9a86f865-50b5-7483-9257-dbb08fecd62b@suse.cz/
> [ 6.159357] BUG: Kernel NULL pointer dereference on read at 0x000073b0
> [ 6.159363] Faulting instruction address: 0xc0000000003d7174
> [ 6.159368] Oops: Kernel access of bad area, sig: 11 [#1]
> [ 6.159372] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
> [ 6.159378] Modules linked in:
> [ 6.159382] CPU: 17 PID: 1 Comm: systemd Not tainted 5.6.0-rc5-next-20200311-autotest+ #1
> [ 6.159388] NIP: c0000000003d7174 LR: c0000000003d7714 CTR: c000000000400e70
> [ 6.159393] REGS: c0000008b36836d0 TRAP: 0300 Not tainted (5.6.0-rc5-next-20200311-autotest+)
> [ 6.159398] MSR: 8000000000009033 <SF,EE,ME,IR,DR,RI,LE> CR: 24004848 XER: 00000000
> [ 6.159406] CFAR: c00000000000dec4 DAR: 00000000000073b0 DSISR: 40000000 IRQMASK: 1
> [ 6.159406] GPR00: c0000000003d7714 c0000008b3683960 c00000000155e300 c0000008b301f500
> [ 6.159406] GPR04: 0000000000000dc0 0000000000000000 c0000000003456f8 c0000008bb198620
> [ 6.159406] GPR08: 00000008ba0f0000 0000000000000001 0000000000000000 0000000000000000
> [ 6.159406] GPR12: 0000000024004848 c00000001ec55e00 0000000000000000 0000000000000000
> [ 6.159406] GPR16: c0000008b0a82048 c000000001595898 c000000001750ca8 0000000000000002
> [ 6.159406] GPR20: c000000001750cb8 c000000001624478 0000000fffffffe0 5deadbeef0000122
> [ 6.159406] GPR24: 0000000000000001 0000000000000dc0 0000000000000000 c0000000003456f8
> [ 6.159406] GPR28: c0000008b301f500 c0000008bb198620 0000000000000000 c00c000002285a40
> [ 6.159453] NIP [c0000000003d7174] ___slab_alloc+0x1f4/0x760
> [ 6.159458] LR [c0000000003d7714] __slab_alloc+0x34/0x60
> [ 6.159462] Call Trace:
> [ 6.159465] [c0000008b3683a40] [c0000008b3683a70] 0xc0000008b3683a70
> [ 6.159471] [c0000008b3683a70] [c0000000003d8b20] __kmalloc_node+0x110/0x490
> [ 6.159477] [c0000008b3683af0] [c0000000003456f8] kvmalloc_node+0x58/0x110
> [ 6.159483] [c0000008b3683b30] [c000000000400f78] mem_cgroup_css_online+0x108/0x270
> [ 6.159489] [c0000008b3683b90] [c000000000236ed8] online_css+0x48/0xd0
> [ 6.159494] [c0000008b3683bc0] [c00000000023ffac] cgroup_apply_control_enable+0x2ec/0x4d0
> [ 6.159501] [c0000008b3683ca0] [c0000000002437c8] cgroup_mkdir+0x228/0x5f0
> [ 6.159506] [c0000008b3683d10] [c000000000521780] kernfs_iop_mkdir+0x90/0xf0
> [ 6.159512] [c0000008b3683d50] [c00000000043f670] vfs_mkdir+0x110/0x230
> [ 6.159517] [c0000008b3683da0] [c000000000443150] do_mkdirat+0xb0/0x1a0
> [ 6.159523] [c0000008b3683e20] [c00000000000b278] system_call+0x5c/0x68
> [ 6.159527] Instruction dump:
> [ 6.159531] 7c421378 e95f0000 714a0001 4082fff0 4bffff64 60000000 60000000 faa10088
> [ 6.159538] 3ea2000c 3ab56178 7b4a1f24 7d55502a <e94a73b0> 2faa0000 409e0394 3d02002a
> [ 6.159545] ---[ end trace 36d65cb66091a5b6 ]—
>
> Boot log attached.
>
> Thanks
> -Sachin
>
^ permalink raw reply
* Re: [PATCH 1/3] powerpc/numa: Set numa_node for all possible cpus
From: Sachin Sant @ 2020-03-12 8:23 UTC (permalink / raw)
To: Srikar Dronamraju
Cc: linuxppc-dev, LKML, Michal Hocko, linux-mm, Mel Gorman,
Kirill A. Shutemov, Andrew Morton, Linus Torvalds,
Christopher Lameter, Vlastimil Babka
In-Reply-To: <20200312052707.GA3277@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 4183 bytes --]
> On 12-Mar-2020, at 10:57 AM, Srikar Dronamraju <srikar@linux.vnet.ibm.com> wrote:
>
> * Michal Hocko <mhocko@kernel.org> [2020-03-11 12:57:35]:
>
>> On Wed 11-03-20 16:32:35, Srikar Dronamraju wrote:
>>> A Powerpc system with multiple possible nodes and with CONFIG_NUMA
>>> enabled always used to have a node 0, even if node 0 does not any cpus
>>> or memory attached to it. As per PAPR, node affinity of a cpu is only
>>> available once its present / online. For all cpus that are possible but
>>> not present, cpu_to_node() would point to node 0.
>>>
>>> To ensure a cpuless, memoryless dummy node is not online, powerpc need
>>> to make sure all possible but not present cpu_to_node are set to a
>>> proper node.
>>
>> Just curious, is this somehow related to
>> http://lkml.kernel.org/r/20200227182650.GG3771@dhcp22.suse.cz?
>>
>
> The issue I am trying to fix is a known issue in Powerpc since many years.
> So this surely not a problem after a75056fc1e7c (mm/memcontrol.c: allocate
> shrinker_map on appropriate NUMA node").
>
> I tried v5.6-rc4 + a75056fc1e7c but didnt face any issues booting the
> kernel. Will work with Sachin/Abdul (reporters of the issue).
>
I applied this 3 patch series on top of March 11 next tree (commit d44a64766795 )
The kernel still fails to boot with same call trace.
[ 6.159357] BUG: Kernel NULL pointer dereference on read at 0x000073b0
[ 6.159363] Faulting instruction address: 0xc0000000003d7174
[ 6.159368] Oops: Kernel access of bad area, sig: 11 [#1]
[ 6.159372] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
[ 6.159378] Modules linked in:
[ 6.159382] CPU: 17 PID: 1 Comm: systemd Not tainted 5.6.0-rc5-next-20200311-autotest+ #1
[ 6.159388] NIP: c0000000003d7174 LR: c0000000003d7714 CTR: c000000000400e70
[ 6.159393] REGS: c0000008b36836d0 TRAP: 0300 Not tainted (5.6.0-rc5-next-20200311-autotest+)
[ 6.159398] MSR: 8000000000009033 <SF,EE,ME,IR,DR,RI,LE> CR: 24004848 XER: 00000000
[ 6.159406] CFAR: c00000000000dec4 DAR: 00000000000073b0 DSISR: 40000000 IRQMASK: 1
[ 6.159406] GPR00: c0000000003d7714 c0000008b3683960 c00000000155e300 c0000008b301f500
[ 6.159406] GPR04: 0000000000000dc0 0000000000000000 c0000000003456f8 c0000008bb198620
[ 6.159406] GPR08: 00000008ba0f0000 0000000000000001 0000000000000000 0000000000000000
[ 6.159406] GPR12: 0000000024004848 c00000001ec55e00 0000000000000000 0000000000000000
[ 6.159406] GPR16: c0000008b0a82048 c000000001595898 c000000001750ca8 0000000000000002
[ 6.159406] GPR20: c000000001750cb8 c000000001624478 0000000fffffffe0 5deadbeef0000122
[ 6.159406] GPR24: 0000000000000001 0000000000000dc0 0000000000000000 c0000000003456f8
[ 6.159406] GPR28: c0000008b301f500 c0000008bb198620 0000000000000000 c00c000002285a40
[ 6.159453] NIP [c0000000003d7174] ___slab_alloc+0x1f4/0x760
[ 6.159458] LR [c0000000003d7714] __slab_alloc+0x34/0x60
[ 6.159462] Call Trace:
[ 6.159465] [c0000008b3683a40] [c0000008b3683a70] 0xc0000008b3683a70
[ 6.159471] [c0000008b3683a70] [c0000000003d8b20] __kmalloc_node+0x110/0x490
[ 6.159477] [c0000008b3683af0] [c0000000003456f8] kvmalloc_node+0x58/0x110
[ 6.159483] [c0000008b3683b30] [c000000000400f78] mem_cgroup_css_online+0x108/0x270
[ 6.159489] [c0000008b3683b90] [c000000000236ed8] online_css+0x48/0xd0
[ 6.159494] [c0000008b3683bc0] [c00000000023ffac] cgroup_apply_control_enable+0x2ec/0x4d0
[ 6.159501] [c0000008b3683ca0] [c0000000002437c8] cgroup_mkdir+0x228/0x5f0
[ 6.159506] [c0000008b3683d10] [c000000000521780] kernfs_iop_mkdir+0x90/0xf0
[ 6.159512] [c0000008b3683d50] [c00000000043f670] vfs_mkdir+0x110/0x230
[ 6.159517] [c0000008b3683da0] [c000000000443150] do_mkdirat+0xb0/0x1a0
[ 6.159523] [c0000008b3683e20] [c00000000000b278] system_call+0x5c/0x68
[ 6.159527] Instruction dump:
[ 6.159531] 7c421378 e95f0000 714a0001 4082fff0 4bffff64 60000000 60000000 faa10088
[ 6.159538] 3ea2000c 3ab56178 7b4a1f24 7d55502a <e94a73b0> 2faa0000 409e0394 3d02002a
[ 6.159545] ---[ end trace 36d65cb66091a5b6 ]—
Boot log attached.
Thanks
-Sachin
[-- Attachment #2: memory-less-node-boot.log --]
[-- Type: application/octet-stream, Size: 19236 bytes --]
# kexec -e
[ 4149.149473] kexec_core: Starting new kernel
[ 4149.169501] kexec: waiting for cpu 2 (physical 2) to enter 1 state
[ 4149.169512] kexec: waiting for cpu 23 (physical 23) to enter 1 state
[ 4149.169521] kexec: waiting for cpu 1 (physical 1) to enter 2 state
[ 4149.169596] kexec: waiting for cpu 2 (physical 2) to enter 2 state
[ 4149.169610] kexec: waiting for cpu 3 (physical 3) to enter 2 state
[ 4149.169620] kexec: waiting for cpu 8 (physical 8) to enter 2 state
[ 4149.333175] kexec: Starting switchover sequence.
I'm in purgatory
[ 0.000000] hash-mmu: Page sizes from device-tree:
[ 0.000000] hash-mmu: base_shift=12: shift=12, sllp=0x0000, avpnm=0x00000000, tlbiel=1, penc=0
[ 0.000000] hash-mmu: base_shift=12: shift=16, sllp=0x0000, avpnm=0x00000000, tlbiel=1, penc=7
[ 0.000000] hash-mmu: base_shift=12: shift=24, sllp=0x0000, avpnm=0x00000000, tlbiel=1, penc=56
[ 0.000000] hash-mmu: base_shift=16: shift=16, sllp=0x0110, avpnm=0x00000000, tlbiel=1, penc=1
[ 0.000000] hash-mmu: base_shift=16: shift=24, sllp=0x0110, avpnm=0x00000000, tlbiel=1, penc=8
[ 0.000000] hash-mmu: base_shift=24: shift=24, sllp=0x0100, avpnm=0x00000001, tlbiel=0, penc=0
[ 0.000000] hash-mmu: base_shift=34: shift=34, sllp=0x0120, avpnm=0x000007ff, tlbiel=0, penc=3
[ 0.000000] Using 1TB segments
[ 0.000000] hash-mmu: Initializing hash mmu with SLB
[ 0.000000] Linux version 5.6.0-rc5-next-20200311-autotest+ (root@ltc-zzci-2.aus.stglabs.ibm.com) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC)) #1 SMP Thu Mar 12 03:03:59 CDT 2020
[ 0.000000] Found initrd at 0xc000000003350000:0xc000000004d9808f
[ 0.000000] Using pSeries machine description
[ 0.000000] printk: bootconsole [udbg0] enabled
[ 0.000000] Partition configured for 32 cpus.
[ 0.000000] CPU maps initialized for 8 threads per core
[ 0.000000] -----------------------------------------------------
[ 0.000000] phys_mem_size = 0x8c0000000
[ 0.000000] dcache_bsize = 0x80
[ 0.000000] icache_bsize = 0x80
[ 0.000000] cpu_features = 0x0001c07f8f5f91a7
[ 0.000000] possible = 0x0003fbffcf5fb1a7
[ 0.000000] always = 0x00000003800081a1
[ 0.000000] cpu_user_features = 0xdc0065c2 0xefe00000
[ 0.000000] mmu_features = 0x7c006001
[ 0.000000] firmware_features = 0x00000097c45bfc57
[ 0.000000] vmalloc start = 0xc008000000000000
[ 0.000000] IO start = 0xc00a000000000000
[ 0.000000] vmemmap start = 0xc00c000000000000
[ 0.000000] hash-mmu: ppc64_pft_size = 0x1c
[ 0.000000] hash-mmu: htab_hash_mask = 0x1fffff
[ 0.000000] -----------------------------------------------------
[ 0.000000] numa: NODE_DATA [mem 0x8bfedc900-0x8bfee3fff]
[ 0.000000] rfi-flush: fallback displacement flush available
[ 0.000000] rfi-flush: mttrig type flush available
[ 0.000000] link-stack-flush: software flush enabled.
[ 0.000000] count-cache-flush: software flush disabled.
[ 0.000000] stf-barrier: eieio barrier available
[ 0.000000] lpar: H_BLOCK_REMOVE supports base psize:0 psize:0 block size:8
[ 0.000000] lpar: H_BLOCK_REMOVE supports base psize:0 psize:2 block size:8
[ 0.000000] lpar: H_BLOCK_REMOVE supports base psize:0 psize:10 block size:8
[ 0.000000] lpar: H_BLOCK_REMOVE supports base psize:2 psize:2 block size:8
[ 0.000000] lpar: H_BLOCK_REMOVE supports base psize:2 psize:10 block size:8
[ 0.000000] PPC64 nvram contains 15360 bytes
[ 0.000000] barrier-nospec: using ORI speculation barrier
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000000000000-0x00000008bfffffff]
[ 0.000000] Device empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 1: [mem 0x0000000000000000-0x00000008bfffffff]
[ 0.000000] Initmem setup node 1 [mem 0x0000000000000000-0x00000008bfffffff]
[ 0.000000] percpu: Embedded 11 pages/cpu s624024 r0 d96872 u1048576
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 572880
[ 0.000000] Policy zone: Normal
[ 0.000000] Kernel command line: root=UUID=681ebf25-b7c8-49b9-b247-35a96bc8183f
[ 0.000000] Dentry cache hash table entries: 8388608 (order: 10, 67108864 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 4194304 (order: 9, 33554432 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 36388480K/36700160K available (11840K kernel code, 1728K rwdata, 3712K rodata, 4992K init, 2845K bss, 311680K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=128, Order=0-3, MinObjects=0, CPUs=32, Nodes=32
[ 0.000000] ftrace: allocating 29890 entries in 11 pages
[ 0.000000] ftrace: allocated 11 pages with 3 groups
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=2048 to nr_cpu_ids=32.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=32
[ 0.000000] NR_IRQS: 512, nr_irqs: 512, preallocated irqs: 16
[ 0.000000] xive: Using IRQ range [94000-9401f]
[ 0.000000] xive: Interrupt handling initialized with spapr backend
[ 0.000000] xive: Using priority 7 for all interrupts
[ 0.000000] xive: Using 64kB queues
[ 0.000000] rcu: Offload RCU callbacks from CPUs: (none).
[ 0.000000] random: get_random_u64 called from start_kernel+0x748/0x9a4 with crng_init=0
[ 0.000001] time_init: 56 bit decrementer (max: 7fffffffffffff)
[ 0.000065] clocksource: timebase: mask: 0xffffffffffffffff max_cycles: 0x761537d007, max_idle_ns: 440795202126 ns
[ 0.000173] clocksource: timebase mult[1f40000] shift[24] registered
[ 0.000299] Console: colour dummy device 80x25
[ 0.000350] printk: console [hvc0] enabled
[ 0.000350] printk: console [hvc0] enabled
[ 0.000397] printk: bootconsole [udbg0] disabled
[ 0.000397] printk: bootconsole [udbg0] disabled
[ 0.000472] pid_max: default: 32768 minimum: 301
[ 0.000621] Mount-cache hash table entries: 131072 (order: 4, 1048576 bytes, linear)
[ 0.000690] Mountpoint-cache hash table entries: 131072 (order: 4, 1048576 bytes, linear)
[ 0.001491] EEH: pSeries platform initialized
[ 0.001499] POWER9 performance monitor hardware support registered
[ 0.001531] rcu: Hierarchical SRCU implementation.
[ 0.002227] smp: Bringing up secondary CPUs ...
[ 0.011406] smp: Brought up 1 node, 32 CPUs
[ 0.011413] numa: Node 1 CPUs: 0-31
[ 0.011417] Using small cores at SMT level
[ 0.011420] Using shared cache scheduler topology
[ 0.012363] devtmpfs: initialized
[ 0.015539] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.015550] futex hash table entries: 8192 (order: 4, 1048576 bytes, linear)
[ 0.015773] thermal_sys: Registered thermal governor 'fair_share'
[ 0.015774] thermal_sys: Registered thermal governor 'step_wise'
[ 0.015880] NET: Registered protocol family 16
[ 0.016023] audit: initializing netlink subsys (disabled)
[ 0.016073] audit: type=2000 audit(1584000985.010:1): state=initialized audit_enabled=0 res=1
[ 0.016180] cpuidle: using governor menu
[ 0.016353] pstore: Registered nvram as persistent store backend
[ 0.020998] PCI: Probing PCI hardware
[ 0.021005] EEH: No capable adapters found: recovery disabled.
[ 0.021071] pseries-rng: Registering arch random hook.
[ 0.022801] HugeTLB registered 16.0 MiB page size, pre-allocated 0 pages
[ 0.022808] HugeTLB registered 16.0 GiB page size, pre-allocated 0 pages
[ 0.263342] random: fast init done
[ 0.264479] iommu: Default domain type: Translated
[ 0.264517] vgaarb: loaded
[ 0.264595] SCSI subsystem initialized
[ 0.264626] usbcore: registered new interface driver usbfs
[ 0.264635] usbcore: registered new interface driver hub
[ 0.264714] usbcore: registered new device driver usb
[ 0.264835] EDAC MC: Ver: 3.0.0
[ 0.265112] clocksource: Switched to clocksource timebase
[ 0.276114] VFS: Disk quotas dquot_6.6.0
[ 0.276139] VFS: Dquot-cache hash table entries: 8192 (order 0, 65536 bytes)
[ 0.277659] NET: Registered protocol family 2
[ 0.277834] tcp_listen_portaddr_hash hash table entries: 32768 (order: 3, 524288 bytes, linear)
[ 0.277888] TCP established hash table entries: 524288 (order: 6, 4194304 bytes, linear)
[ 0.278586] TCP bind hash table entries: 65536 (order: 4, 1048576 bytes, linear)
[ 0.278680] TCP: Hash tables configured (established 524288 bind 65536)
[ 0.278718] UDP hash table entries: 32768 (order: 4, 1048576 bytes, linear)
[ 0.278817] UDP-Lite hash table entries: 32768 (order: 4, 1048576 bytes, linear)
[ 0.279011] NET: Registered protocol family 1
[ 0.279020] PCI: CLS 0 bytes, default 128
[ 0.279056] Trying to unpack rootfs image as initramfs...
[ 0.690890] Freeing initrd memory: 26880K
[ 0.693555] IOMMU table initialized, virtual merging enabled
[ 0.713723] hv-24x7: read 1530 catalog entries, created 537 event attrs (0 failures), 275 descs
[ 0.714748] workingset: timestamp_bits=38 max_order=20 bucket_order=0
[ 0.715826] zbud: loaded
[ 0.725026] NET: Registered protocol family 38
[ 0.725033] Key type asymmetric registered
[ 0.725037] Asymmetric key parser 'x509' registered
[ 0.725046] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[ 0.725138] io scheduler mq-deadline registered
[ 0.725143] io scheduler kyber registered
[ 0.725573] atomic64_test: passed
[ 0.725607] PowerPC PowerNV PCI Hotplug Driver version: 0.1
[ 0.725872] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[ 0.726066] Non-volatile memory driver v1.3
[ 0.726089] Linux agpgart interface v0.103
[ 6.005301] tpm_ibmvtpm 30000003: CRQ initialization completed
[ 6.005309] tpm_ibmvtpm 30000003: ibmvtpm device is not ready
[ 6.005310] tpm_ibmvtpm 30000003: ibmvtpm device is not ready
[ 6.005540] rdac: device handler registered
[ 6.005579] hp_sw: device handler registered
[ 6.005583] emc: device handler registered
[ 6.005651] alua: device handler registered
[ 6.005730] libphy: Fixed MDIO Bus: probed
[ 6.005763] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 6.005773] ehci-pci: EHCI PCI platform driver
[ 6.005781] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 6.005790] ohci-pci: OHCI PCI platform driver
[ 6.005797] uhci_hcd: USB Universal Host Controller Interface driver
[ 6.005828] usbcore: registered new interface driver usbserial_generic
[ 6.005835] usbserial: USB Serial support registered for generic
[ 6.005882] mousedev: PS/2 mouse device common for all mice
[ 6.005988] rtc-generic rtc-generic: registered as rtc0
[ 6.006323] nx_compress_pseries ibm,compression-v1: nx842_OF_upd: max_sync_size new:65536 old:0
[ 6.006332] nx_compress_pseries ibm,compression-v1: nx842_OF_upd: max_sync_sg new:510 old:0
[ 6.006339] nx_compress_pseries ibm,compression-v1: nx842_OF_upd: max_sg_len new:4080 old:0
[ 6.006396] alg: No test for 842 (842-nx)
[ 6.007511] hid: raw HID events driver (C) Jiri Kosina
[ 6.007602] usbcore: registered new interface driver usbhid
[ 6.007605] usbhid: USB HID core driver
[ 6.007657] drop_monitor: Initializing network drop monitor service
[ 6.007735] Initializing XFRM netlink socket
[ 6.007866] NET: Registered protocol family 10
[ 6.008125] Segment Routing with IPv6
[ 6.008141] NET: Registered protocol family 17
[ 6.008645] registered taskstats version 1
[ 6.008677] zswap: loaded using pool lzo/zbud
[ 6.008809] pstore: Using crash dump compression: deflate
[ 6.012620] Key type big_key registered
[ 6.012774] rtc-generic rtc-generic: setting system clock to 2020-03-12T08:16:31 UTC (1584000991)
[ 6.014119] Freeing unused kernel memory: 4992K
[ 6.014124] Kernel memory protection not selected by kernel config.
[ 6.014128] Run /init as init process
[ 6.023254] systemd[1]: systemd 239 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=legacy)
[ 6.023441] systemd[1]: Detected architecture ppc64-le.
[ 6.023447] systemd[1]: Running in initial RAM disk.
Welcome to Red Hat Enterprise Linux 8.1 Beta (Ootpa) dracut-049-26.git20190806.el8 (Initramfs)!
[ 6.105290] systemd[1]: Set hostname to <ltc-zzci-2.aus.stglabs.ibm.com>.
[ 6.157928] random: systemd: uninitialized urandom read (16 bytes read)
[ 6.157996] systemd[1]: Listening on udev Kernel Socket.
[ OK ] Listening on udev Kernel Socket.
[ 6.158142] random: systemd: uninitialized urandom read (16 bytes read)
[ 6.158225] systemd[1]: Listening on Journal Socket.
[ OK ] Listening on Journal Socket.
[ 6.158356] random: systemd: uninitialized urandom read (16 bytes read)
[ 6.158368] systemd[1]: Reached target Timers.
[ OK ] Reached target Timers.
[ 6.159357] BUG: Kernel NULL pointer dereference on read at 0x000073b0
[ 6.159363] Faulting instruction address: 0xc0000000003d7174
[ 6.159368] Oops: Kernel access of bad area, sig: 11 [#1]
[ 6.159372] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
[ 6.159378] Modules linked in:
[ 6.159382] CPU: 17 PID: 1 Comm: systemd Not tainted 5.6.0-rc5-next-20200311-autotest+ #1
[ 6.159388] NIP: c0000000003d7174 LR: c0000000003d7714 CTR: c000000000400e70
[ 6.159393] REGS: c0000008b36836d0 TRAP: 0300 Not tainted (5.6.0-rc5-next-20200311-autotest+)
[ 6.159398] MSR: 8000000000009033 <SF,EE,ME,IR,DR,RI,LE> CR: 24004848 XER: 00000000
[ 6.159406] CFAR: c00000000000dec4 DAR: 00000000000073b0 DSISR: 40000000 IRQMASK: 1
[ 6.159406] GPR00: c0000000003d7714 c0000008b3683960 c00000000155e300 c0000008b301f500
[ 6.159406] GPR04: 0000000000000dc0 0000000000000000 c0000000003456f8 c0000008bb198620
[ 6.159406] GPR08: 00000008ba0f0000 0000000000000001 0000000000000000 0000000000000000
[ 6.159406] GPR12: 0000000024004848 c00000001ec55e00 0000000000000000 0000000000000000
[ 6.159406] GPR16: c0000008b0a82048 c000000001595898 c000000001750ca8 0000000000000002
[ 6.159406] GPR20: c000000001750cb8 c000000001624478 0000000fffffffe0 5deadbeef0000122
[ 6.159406] GPR24: 0000000000000001 0000000000000dc0 0000000000000000 c0000000003456f8
[ 6.159406] GPR28: c0000008b301f500 c0000008bb198620 0000000000000000 c00c000002285a40
[ 6.159453] NIP [c0000000003d7174] ___slab_alloc+0x1f4/0x760
[ 6.159458] LR [c0000000003d7714] __slab_alloc+0x34/0x60
[ 6.159462] Call Trace:
[ 6.159465] [c0000008b3683a40] [c0000008b3683a70] 0xc0000008b3683a70
[ 6.159471] [c0000008b3683a70] [c0000000003d8b20] __kmalloc_node+0x110/0x490
[ 6.159477] [c0000008b3683af0] [c0000000003456f8] kvmalloc_node+0x58/0x110
[ 6.159483] [c0000008b3683b30] [c000000000400f78] mem_cgroup_css_online+0x108/0x270
[ 6.159489] [c0000008b3683b90] [c000000000236ed8] online_css+0x48/0xd0
[ 6.159494] [c0000008b3683bc0] [c00000000023ffac] cgroup_apply_control_enable+0x2ec/0x4d0
[ 6.159501] [c0000008b3683ca0] [c0000000002437c8] cgroup_mkdir+0x228/0x5f0
[ 6.159506] [c0000008b3683d10] [c000000000521780] kernfs_iop_mkdir+0x90/0xf0
[ 6.159512] [c0000008b3683d50] [c00000000043f670] vfs_mkdir+0x110/0x230
[ 6.159517] [c0000008b3683da0] [c000000000443150] do_mkdirat+0xb0/0x1a0
[ 6.159523] [c0000008b3683e20] [c00000000000b278] system_call+0x5c/0x68
[ 6.159527] Instruction dump:
[ 6.159531] 7c421378 e95f0000 714a0001 4082fff0 4bffff64 60000000 60000000 faa10088
[ 6.159538] 3ea2000c 3ab56178 7b4a1f24 7d55502a <e94a73b0> 2faa0000 409e0394 3d02002a
[ 6.159545] ---[ end trace 36d65cb66091a5b6 ]---
[ 6.161610]
[ 7.161622] Kernel panic - not syncing: Fatal exception
[ 7.169280] ------------[ cut here ]------------
[ 7.169289] WARNING: CPU: 17 PID: 1 at drivers/tty/vt/vt.c:4266 do_unblank_screen+0x190/0x250
[ 7.169297] Modules linked in:
[ 7.169303] CPU: 17 PID: 1 Comm: systemd Tainted: G D 5.6.0-rc5-next-20200311-autotest+ #1
[ 7.169312] NIP: c0000000006ed370 LR: c0000000006ed35c CTR: c000000000b7b960
[ 7.169320] REGS: c0000008b36831b0 TRAP: 0700 Tainted: G D (5.6.0-rc5-next-20200311-autotest+)
[ 7.169330] MSR: 8000000000021033 <SF,ME,IR,DR,RI,LE> CR: 28002242 XER: 2004000c
[ 7.169341] CFAR: c0000000001c8948 IRQMASK: 3
[ 7.169341] GPR00: c0000000006ed35c c0000008b3683440 c00000000155e300 0000000000000000
[ 7.169341] GPR04: 0000000000000003 c0000008b06c200e 0000000000001dd7 c0000008b3683380
[ 7.169341] GPR08: c000000001423760 0000000000000000 0000000000000000 c0000008b36831ff
[ 7.169341] GPR12: 0000000028002448 c00000001ec55e00 0000000000000000 0000000000000000
[ 7.169341] GPR16: c0000008b0a82048 c000000001595898 c000000001750ca8 0000000000000002
[ 7.169341] GPR20: c000000001750cb8 c000000001624478 0000000fffffffe0 5deadbeef0000122
[ 7.169341] GPR24: 0000000000000001 0000000000000dc0 c00000000142c830 c0000000003456f8
[ 7.169341] GPR28: c000000001636f58 c000000001636f80 0000000000000000 c000000001745a88
[ 7.169409] NIP [c0000000006ed370] do_unblank_screen+0x190/0x250
[ 7.169417] LR [c0000000006ed35c] do_unblank_screen+0x17c/0x250
[ 7.169423] Call Trace:
[ 7.169428] [c0000008b3683440] [c0000000006ed38c] do_unblank_screen+0x1ac/0x250 (unreliable)
[ 7.169439] [c0000008b36834c0] [c00000000013eb24] panic+0x1e8/0x414
[ 7.169447] [c0000008b3683560] [c00000000002c71c] oops_end+0x1ac/0x1b0
[ 7.169455] [c0000008b36835e0] [c0000000000868e0] bad_page_fault+0x190/0x1e0
[ 7.169464] [c0000008b3683660] [c00000000000a8a4] handle_page_fault+0x2c/0x30
[ 7.169475] --- interrupt: 300 at ___slab_alloc+0x1f4/0x760
[ 7.169475] LR = __slab_alloc+0x34/0x60
[ 7.169484] [c0000008b3683960] [0000000000000000] 0x0 (unreliable)
[ 7.169491] [c0000008b3683a40] [c0000008b3683a70] 0xc0000008b3683a70
[ 7.169500] [c0000008b3683a70] [c0000000003d8b20] __kmalloc_node+0x110/0x490
[ 7.169509] [c0000008b3683af0] [c0000000003456f8] kvmalloc_node+0x58/0x110
[ 7.169516] [c0000008b3683b30] [c000000000400f78] mem_cgroup_css_online+0x108/0x270
[ 7.169525] [c0000008b3683b90] [c000000000236ed8] online_css+0x48/0xd0
[ 7.169533] [c0000008b3683bc0] [c00000000023ffac] cgroup_apply_control_enable+0x2ec/0x4d0
[ 7.169542] [c0000008b3683ca0] [c0000000002437c8] cgroup_mkdir+0x228/0x5f0
[ 7.169550] [c0000008b3683d10] [c000000000521780] kernfs_iop_mkdir+0x90/0xf0
[ 7.169559] [c0000008b3683d50] [c00000000043f670] vfs_mkdir+0x110/0x230
[ 7.169567] [c0000008b3683da0] [c000000000443150] do_mkdirat+0xb0/0x1a0
[ 7.169575] [c0000008b3683e20] [c00000000000b278] system_call+0x5c/0x68
[ 7.169581] Instruction dump:
[ 7.169586] 4e800020 60000000 60000000 60000000 7c0802a6 f8010090 4badb5e1 60000000
[ 7.169597] 813f0000 7d231b78 2f830000 409e0034 <0fe00000> e8010090 7c0803a6 4bfffeac
[ 7.169608] ---[ end trace 36d65cb66091a5b7 ]---
[ 7.169615] Rebooting in 10 seconds..
^ permalink raw reply
* Re: [RESEND PATCH v2 8/9] media: fsl-viu: Constify ioreadX() iomem argument (as in generic implementation)
From: Hans Verkuil @ 2020-03-12 8:01 UTC (permalink / raw)
To: Krzysztof Kozlowski, Richard Henderson, Ivan Kokshaysky,
Matt Turner, Alexey Brodkin, Vineet Gupta, James E.J. Bottomley,
Helge Deller, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman, Yoshinori Sato, Rich Felker, Dave Airlie,
David Airlie, Daniel Vetter, Ben Skeggs, Mauro Carvalho Chehab,
Jiri Slaby, Nick Kossifidis, Luis Chamberlain, Kalle Valo,
David S. Miller, Dave Jiang, Jon Mason, Allen Hubbe,
Michael S. Tsirkin, Jason Wang, Arnd Bergmann, Geert Uytterhoeven,
Andrew Morton, Thomas Gleixner, linux-alpha, linux-kernel,
linux-snps-arc, linux-parisc, linuxppc-dev, linux-sh, dri-devel,
nouveau, linux-media, linux-wireless, netdev, linux-ntb,
virtualization, linux-arch
In-Reply-To: <20200219175007.13627-9-krzk@kernel.org>
On 2/19/20 6:50 PM, Krzysztof Kozlowski wrote:
> The ioreadX() helpers have inconsistent interface. On some architectures
> void *__iomem address argument is a pointer to const, on some not.
>
> Implementations of ioreadX() do not modify the memory under the address
> so they can be converted to a "const" version for const-safety and
> consistency among architectures.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Regards,
Hans
> ---
> drivers/media/platform/fsl-viu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
> index 81a8faedbba6..991d9dc82749 100644
> --- a/drivers/media/platform/fsl-viu.c
> +++ b/drivers/media/platform/fsl-viu.c
> @@ -34,7 +34,7 @@
> /* Allow building this driver with COMPILE_TEST */
> #if !defined(CONFIG_PPC) && !defined(CONFIG_MICROBLAZE)
> #define out_be32(v, a) iowrite32be(a, (void __iomem *)v)
> -#define in_be32(a) ioread32be((void __iomem *)a)
> +#define in_be32(a) ioread32be((const void __iomem *)a)
> #endif
>
> #define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */
>
^ permalink raw reply
* [PATCH kernel] powerpc/prom_init: Pass the "os-term" message to hypervisor
From: Alexey Kardashevskiy @ 2020-03-12 7:44 UTC (permalink / raw)
To: linuxppc-dev
Cc: Alexey Kardashevskiy, Ram Pai, Thiago Jung Bauermann, kvm-ppc,
David Gibson
The "os-term" RTAS calls has one argument with a message address of
OS termination cause. rtas_os_term() already passes it but the recently
added prom_init's version of that missed it; it also does not fill args
correctly.
This passes the message address and initializes the number of arguments.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
arch/powerpc/kernel/prom_init.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 577345382b23..673f13b87db1 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1773,6 +1773,9 @@ static void __init prom_rtas_os_term(char *str)
if (token == 0)
prom_panic("Could not get token for ibm,os-term\n");
os_term_args.token = cpu_to_be32(token);
+ os_term_args.nargs = cpu_to_be32(1);
+ os_term_args.nret = cpu_to_be32(1);
+ os_term_args.args[0] = cpu_to_be32(__pa(str));
prom_rtas_hcall((uint64_t)&os_term_args);
}
#endif /* CONFIG_PPC_SVM */
--
2.17.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox