LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 1/2] KVM: PPC: Book3S HV: Add support for H_RPT_INVALIDATE
From: Bharata B Rao @ 2020-12-17  8:48 UTC (permalink / raw)
  To: David Gibson; +Cc: aneesh.kumar, npiggin, kvm-ppc, linuxppc-dev
In-Reply-To: <20201217034215.GE310465@yekko.fritz.box>

On Thu, Dec 17, 2020 at 02:42:15PM +1100, David Gibson wrote:
> On Wed, Dec 16, 2020 at 02:24:46PM +0530, Bharata B Rao wrote:
> > +static void do_tlb_invalidate(unsigned long rs, unsigned long target,
> > +			      unsigned long type, unsigned long page_size,
> > +			      unsigned long ap, unsigned long start,
> > +			      unsigned long end)
> > +{
> > +	unsigned long rb;
> > +	unsigned long addr = start;
> > +
> > +	if ((type & H_RPTI_TYPE_ALL) == H_RPTI_TYPE_ALL) {
> > +		rb = PPC_BIT(53); /* IS = 1 */
> > +		do_tlb_invalidate_all(rb, rs);
> > +		return;
> > +	}
> > +
> > +	if (type & H_RPTI_TYPE_PWC) {
> > +		rb = PPC_BIT(53); /* IS = 1 */
> > +		do_tlb_invalidate_pwc(rb, rs);
> > +	}
> > +
> > +	if (!addr && end == -1) { /* PID */
> > +		rb = PPC_BIT(53); /* IS = 1 */
> > +		do_tlb_invalidate_tlb(rb, rs);
> > +	} else { /* EA */
> > +		do {
> > +			rb = addr & ~(PPC_BITMASK(52, 63));
> > +			rb |= ap << PPC_BITLSHIFT(58);
> > +			do_tlb_invalidate_tlb(rb, rs);
> > +			addr += page_size;
> > +		} while (addr < end);
> > +	}
> > +}
> > +
> > +static long kvmppc_h_rpt_invalidate(struct kvm_vcpu *vcpu,
> > +				    unsigned long pid, unsigned long target,
> > +				    unsigned long type, unsigned long pg_sizes,
> > +				    unsigned long start, unsigned long end)
> > +{
> > +	unsigned long rs, ap, psize;
> > +
> > +	if (!kvm_is_radix(vcpu->kvm))
> > +		return H_FUNCTION;
> 
> IIUC The cover note said this case was H_NOT_SUPPORTED, rather than H_FUNCTION.
> 
> > +
> > +	if (end < start)
> > +		return H_P5;
> > +
> > +	if (type & H_RPTI_TYPE_NESTED) {
> > +		if (!nesting_enabled(vcpu->kvm))
> > +			return H_FUNCTION;
> 
> Likewise, I'm not sure that H_FUNCTION is the right choice here.

Yes to both, will switch to H_FUNCTION in the next iteration.

> 
> > +
> > +		/* Support only cores as target */
> > +		if (target != H_RPTI_TARGET_CMMU)
> > +			return H_P2;
> > +
> > +		return kvmhv_h_rpti_nested(vcpu, pid,
> > +					   (type & ~H_RPTI_TYPE_NESTED),
> > +					    pg_sizes, start, end);
> > +	}
> > +
> > +	rs = pid << PPC_BITLSHIFT(31);
> > +	rs |= vcpu->kvm->arch.lpid;
> > +
> > +	if (pg_sizes & H_RPTI_PAGE_64K) {
> > +		psize = rpti_pgsize_to_psize(pg_sizes & H_RPTI_PAGE_64K);
> > +		ap = mmu_get_ap(psize);
> > +		do_tlb_invalidate(rs, target, type, (1UL << 16), ap, start,
> > +				  end);
> 
> Should these be conditional on the TLB flag in type?

Didn't quite get you. Do you mean that depending on the type flag
we may not need to do invalidations for different page sizes
separately?

Regards,
Bharata.

^ permalink raw reply

* Re: powerpc VDSO files being unnecessarily rebuilt
From: Masahiro Yamada @ 2020-12-17  9:23 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Linux Kbuild mailing list
In-Reply-To: <87tuslxhry.fsf@mpe.ellerman.id.au>

On Thu, Dec 17, 2020 at 11:56 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> Hi all,
>
> Since the merge of the C VDSO I see we are repeatedly rebuilding some
> files in the VDSO, eg:
>
>   $ make V=2
>   make[1]: Entering directory '/home/michael/linux/build~'
>     GEN     Makefile
>     CALL    /home/michael/linux/scripts/checksyscalls.sh - due to target missing
>     CALL    /home/michael/linux/scripts/atomic/check-atomics.sh - due to target missing
>     CHK     include/generated/compile.h
>     CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to vgettimeofday.o not in $(targets)
>
> This then causes multiple other files to be rebuilt.
>
> So the obvious fix is to add it to targets:
>
> diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
> index d365810a689a..5386532866ce 100644
> --- a/arch/powerpc/kernel/vdso64/Makefile
> +++ b/arch/powerpc/kernel/vdso64/Makefile
> @@ -5,6 +5,7 @@ ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_
>  include $(srctree)/lib/vdso/Makefile
>
>  obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o
> +targets := $(obj-vdso64) vdso64.so.dbg
>
>  ifneq ($(c-gettimeofday-y),)
>    CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
> @@ -13,11 +14,11 @@ ifneq ($(c-gettimeofday-y),)
>    CFLAGS_vgettimeofday.o += -DDISABLE_BRANCH_PROFILING
>    CFLAGS_vgettimeofday.o += -ffreestanding -fasynchronous-unwind-tables
>    CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE)
> +  targets += vgettimeofday.o
>  endif
>
>  # Build rules
>
> -targets := $(obj-vdso64) vdso64.so.dbg
>  obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
>
>  GCOV_PROFILE := n
>
>
> But then I see it still rebuilt:
>
>   CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
>
>
> I'm not changing the command line, and AFAICS the .cmd file is not
> changing either:
>
>   $ make V=2
>   ...
>     CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
>
>   $ sha256sum build\~/arch/powerpc/kernel/vdso64/vgettimeofday.o
>   7f635546bc2768c7b929d3de1724d83285f3cd54394fcd7104f8b1301d689d65  build~/arch/powerpc/kernel/vdso64/vgettimeofday.o
>
>   $ make V=2
>   ...
>     CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
>
>   $ sha256sum build\~/arch/powerpc/kernel/vdso64/vgettimeofday.o
>   7f635546bc2768c7b929d3de1724d83285f3cd54394fcd7104f8b1301d689d65  build~/arch/powerpc/kernel/vdso64/vgettimeofday.o
>
>
> So any hints on what I'm missing here?
>
> cheers


This is because PPC builds the vdso twice
with different command arguments.


First time:

vdso_prepare: prepare0
         $(if $(CONFIG_VDSO32),$(Q)$(MAKE) \
                 $(build)=arch/powerpc/kernel/vdso32
include/generated/vdso32-offsets.h)
         $(if $(CONFIG_PPC64),$(Q)$(MAKE) \
                 $(build)=arch/powerpc/kernel/vdso64
include/generated/vdso64-offsets.h)


Second time:
   from  arch/powerpc/kernel/Makefile





For the first build, -Werror is missing because
Kbuild directly descends into arch/powerpc/kernel/vdso[32,64]/.


For the second build,

arch/powerpc/Kbuild appends the following:

subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror





-- 
Best Regards
Masahiro Yamada

^ permalink raw reply

* Re: [RFC PATCH v1 7/7] powerpc/bpf: Implement extended BPF on PPC32
From: Christophe Leroy @ 2020-12-17  9:54 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: songliubraving, daniel, john.fastabend, andrii, ast, naveen.n.rao,
	netdev, Paul Mackerras, sandipan, kpsingh, yhs, bpf, linuxppc-dev,
	kafai, linux-kernel
In-Reply-To: <20201217061133.lnfnhbzvikgtjb3i@ast-mbp>



Le 17/12/2020 à 07:11, Alexei Starovoitov a écrit :
> On Wed, Dec 16, 2020 at 10:07:37AM +0000, Christophe Leroy wrote:
>> Implement Extended Berkeley Packet Filter on Powerpc 32
>>
>> Test result with test_bpf module:
>>
>> 	test_bpf: Summary: 378 PASSED, 0 FAILED, [354/366 JIT'ed]
> 
> nice!
> 
>> Registers mapping:
>>
>> 	[BPF_REG_0] = r11-r12
>> 	/* function arguments */
>> 	[BPF_REG_1] = r3-r4
>> 	[BPF_REG_2] = r5-r6
>> 	[BPF_REG_3] = r7-r8
>> 	[BPF_REG_4] = r9-r10
>> 	[BPF_REG_5] = r21-r22 (Args 9 and 10 come in via the stack)
>> 	/* non volatile registers */
>> 	[BPF_REG_6] = r23-r24
>> 	[BPF_REG_7] = r25-r26
>> 	[BPF_REG_8] = r27-r28
>> 	[BPF_REG_9] = r29-r30
>> 	/* frame pointer aka BPF_REG_10 */
>> 	[BPF_REG_FP] = r31
>> 	/* eBPF jit internal registers */
>> 	[BPF_REG_AX] = r19-r20
>> 	[TMP_REG] = r18
>>
>> As PPC32 doesn't have a redzone in the stack,
>> use r17 as tail call counter.
>>
>> r0 is used as temporary register as much as possible. It is referenced
>> directly in the code in order to avoid misuse of it, because some
>> instructions interpret it as value 0 instead of register r0
>> (ex: addi, addis, stw, lwz, ...)
>>
>> The following operations are not implemented:
>>
>> 		case BPF_ALU64 | BPF_DIV | BPF_X: /* dst /= src */
>> 		case BPF_ALU64 | BPF_MOD | BPF_X: /* dst %= src */
>> 		case BPF_STX | BPF_XADD | BPF_DW: /* *(u64 *)(dst + off) += src */
>>
>> The following operations are only implemented for power of two constants:
>>
>> 		case BPF_ALU64 | BPF_MOD | BPF_K: /* dst %= imm */
>> 		case BPF_ALU64 | BPF_DIV | BPF_K: /* dst /= imm */
> 
> Those are sensible limitations. MOD and DIV are rare, but XADD is common.
> Please consider doing it as a cmpxchg loop in the future.
> 
> Also please run test_progs. It will give a lot better coverage than test_bpf.ko
> 

I'm having hard time cross building test_progs:

~/linux-powerpc/tools/testing/selftests/bpf/$ make CROSS_COMPILE=ppc-linux-
...
   GEN 
/home/chr/linux-powerpc/tools/testing/selftests/bpf/tools/build/bpftool/Documentation/bpf-helpers.7
   INSTALL  eBPF_helpers-manpage
   INSTALL  Documentation-man
   GEN      vmlinux.h
/bin/sh: /home/chr/linux-powerpc/tools/testing/selftests/bpf/tools/sbin/bpftool: cannot execute 
binary file
make: *** [/home/chr/linux-powerpc/tools/testing/selftests/bpf/tools/include/vmlinux.h] Error 126
make: *** Deleting file `/home/chr/linux-powerpc/tools/testing/selftests/bpf/tools/include/vmlinux.h'

Looks like it builds bpftool for powerpc and tries to run it on my x86.
How should I proceed ?

Thanks
Christophe

^ permalink raw reply

* [PATCH] powerpc/perf/hv-24x7: Dont create sysfs event files for dummy events
From: Kajol Jain @ 2020-12-17 11:32 UTC (permalink / raw)
  To: mpe, linuxppc-dev; +Cc: kjain, suka, maddy, atrajeev

hv_24x7 performance monitoring unit creates list of supported events
from the event catalog obtained via HCALL. hv_24x7 catalog could also
contain invalid or dummy events (with names like FREE_  or CPM_FREE_ so
on). These events does not have any hardware counters backing them.
So patch adds a check to string compare the event names to filter
out them.

Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
---
 arch/powerpc/perf/hv-24x7.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index 6e7e820508df..c3252d8a7818 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -894,6 +894,11 @@ static int create_events_from_catalog(struct attribute ***events_,
 
 		name = event_name(event, &nl);
 
+		if (strstr(name, "FREE_")) {
+			pr_info("invalid event %zu (%.*s)\n", event_idx, nl, name);
+			junk_events++;
+			continue;
+		}
 		if (event->event_group_record_len == 0) {
 			pr_devel("invalid event %zu (%.*s): group_record_len == 0, skipping\n",
 					event_idx, nl, name);
@@ -955,6 +960,9 @@ static int create_events_from_catalog(struct attribute ***events_,
 			continue;
 
 		name  = event_name(event, &nl);
+		if (strstr(name, "FREE_"))
+			continue;
+
 		nonce = event_uniq_add(&ev_uniq, name, nl, event->domain);
 		ct    = event_data_to_attrs(event_idx, events + event_attr_ct,
 					    event, nonce);
-- 
2.26.2


^ permalink raw reply related

* Re: [PATCH] powerpc/perf/hv-24x7: Dont create sysfs event files for dummy events
From: Madhavan Srinivasan @ 2020-12-17 11:40 UTC (permalink / raw)
  To: Kajol Jain, mpe, linuxppc-dev; +Cc: suka, maddy, atrajeev
In-Reply-To: <20201217113230.1069882-1-kjain@linux.ibm.com>


On 12/17/20 5:02 PM, Kajol Jain wrote:
> hv_24x7 performance monitoring unit creates list of supported events
> from the event catalog obtained via HCALL. hv_24x7 catalog could also
> contain invalid or dummy events (with names like FREE_  or CPM_FREE_ so


Can you also include " RESERVED_NEST*" as part of the check.

# ls /sys/devices/hv_24x7/events | grep RESERVED
RESERVED_NEST1
RESERVED_NEST10
RESERVED_NEST11
RESERVED_NEST12
...


Maddy


> on). These events does not have any hardware counters backing them.
> So patch adds a check to string compare the event names to filter
> out them.
>
> Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
> ---
>   arch/powerpc/perf/hv-24x7.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
> index 6e7e820508df..c3252d8a7818 100644
> --- a/arch/powerpc/perf/hv-24x7.c
> +++ b/arch/powerpc/perf/hv-24x7.c
> @@ -894,6 +894,11 @@ static int create_events_from_catalog(struct attribute ***events_,
>
>   		name = event_name(event, &nl);
>
> +		if (strstr(name, "FREE_")) {
> +			pr_info("invalid event %zu (%.*s)\n", event_idx, nl, name);
> +			junk_events++;
> +			continue;
> +		}
>   		if (event->event_group_record_len == 0) {
>   			pr_devel("invalid event %zu (%.*s): group_record_len == 0, skipping\n",
>   					event_idx, nl, name);
> @@ -955,6 +960,9 @@ static int create_events_from_catalog(struct attribute ***events_,
>   			continue;
>
>   		name  = event_name(event, &nl);
> +		if (strstr(name, "FREE_"))
> +			continue;
> +
>   		nonce = event_uniq_add(&ev_uniq, name, nl, event->domain);
>   		ct    = event_data_to_attrs(event_idx, events + event_attr_ct,
>   					    event, nonce);

^ permalink raw reply

* Re: [PATCH] powerpc/perf/hv-24x7: Dont create sysfs event files for dummy events
From: kajoljain @ 2020-12-17 11:51 UTC (permalink / raw)
  To: Madhavan Srinivasan, mpe, linuxppc-dev; +Cc: suka, maddy, atrajeev
In-Reply-To: <d61d619b-3557-f4ff-a363-3a8f12b3a9ed@linux.ibm.com>



On 12/17/20 5:10 PM, Madhavan Srinivasan wrote:
> 
> On 12/17/20 5:02 PM, Kajol Jain wrote:
>> hv_24x7 performance monitoring unit creates list of supported events
>> from the event catalog obtained via HCALL. hv_24x7 catalog could also
>> contain invalid or dummy events (with names like FREE_  or CPM_FREE_ so
> 
> 
> Can you also include " RESERVED_NEST*" as part of the check.

Hi Maddy,
   Sure, I will add this check.

Thanks,
Kajol Jain

> 
> # ls /sys/devices/hv_24x7/events | grep RESERVED
> RESERVED_NEST1
> RESERVED_NEST10
> RESERVED_NEST11
> RESERVED_NEST12
> ...
>
> 
> Maddy
> 
> 
>> on). These events does not have any hardware counters backing them.
>> So patch adds a check to string compare the event names to filter
>> out them.
>>
>> Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
>> ---
>>   arch/powerpc/perf/hv-24x7.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
>> index 6e7e820508df..c3252d8a7818 100644
>> --- a/arch/powerpc/perf/hv-24x7.c
>> +++ b/arch/powerpc/perf/hv-24x7.c
>> @@ -894,6 +894,11 @@ static int create_events_from_catalog(struct attribute ***events_,
>>
>>           name = event_name(event, &nl);
>>
>> +        if (strstr(name, "FREE_")) {
>> +            pr_info("invalid event %zu (%.*s)\n", event_idx, nl, name);
>> +            junk_events++;
>> +            continue;
>> +        }
>>           if (event->event_group_record_len == 0) {
>>               pr_devel("invalid event %zu (%.*s): group_record_len == 0, skipping\n",
>>                       event_idx, nl, name);
>> @@ -955,6 +960,9 @@ static int create_events_from_catalog(struct attribute ***events_,
>>               continue;
>>
>>           name  = event_name(event, &nl);
>> +        if (strstr(name, "FREE_"))
>> +            continue;
>> +
>>           nonce = event_uniq_add(&ev_uniq, name, nl, event->domain);
>>           ct    = event_data_to_attrs(event_idx, events + event_attr_ct,
>>                           event, nonce);

^ permalink raw reply

* Re: [PATCH v2 01/17] ibmvfc: add vhost fields and defaults for MQ enablement
From: John Garry @ 2020-12-17 11:49 UTC (permalink / raw)
  To: Tyrel Datwyler, Hannes Reinecke, Brian King, james.bottomley
  Cc: brking, linuxppc-dev, linux-scsi, martin.petersen, linux-kernel
In-Reply-To: <f226e3f9-60e9-b96a-ecc3-2e4008e08bac@linux.ibm.com>

On 08/12/2020 22:37, Tyrel Datwyler wrote:
> On 12/7/20 3:56 AM, Hannes Reinecke wrote:
>> On 12/4/20 3:26 PM, Brian King wrote:
>>> On 12/2/20 11:27 AM, Tyrel Datwyler wrote:
>>>> On 12/2/20 7:14 AM, Brian King wrote:
>>>>> On 12/1/20 6:53 PM, Tyrel Datwyler wrote:
>>>>>> Introduce several new vhost fields for managing MQ state of the adapter
>>>>>> as well as initial defaults for MQ enablement.
>>>>>>
>>>>>> Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
>>>>>> ---
>>>>>>    drivers/scsi/ibmvscsi/ibmvfc.c |  9 ++++++++-
>>>>>>    drivers/scsi/ibmvscsi/ibmvfc.h | 13 +++++++++++--
>>>>>>    2 files changed, 19 insertions(+), 3 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
>>>>>> index 42e4d35e0d35..f1d677a7423d 100644
>>>>>> --- a/drivers/scsi/ibmvscsi/ibmvfc.c
>>>>>> +++ b/drivers/scsi/ibmvscsi/ibmvfc.c
>>>>>> @@ -5161,12 +5161,13 @@ static int ibmvfc_probe(struct vio_dev *vdev, const
>>>>>> struct vio_device_id *id)
>>>>>>        }
>>>>>>          shost->transportt = ibmvfc_transport_template;
>>>>>> -    shost->can_queue = max_requests;
>>>>>> +    shost->can_queue = (max_requests / IBMVFC_SCSI_HW_QUEUES);
>>>>>
>>>>> This doesn't look right. can_queue is the SCSI host queue depth, not the MQ
>>>>> queue depth.
>>>>
>>>> Our max_requests is the total number commands allowed across all queues. From
>>>> what I understand is can_queue is the total number of commands in flight allowed
>>>> for each hw queue.
>>>>
>>>>           /*
>>>>            * In scsi-mq mode, the number of hardware queues supported by the LLD.
>>>>            *
>>>>            * Note: it is assumed that each hardware queue has a queue depth of
>>>>            * can_queue. In other words, the total queue depth per host
>>>>            * is nr_hw_queues * can_queue. However, for when host_tagset is set,
>>>>            * the total queue depth is can_queue.
>>>>            */
>>>>
>>>> We currently don't use the host wide shared tagset.
>>>
>>> Ok. I missed that bit... In that case, since we allocate by default only 100
>>> event structs. If we slice that across IBMVFC_SCSI_HW_QUEUES (16) queues, then
>>> we end up with only about 6 commands that can be outstanding per queue,
>>> which is going to really hurt performance... I'd suggest bumping up
>>> IBMVFC_MAX_REQUESTS_DEFAULT from 100 to 1000 as a starting point.
>>>
>> Before doing that I'd rather use the host-wide shared tagset.
>> Increasing the number of requests will increase the memory footprint of the
>> driver (as each request will be statically allocated).

Exposing HW queues increases memory footprint as we allocate the static 
requests per HW queue ctx, regardless of shared hostwide tagset enabled 
or not. This could prob be improved.

>>
> 
> In the case where we use host-wide how do I determine the queue depth per
> hardware queue? Is is hypothetically can_queue or is it (can_queue /
> nr_hw_queues)? We want to allocate an event pool per-queue which made sense
> without host-wide tags since the queue depth per hw queue is exactly can_queue.
> 

Generally hw queue depth should be same as can_queue. And this applies 
when hostwide shared tags is enabled as well.

We do this for hisi_sas: the host can queue max 4096 commands over all 
queues, so we set .can_queue = 4096*, set HW queue depth = 4096, and set 
.host_tagset = 1.

* we need to reserve some commands for internal IO, so this is reduced a 
little

Thanks,
John

^ permalink raw reply

* [Bug 210749] New: sysfs: cannot create duplicate filename '/bus/nvmem/devices/module-vpd'
From: bugzilla-daemon @ 2020-12-17 12:12 UTC (permalink / raw)
  To: linuxppc-dev

https://bugzilla.kernel.org/show_bug.cgi?id=210749

            Bug ID: 210749
           Summary: sysfs: cannot create duplicate filename
                    '/bus/nvmem/devices/module-vpd'
           Product: Platform Specific/Hardware
           Version: 2.5
    Kernel Version: 5.10.1
          Hardware: PPC-64
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: PPC-64
          Assignee: platform_ppc-64@kernel-bugs.osdl.org
          Reporter: erhard_f@mailbox.org
        Regression: No

Created attachment 294193
  --> https://bugzilla.kernel.org/attachment.cgi?id=294193&action=edit
dmesg (kernel 5.10.1, Talos II)

[...]
sysfs: cannot create duplicate filename '/bus/nvmem/devices/module-vpd'
CPU: 4 PID: 349 Comm: systemd-udevd Not tainted 5.10.1-gentoo-TalosII #1
Call Trace:
[c00000001b93eb70] [c0000000007ea2c8] .dump_stack+0xe4/0x13c (unreliable)
[c00000001b93ec10] [c0000000004d63a8] .sysfs_warn_dup+0x78/0xb0
[c00000001b93eca0] [c0000000004d69ec]
.sysfs_do_create_link_sd.isra.0+0x13c/0x150
[c00000001b93ed40] [c0000000008be3a0] .bus_add_device+0x80/0x190
[c00000001b93edd0] [c0000000008b8f2c] .device_add+0x41c/0x990
[c00000001b93eea0] [c000000000952f28] .nvmem_register+0x1f8/0xae0
[c00000001b93ef90] [c00000000095385c] .devm_nvmem_register+0x4c/0xb0
[c00000001b93f020] [c008000006de8c7c] .at24_probe+0x67c/0x8a0 [at24]
[c00000001b93f2a0] [c00000000091cfa8] .i2c_device_probe+0x158/0x3c0
[c00000001b93f330] [c0000000008bfd04] .really_probe+0x134/0x500
[c00000001b93f3e0] [c0000000008c02f8] .driver_probe_device+0x78/0x110
[c00000001b93f460] [c0000000008c06bc] .device_driver_attach+0xbc/0xf0
[c00000001b93f4f0] [c0000000008c0768] .__driver_attach+0x78/0x140
[c00000001b93f580] [c0000000008bcbac] .bus_for_each_dev+0x9c/0x120
[c00000001b93f630] [c0000000008bf404] .driver_attach+0x24/0x40
[c00000001b93f6a0] [c0000000008be958] .bus_add_driver+0x1c8/0x2a0
[c00000001b93f740] [c0000000008c1158] .driver_register+0x88/0x190
[c00000001b93f7c0] [c00000000091e068] .i2c_register_driver+0x58/0xc0
[c00000001b93f840] [c008000006de8ff4] .at24_init+0x5c/0x70 [at24]
[c00000001b93f8b0] [c00000000001135c] .do_one_initcall+0x7c/0x490
[c00000001b93f9a0] [c0000000001d1fac] .do_init_module+0x6c/0x2e0
[c00000001b93fa30] [c0000000001d50e0] .load_module+0x2c80/0x3450
[c00000001b93fc40] [c0000000001d5b28] .__do_sys_finit_module+0xc8/0x120
[c00000001b93fd70] [c000000000037ab0] .system_call_exception+0x160/0x2b0
[c00000001b93fe20] [c00000000000cbe0] system_call_common+0xf0/0x27c
at24: probe of 1-0050 failed with error -17
at24 2-0050: probe
sysfs: cannot create duplicate filename '/bus/nvmem/devices/module-vpd'
CPU: 4 PID: 349 Comm: systemd-udevd Not tainted 5.10.1-gentoo-TalosII #1
Call Trace:
[c00000001b93eb70] [c0000000007ea2c8] .dump_stack+0xe4/0x13c (unreliable)
[c00000001b93ec10] [c0000000004d63a8] .sysfs_warn_dup+0x78/0xb0
[c00000001b93eca0] [c0000000004d69ec]
.sysfs_do_create_link_sd.isra.0+0x13c/0x150
[c00000001b93ed40] [c0000000008be3a0] .bus_add_device+0x80/0x190
[c00000001b93edd0] [c0000000008b8f2c] .device_add+0x41c/0x990
[c00000001b93eea0] [c000000000952f28] .nvmem_register+0x1f8/0xae0
[c00000001b93ef90] [c00000000095385c] .devm_nvmem_register+0x4c/0xb0
[c00000001b93f020] [c008000006de8c7c] .at24_probe+0x67c/0x8a0 [at24]
[c00000001b93f2a0] [c00000000091cfa8] .i2c_device_probe+0x158/0x3c0
[c00000001b93f330] [c0000000008bfd04] .really_probe+0x134/0x500
[c00000001b93f3e0] [c0000000008c02f8] .driver_probe_device+0x78/0x110
[c00000001b93f460] [c0000000008c06bc] .device_driver_attach+0xbc/0xf0
[c00000001b93f4f0] [c0000000008c0768] .__driver_attach+0x78/0x140
[c00000001b93f580] [c0000000008bcbac] .bus_for_each_dev+0x9c/0x120
[c00000001b93f630] [c0000000008bf404] .driver_attach+0x24/0x40
[c00000001b93f6a0] [c0000000008be958] .bus_add_driver+0x1c8/0x2a0
[c00000001b93f740] [c0000000008c1158] .driver_register+0x88/0x190
[c00000001b93f7c0] [c00000000091e068] .i2c_register_driver+0x58/0xc0
[c00000001b93f840] [c008000006de8ff4] .at24_init+0x5c/0x70 [at24]
[c00000001b93f8b0] [c00000000001135c] .do_one_initcall+0x7c/0x490
[c00000001b93f9a0] [c0000000001d1fac] .do_init_module+0x6c/0x2e0
[c00000001b93fa30] [c0000000001d50e0] .load_module+0x2c80/0x3450
[c00000001b93fc40] [c0000000001d5b28] .__do_sys_finit_module+0xc8/0x120
[c00000001b93fd70] [c000000000037ab0] .system_call_exception+0x160/0x2b0
[c00000001b93fe20] [c00000000000cbe0] system_call_common+0xf0/0x27c
at24: probe of 2-0050 failed with error -17
at24 3-0050: probe
[...]

 # inxi -b --no-host
System:    Kernel: 5.10.1-gentoo-TalosII ppc64 bits: 64 Console: tty 1 
           Distro: Gentoo Base System release 2.7 
Machine:   Type: PowerPC Device System: T2P9D01 REV 1.01 details: PowerNV
T2P9D01 REV 1.01 
           rev: 2.2 (pvr 004e 1202) 
CPU:       Info: 32-Core POWER9 altivec supported [MCP] speed: 2170 MHz
min/max: 2154/3800 MHz 
Graphics:  Device-1: AMD Turks XT [Radeon HD 6670/7670] driver: radeon v:
kernel 
           Device-2: ASPEED Graphics Family driver: N/A 
           Display: server: X.org 1.20.10 driver: ati,radeon unloaded:
fbdev,modesetting tty: 104x53 
           Message: Advanced graphics data unavailable in console for root. 
Network:   Device-1: Broadcom and subsidiaries NetXtreme BCM5719 Gigabit
Ethernet PCIe driver: tg3 
           Device-2: Broadcom and subsidiaries NetXtreme BCM5719 Gigabit
Ethernet PCIe driver: tg3 
Drives:    Local Storage: total: 447.13 GiB used: 16.64 GiB (3.7%) 
Info:      Processes: 445 Uptime: 11m Memory: 62.75 GiB used: 1.89 GiB (3.0%)
Init: systemd 
           runlevel: 5 Shell: Bash inxi: 3.1.06

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply

* [Bug 210749] sysfs: cannot create duplicate filename '/bus/nvmem/devices/module-vpd'
From: bugzilla-daemon @ 2020-12-17 12:13 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <bug-210749-206035@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=210749

--- Comment #1 from Erhard F. (erhard_f@mailbox.org) ---
Created attachment 294195
  --> https://bugzilla.kernel.org/attachment.cgi?id=294195&action=edit
kernel .config (kernel 5.10.1, Talos II)

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply

* [GIT PULL] Please pull powerpc/linux.git powerpc-5.11-1 tag
From: Michael Ellerman @ 2020-12-17 13:28 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: ego, clombard, david, aik, jniethe5, srikar, bala24, oohall,
	miaoqinglang, ardb, ajd, leobras.c, maddy, aneesh.kumar,
	vincent.stehle, tiwai, ganeshgr, u.kleine-koenig, harish, longman,
	mathieu.desnoyers, nathanl, ravi.bangoria, Kees Cook, amodra,
	npiggin, oss, kaixuxia, clg, oleg, ldufour, tangyouling,
	po-hsu.lin, dja, atrajeev, zhangxiaoxu5, linux-kernel, tyreld,
	fbarrat, colin.king, linuxppc-dev, morbo

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Linus,

Please pull powerpc updates for 5.11.

There's only one conflict I'm aware of, which is the three lkdtm files,
resolution is simply to take both sides.

Notable out of area changes:
  drivers/misc/lkdtm/*			# 3ba150fb2120 lkdtm/powerpc: Add SLB multihit test
  tools/testing/selftests/lkdtm/tests.txt

  include/linux/compat.h		# 14026b94ccfe signal: Add unsafe_put_compat_sigset()
  include/linux/memory_hotplug.h	# 4abb1e5b63ac powerpc/mm: factor out creating/removing linear mapping
  include/linux/regset.h		# 640586f8af35 powerpc/ptrace: Simplify gpr_get()/tm_cgpr_get()

cheers


The following changes since commit 3cea11cd5e3b00d91caf0b4730194039b45c5891:

  Linux 5.10-rc2 (2020-11-01 14:43:51 -0800)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.11-1

for you to fetch changes up to c1bea0a840ac75dca19bc6aa05575a33eb9fd058:

  powerpc/32s: Fix cleanup_cpu_mmu_context() compile bug (2020-12-17 14:33:35 +1100)

- ------------------------------------------------------------------
powerpc updates for 5.11

 - Switch to the generic C VDSO, as well as some cleanups of our VDSO
   setup/handling code.

 - Support for KUAP (Kernel User Access Prevention) on systems using the hashed
   page table MMU, using memory protection keys.

 - Better handling of PowerVM SMT8 systems where all threads of a core do not
   share an L2, allowing the scheduler to make better scheduling decisions.

 - Further improvements to our machine check handling.

 - Show registers when unwinding interrupt frames during stack traces.

 - Improvements to our pseries (PowerVM) partition migration code.

 - Several series from Christophe refactoring and cleaning up various parts of
   the 32-bit code.

 - Other smaller features, fixes & cleanups.

Thanks to:
  Alan Modra, Alexey Kardashevskiy, Andrew Donnellan, Aneesh Kumar K.V, Ard
  Biesheuvel, Athira Rajeev, Balamuruhan S, Bill Wendling, Cédric Le Goater,
  Christophe Leroy, Christophe Lombard, Colin Ian King, Daniel Axtens, David
  Hildenbrand, Frederic Barrat, Ganesh Goudar, Gautham R. Shenoy, Geert
  Uytterhoeven, Giuseppe Sacco, Greg Kurz, Harish, Jan Kratochvil, Jordan
  Niethe, Kaixu Xia, Laurent Dufour, Leonardo Bras, Madhavan Srinivasan, Mahesh
  Salgaonkar, Mathieu Desnoyers, Nathan Lynch, Nicholas Piggin, Oleg Nesterov,
  Oliver O'Halloran, Oscar Salvador, Po-Hsu Lin, Qian Cai, Qinglang Miao, Randy
  Dunlap, Ravi Bangoria, Sachin Sant, Sandipan Das, Sebastian Andrzej Siewior ,
  Segher Boessenkool, Srikar Dronamraju, Tyrel Datwyler, Uwe Kleine-König,
  Vincent Stehlé, Youling Tang, Zhang Xiaoxu.

- ------------------------------------------------------------------
Alan Modra (1):
      powerpc/boot: Make use of REL16 relocs in powerpc/boot/util.S

Alexey Kardashevskiy (1):
      powerpc/powernv/npu: Do not attempt NPU2 setup on POWER8NVL NPU

Andrew Donnellan (1):
      powerpc/powernv: Rate limit opal-elog read failure message

Aneesh Kumar K.V (26):
      powerpc/mm: Move setting PTE specific flags to pfn_pmd()
      powerpc/mm: Update tlbiel loop on POWER10
      powerpc: Add new macro to handle NESTED_IFCLR
      KVM: PPC: BOOK3S: PR: Ignore UAMOR SPR
      powerpc/book3s64/kuap/kuep: Add PPC_PKEY config on book3s64
      powerpc/book3s64/kuap/kuep: Move uamor setup to pkey init
      powerpc/book3s64/kuap: Move KUAP related function outside radix
      powerpc/book3s64/kuep: Move KUEP related function outside radix
      powerpc/book3s64/kuap: Rename MMU_FTR_RADIX_KUAP and MMU_FTR_KUEP
      powerpc/book3s64/kuap: Use Key 3 for kernel mapping with hash translation
      powerpc/exec: Set thread.regs early during exec
      powerpc/book3s64/pkeys: Store/restore userspace AMR/IAMR correctly on entry and exit from kernel
      powerpc/book3s64/pkeys: Inherit correctly on fork.
      powerpc/book3s64/pkeys: Reset userspace AMR correctly on exec
      powerpc/ptrace-view: Use pt_regs values instead of thread_struct based one.
      powerpc/book3s64/pkeys: Don't update SPRN_AMR when in kernel mode.
      powerpc/book3s64/kuap: Restrict access to userspace based on userspace AMR
      powerpc/book3s64/kuap: Improve error reporting with KUAP
      powerpc/book3s64/kuap: Use Key 3 to implement KUAP with hash translation.
      powerpc/book3s64/kuep: Use Key 3 to implement KUEP with hash translation.
      powerpc/book3s64/hash/kuap: Enable kuap on hash
      powerpc/book3s64/hash/kuep: Enable KUEP on hash
      powerpc/book3s64/kup: Check max key supported before enabling kup
      powerpc/book3s64/pkeys: Optimize KUAP and KUEP feature disabled case
      powerpc/book3s64/kuap: Improve error reporting with KUAP
      powerpc/64s: Mark the kuap/kuep functions non __init

Ard Biesheuvel (1):
      powerpc: Avoid broken GCC __attribute__((optimize))

Athira Rajeev (13):
      powerpc/perf: Add new power PMU flag "PPMU_P10_DD1" for power10 DD1
      powerpc/perf: Drop the check for SIAR_VALID
      powerpc/perf: Use the address from SIAR register to set cpumode flags
      powerpc/perf: Fix crash with is_sier_available when pmu is not set
      powerpc/perf: Invoke per-CPU variable access with disabled interrupts
      powerpc/perf: Fix to update radix_scope_qual in power10
      powerpc/perf: Update the PMU group constraints for l2l3 events in power10
      powerpc/perf: Fix the PMU group constraints for threshold events in power10
      powerpc/perf: Add generic and cache event list for power10 DD1
      powerpc/perf: Fix to update generic event codes for power10
      powerpc/perf: Fix to update cache events with l2l3 events in power10
      powerpc/perf: MMCR0 control for PMU registers under PMCC=00
      powerpc/perf: Exclude kernel samples while counting events in user space.

Balamuruhan S (4):
      powerpc/sstep: Emulate prefixed instructions only when CPU_FTR_ARCH_31 is set
      powerpc/sstep: Support VSX vector paired storage access instructions
      powerpc/ppc-opcode: Add encoding macros for VSX vector paired instructions
      powerpc/sstep: Add testcases for VSX vector paired load/store instructions

Bill Wendling (5):
      powerpc/boot: Move the .got section to after the .dynamic section
      powerpc/boot/wrapper: Add "-z rodynamic" when using LLD
      powerpc/boot/wrapper: Add "-z notext" flag to disable diagnostic
      powerpc/boot: Use clang when CC is clang
      powerpc: Work around inline asm issues in alternate feature sections

Christophe Leroy (128):
      powerpc/bitops: Fix possible undefined behaviour with fls() and fls64()
      powerpc/feature: Fix CPU_FTRS_ALWAYS by removing CPU_FTRS_GENERIC_32
      powerpc/64s: Replace RFI by RFI_TO_KERNEL and remove RFI
      powerpc: Replace RFI by rfi on book3s/32 and booke
      powerpc: Remove RFI macro
      powerpc: inline iomap accessors
      powerpc/feature: Use CONFIG_PPC64 instead of __powerpc64__ to define possible features
      powerpc/processor: Move cpu_relax() into asm/vdso/processor.h
      powerpc/time: Move timebase functions into new asm/vdso/timebase.h
      powerpc/vdso: Prepare for switching VDSO to generic C implementation.
      powerpc/vdso: Save and restore TOC pointer on PPC64
      powerpc/vdso: Switch VDSO to generic C implementation.
      powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32
      powerpc/signal: Move inline functions in signal.h
      powerpc/ptrace: Move declaration of ptrace_get_reg() and ptrace_set_reg()
      powerpc/ptrace: Consolidate reg index calculation
      powerpc/ptrace: Create ptrace_get_fpr() and ptrace_put_fpr()
      powerpc/signal: Don't manage floating point regs when no FPU
      powerpc/32s: Allow deselecting CONFIG_PPC_FPU on mpc832x
      powerpc/signal: Remove BUG_ON() in handler_signal functions
      powerpc/signal: Move access_ok() out of get_sigframe()
      powerpc/signal: Remove get_clean_sp()
      powerpc/signal: Call get_tm_stackpointer() from get_sigframe()
      powerpc/signal: Refactor bad frame logging
      powerpc/signal32: Simplify logging in handle_rt_signal32()
      powerpc/signal32: Move handle_signal32() close to handle_rt_signal32()
      powerpc/signal32: Rename local pointers in handle_rt_signal32()
      powerpc/signal32: Misc changes to make handle_[rt_]_signal32() more similar
      powerpc/signal32: Move signal trampoline setup to handle_[rt_]signal32
      powerpc/signal32: Switch handle_signal32() to user_access_begin() logic
      powerpc/signal32: Switch handle_rt_signal32() to user_access_begin() logic
      powerpc/signal32: Remove ifdefery in middle of if/else
      signal: Add unsafe_put_compat_sigset()
      powerpc/signal32: Add and use unsafe_put_sigset_t()
      powerpc/signal32: Switch swap_context() to user_access_begin() logic
      powerpc/signal: Create 'unsafe' versions of copy_[ck][fpr/vsx]_to_user()
      powerpc/signal32: Isolate non-copy actions in save_user_regs() and save_tm_user_regs()
      powerpc/signal32: Transform save_user_regs() and save_tm_user_regs() in 'unsafe' version
      powerpc/vdso: Stripped VDSO is not needed, don't build it
      powerpc/vdso: Add missing includes and clean vdso_setup_syscall_map()
      powerpc/vdso: Rename syscall_map_32/64 to simplify vdso_setup_syscall_map()
      powerpc/vdso: Remove get_page() in vdso_pagelist initialization
      powerpc/vdso: Remove NULL termination element in vdso_pagelist
      powerpc/vdso: Refactor 32 bits and 64 bits pages setup
      powerpc/vdso: Remove unnecessary ifdefs in vdso_pagelist initialization
      powerpc/vdso: Use VDSO size in arch_setup_additional_pages()
      powerpc/vdso: Simplify arch_setup_additional_pages() exit
      powerpc/vdso: Move to _install_special_mapping() and remove arch_vma_name()
      powerpc/vdso: Provide vdso_remap()
      powerpc/vdso: Replace vdso_base by vdso
      powerpc/vdso: Move vdso datapage up front
      powerpc/vdso: Simplify __get_datapage()
      powerpc/vdso: Remove unused \tmp param in __get_datapage()
      powerpc/vdso: Retrieve sigtramp offsets at buildtime
      powerpc/vdso: Use builtin symbols to locate fixup section
      powerpc/vdso: Merge __kernel_sync_dicache_p5() into __kernel_sync_dicache()
      powerpc/vdso: Remove vdso32_pages and vdso64_pages
      powerpc/vdso: Remove __kernel_datapage_offset
      powerpc/vdso: Remove runtime generated sigtramp offsets
      powerpc/vdso: Remove vdso_patches[] and associated functions
      powerpc/vdso: Remove unused text member in struct lib32/64_elfinfo
      powerpc/vdso: Remove symbol section information in struct lib32/64_elfinfo
      powerpc/vdso: Remove lib32_elfinfo and lib64_elfinfo
      powerpc/vdso: Remove vdso_setup()
      powerpc/vdso: Remove vdso_ready
      powerpc/vdso: Remove DBG()
      powerpc/vdso: Remove VDSO32_LBASE and VDSO64_LBASE
      powerpc/vdso: Cleanup vdso.h
      powerpc/32s: Always map kernel text and rodata with BATs
      powerpc/32s: Don't hash_preload() kernel text
      powerpc/32s: Fix an FTR_SECTION_ELSE
      powerpc/32s: Don't use SPRN_SPRG_PGDIR in hash_page
      powerpc/603: Use SPRN_SDR1 to store the pgdir phys address
      powerpc/32: Simplify EXCEPTION_PROLOG_1 macro
      powerpc/32s: Use SPRN_SPRG_SCRATCH2 in DSI prolog
      powerpc/32: Use SPRN_SPRG_SCRATCH2 in exception prologs
      powerpc/time: Remove ifdef in get_vtb()
      powerpc/mm: Fix verification of MMU_FTR_TYPE_44x
      powerpc/feature: Add CPU_FTR_NOEXECUTE to G2_LE
      powerpc/mm: Remove useless #ifndef CPU_FTR_COHERENT_ICACHE in mem.c
      powerpc/mm: MMU_FTR_NEED_DTLB_SW_LRU is only possible with CONFIG_PPC_83xx
      powerpc/mm: Desintegrate MMU_FTR_PPCAS_ARCH_V2
      powerpc/feature: Remove CPU_FTR_NODSISRALIGN
      powerpc/44x: Don't support 440 when CONFIG_PPC_47x is set
      powerpc/44x: Don't support 47x code and non 47x code at the same time
      powerpc/xmon: Change printk() to pr_cont()
      powerpc: Fix update form addressing in inline assembly
      powerpc: Retire e200 core (mpc555x processor)
      powerpc: Remove ucache_bsize
      powerpc/powermac: Fix low_sleep_handler with CONFIG_VMAP_STACK
      powerpc/mm: Add mask of always present MMU features
      powerpc/mm: Remove flush_tlb_page_nohash() prototype.
      powerpc/32s: Make bat_addrs[] static
      powerpc/32s: Use mmu_has_feature(MMU_FTR_HPTE_TABLE) instead of checking Hash var
      powerpc/32s: Make Hash var static
      powerpc/32s: Declare Hash related vars as __initdata
      powerpc/32s: Move _tlbie() and _tlbia() prototypes to tlbflush.h
      powerpc/32s: Inline _tlbie() on non SMP
      powerpc/32s: Move _tlbie() and _tlbia() in a new file
      powerpc/32s: Split and inline flush_tlb_mm() and flush_tlb_page()
      powerpc/32s: Inline flush_tlb_range() and flush_tlb_kernel_range()
      powerpc/32s: Split and inline flush_range()
      powerpc/32s: Inline tlb_flush()
      powerpc/32s: Inline flush_hash_entry()
      powerpc/32s: Move early_mmu_init() into mmu.c
      powerpc/32s: Remove CONFIG_PPC_BOOK3S_6xx
      powerpc/32s: Regroup 603 based CPUs in cputable
      powerpc/32s: Make support for 603 and 604+ selectable
      powerpc/32s: Handle PROTFAULT in hash_page() also for CONFIG_PPC_KUAP
      powerpc/8xx: Fix early debug when SMC1 is relocated
      powerpc/process: Remove target specific __set_dabr()
      powerpc/8xx: DEBUG_PAGEALLOC doesn't require an ITLB miss exception handler
      powerpc/8xx: Always pin kernel text TLB
      powerpc/8xx: Simplify INVALIDATE_ADJACENT_PAGES_CPU15
      powerpc/8xx: Use SPRN_SPRG_SCRATCH2 in ITLB miss exception
      powerpc/8xx: Use SPRN_SPRG_SCRATCH2 in DTLB miss exception
      powerpc/ppc-opcode: Add PPC_RAW_MFSPR()
      powerpc/mm: sanity_check_fault() should work for all, not only BOOK3S
      powerpc/fault: Unnest definition of page_fault_is_write() and page_fault_is_bad()
      powerpc/mm: Move the WARN() out of bad_kuap_fault()
      powerpc/fault: Avoid heavy search_exception_tables() verification
      powerpc/fault: Perform exception fixup in do_page_fault()
      powerpc/mm: Refactor the floor/ceiling check in hugetlb range freeing functions
      powerpc/32s: Remove unused counters incremented by create_hpte()
      powerpc/32s: In add_hash_page(), calculate VSID later
      powerpc/32s: Cleanup around PTE_FLAGS_OFFSET in hash_low.S
      powerpc/mm: Fix hugetlb_free_pmd_range() and hugetlb_free_pud_range()
      powerpc: force inlining of csum_partial() to avoid multiple csum_partial() with GCC10

Christophe Lombard (5):
      ocxl: Assign a register set to a Logical Partition
      ocxl: Initiate a TLB invalidate command
      ocxl: Update the Process Element Entry
      ocxl: Add mmu notifier
      ocxl: Add new kernel traces

Colin Ian King (1):
      powerpc: fix spelling mistake in Kconfig "seleted" -> "selected"

Cédric Le Goater (12):
      KVM: PPC: Book3S HV: XIVE: Show detailed configuration in debug output
      powerpc/xive: Rename XIVE_IRQ_NO_EOI to show its a flag
      powerpc/xive: Introduce XIVE_IPI_HW_IRQ
      powerpc/xive: Add a name to the IRQ domain
      powerpc/xive: Add a debug_show handler to the XIVE irq_domain
      powerpc: Increase NR_IRQS range to support more KVM guests
      powerpc/xive: Remove P9 DD1 flag XIVE_IRQ_FLAG_SHIFT_BUG
      powerpc/xive: Remove P9 DD1 flag XIVE_IRQ_FLAG_MASK_FW
      powerpc/xive: Remove P9 DD1 flag XIVE_IRQ_FLAG_EOI_FW
      powerpc/xive: Simplify xive_do_source_eoi()
      powerpc/xive: Improve error reporting of OPAL calls
      KVM: PPC: Book3S HV: XIVE: Add a comment regarding VP numbering

Daniel Axtens (3):
      powerpc/feature-fixups: use a semicolon rather than a comma
      selftests/powerpc: update .gitignore
      powerpc: add security.config, enforcing lockdown=integrity

David Hildenbrand (8):
      powerpc/powernv/memtrace: Don't leak kernel memory to user space
      powerpc/powernv/memtrace: Fix crashing the kernel when enabling concurrently
      powerpc/mm: factor out creating/removing linear mapping
      powerpc/mm: protect linear mapping modifications by a mutex
      powerpc/mm: print warning in arch_remove_linear_mapping()
      powerpc/book3s64/hash: Drop WARN_ON in hash__remove_section_mapping()
      powerpc/mm: remove linear mapping if __add_pages() fails in arch_add_memory()
      powernv/memtrace: don't abuse memory hot(un)plug infrastructure for memory allocations

Frederic Barrat (1):
      powerpc/pseries: Define PCI bus speed for Gen4 and Gen5

Ganesh Goudar (1):
      lkdtm/powerpc: Add SLB multihit test

Gautham R. Shenoy (5):
      powerpc/smp: Parse ibm,thread-groups with multiple properties
      powerpc/smp: Rename cpu_l1_cache_map as thread_group_l1_cache_map
      powerpc/smp: Rename init_thread_group_l1_cache_map() to make it generic
      powerpc/smp: Add support detecting thread-groups sharing L2 cache
      powerpc/cacheinfo: Print correct cache-sibling map/list for L2 cache

Harish (1):
      selftests/powerpc: Fix uninitialized variable warning

Jordan Niethe (6):
      powerpc/64: Set up a kernel stack for secondaries before cpu_restore()
      powerpc/64s: Convert some cpu_setup() and cpu_restore() functions to C
      powerpc/64: Fix an EMIT_BUG_ENTRY in head_64.S
      powerpc: Allow relative pointers in bug table entries
      powerpc/book3s64/kexec: Clear CIABR on kexec
      powerpc/powernv/idle: Restore CIABR after idle for Power9

Kaixu Xia (4):
      powerpc/powernv/sriov: fix unsigned int win compared to less than zero
      powerpc/mm: Fix comparing pointer to 0 warning
      KVM: PPC: Book3S: Assign boolean values to a bool variable
      KVM: PPC: fix comparison to bool warning

Laurent Dufour (1):
      powerpc/pseries/memhotplug: Quieten some DLPAR operations

Leonardo Bras (1):
      KVM: PPC: Book3S HV: Fix mask size for emulated msgsndp

Madhavan Srinivasan (2):
      powerpc/perf: Use regs->nip when SIAR is zero
      powerpc/perf: Fix Threshold Event Counter Multiplier width for P10

Mathieu Desnoyers (1):
      powerpc: Fix incorrect stw{, ux, u, x} instructions in __set_pte_at

Michael Ellerman (12):
      powerpc/85xx: Fix declaration made after definition
      powerpc/ps3: Drop unused DBG macro
      Merge branch 'fixes' into next
      powerpc: Make NUMA depend on SMP
      powerpc: Make NUMA default y for powernv
      powerpc: Update NUMA Kconfig description & help text
      powerpc/time: Fix mftb()/get_tb() for use with the compat VDSO
      powerpc/barrier: Use CONFIG_PPC64 for barrier selection
      powerpc: Inline setup_kup()
      powerpc/configs: Add ppc64le_allnoconfig target
      powerpc: Add config fragment for disabling -Werror
      powerpc/32s: Fix cleanup_cpu_mmu_context() compile bug

Nathan Lynch (28):
      powerpc/rtas: prevent suspend-related sys_rtas use on LE
      powerpc/rtas: complete ibm,suspend-me status codes
      powerpc/rtas: rtas_ibm_suspend_me -> rtas_ibm_suspend_me_unsafe
      powerpc/rtas: add rtas_ibm_suspend_me()
      powerpc/rtas: add rtas_activate_firmware()
      powerpc/hvcall: add token and codes for H_VASI_SIGNAL
      powerpc/pseries/mobility: don't error on absence of ibm, update-nodes
      powerpc/pseries/mobility: add missing break to default case
      powerpc/pseries/mobility: error message improvements
      powerpc/pseries/mobility: use rtas_activate_firmware() on resume
      powerpc/pseries/mobility: extract VASI session polling logic
      powerpc/pseries/mobility: use stop_machine for join/suspend
      powerpc/pseries/mobility: signal suspend cancellation to platform
      powerpc/pseries/mobility: retry partition suspend after error
      powerpc/rtas: dispatch partition migration requests to pseries
      powerpc/rtas: remove rtas_ibm_suspend_me_unsafe()
      powerpc/pseries/hibernation: drop pseries_suspend_begin() from suspend ops
      powerpc/pseries/hibernation: pass stream id via function arguments
      powerpc/pseries/hibernation: remove pseries_suspend_cpu()
      powerpc/machdep: remove suspend_disable_cpu()
      powerpc/rtas: remove rtas_suspend_cpu()
      powerpc/pseries/hibernation: switch to rtas_ibm_suspend_me()
      powerpc/rtas: remove unused rtas_suspend_last_cpu()
      powerpc/pseries/hibernation: remove redundant cacheinfo update
      powerpc/pseries/hibernation: perform post-suspend fixups later
      powerpc/pseries/hibernation: remove prepare_late() callback
      powerpc/rtas: remove unused rtas_suspend_me_data
      powerpc/pseries/mobility: refactor node lookup during DT update

Nicholas Piggin (13):
      powerpc/64s/perf: perf interrupt does not have to get_user_pages to access user memory
      powerpc: show registers when unwinding interrupt frames
      powerpc/64s/powernv: Allow KVM to handle guest machine check details
      KVM: PPC: Book3S HV: Don't attempt to recover machine checks for FWNMI enabled guests
      KVM: PPC: Book3S HV: Ratelimit machine check messages coming from guests
      powerpc/64s/powernv: Ratelimit harmless HMI error printing
      powerpc/64s/pseries: Add ERAT specific machine check handler
      powerpc/64s: Remove "Host" from MCE logging
      powerpc/64s: Tidy machine check SLB logging
      powerpc/64s/iommu: Don't use atomic_ function on atomic64_t type
      powerpc/64s: Remove MSR[ISF] bit
      powerpc/64: irq replay remove decrementer overflow check
      powerpc/64s: Remove idle workaround code from restore_cpu_cpufeatures

Oleg Nesterov (2):
      powerpc/ptrace: Simplify gpr_get()/tm_cgpr_get()
      powerpc/ptrace: Hard wire PT_SOFTE value to 1 in gpr_get() too

Oliver O'Halloran (2):
      powerpc/pci: Remove LSI mappings on device teardown
      powernv/pci: Print an error when device enable is blocked

Po-Hsu Lin (1):
      selftests/powerpc/eeh: disable kselftest timeout setting for eeh-basic

Qinglang Miao (1):
      powerpc: sysdev: add missing iounmap() on error in mpic_msgr_probe()

Ravi Bangoria (3):
      powerpc/xmon: Fix build failure for 8xx
      powerpc/sstep: Cover new VSX instructions under CONFIG_VSX
      powerpc/watchpoint: Workaround P10 DD1 issue with VSX-32 byte instructions

Srikar Dronamraju (4):
      powerpc: Refactor is_kvm_guest() declaration to new header
      powerpc: Rename is_kvm_guest() to check_kvm_guest()
      powerpc: Reintroduce is_kvm_guest() as a fast-path check
      powerpc/paravirt: Use is_kvm_guest() in vcpu_is_preempted()

Tyrel Datwyler (1):
      powerpc/rtas: Fix typo of ibm,open-errinjct in RTAS filter

Uwe Kleine-König (2):
      ALSA: ppc: drop if block with always false condition
      powerpc/ps3: make system bus's remove and shutdown callbacks return void

Vincent Stehlé (1):
      powerpc/ps3: use dma_mapping_error()

Youling Tang (2):
      powerpc: Use the common INIT_DATA_SECTION macro in vmlinux.lds.S
      powerpc: Use common STABS_DEBUG and DWARF_DEBUG and ELF_DETAILS macro

Zhang Xiaoxu (1):
      Revert "powerpc/pseries/hotplug-cpu: Remove double free in error path"


 arch/powerpc/Kconfig                                |  26 +-
 arch/powerpc/Makefile                               |  29 +-
 arch/powerpc/boot/Makefile                          |   4 +
 arch/powerpc/boot/ps3.c                             |   7 -
 arch/powerpc/boot/util.S                            |   9 +-
 arch/powerpc/boot/wrapper                           |   6 +-
 arch/powerpc/boot/zImage.lds.S                      |  21 +-
 arch/powerpc/configs/disable-werror.config          |   1 +
 arch/powerpc/configs/ppc64le.config                 |   2 +
 arch/powerpc/configs/security.config                |  15 +
 arch/powerpc/include/asm/atomic.h                   |   9 +-
 arch/powerpc/include/asm/barrier.h                  |   2 +-
 arch/powerpc/include/asm/bitops.h                   |  23 +-
 arch/powerpc/include/asm/book3s/32/kup.h            |   6 +-
 arch/powerpc/include/asm/book3s/32/mmu-hash.h       |   3 +-
 arch/powerpc/include/asm/book3s/32/pgtable.h        |  21 +-
 arch/powerpc/include/asm/book3s/32/tlbflush.h       |  69 +-
 arch/powerpc/include/asm/book3s/64/hash-pkey.h      |  25 +-
 arch/powerpc/include/asm/book3s/64/hash.h           |   2 +-
 arch/powerpc/include/asm/book3s/64/kexec.h          |   5 +
 arch/powerpc/include/asm/book3s/64/kup-radix.h      | 205 ------
 arch/powerpc/include/asm/book3s/64/kup.h            | 442 +++++++++++++
 arch/powerpc/include/asm/book3s/64/mmu-hash.h       |  29 +-
 arch/powerpc/include/asm/book3s/64/mmu.h            |   4 +-
 arch/powerpc/include/asm/book3s/64/pgtable.h        |  17 +-
 arch/powerpc/include/asm/book3s/64/pkeys.h          |   2 +
 arch/powerpc/include/asm/bug.h                      |   9 +-
 arch/powerpc/include/asm/checksum.h                 |   2 +-
 arch/powerpc/include/asm/clocksource.h              |   7 +
 arch/powerpc/include/asm/cpm1.h                     |   1 +
 arch/powerpc/include/asm/cpu_setup_power.h          |  12 +
 arch/powerpc/include/asm/cputable.h                 |  76 +--
 arch/powerpc/include/asm/elf.h                      |   4 +-
 arch/powerpc/include/asm/feature-fixups.h           |  25 +-
 arch/powerpc/include/asm/firmware.h                 |   6 -
 arch/powerpc/include/asm/hvcall.h                   |   9 +
 arch/powerpc/include/asm/io.h                       | 158 ++++-
 arch/powerpc/include/asm/kup.h                      |  15 +-
 arch/powerpc/include/asm/kvm_guest.h                |  25 +
 arch/powerpc/include/asm/kvm_para.h                 |   2 +-
 arch/powerpc/include/asm/machdep.h                  |   1 -
 arch/powerpc/include/asm/mce.h                      |   1 +
 arch/powerpc/include/asm/mm-arch-hooks.h            |  25 -
 arch/powerpc/include/asm/mmu.h                      |  71 +-
 arch/powerpc/include/asm/mmu_context.h              |   8 +-
 arch/powerpc/include/asm/nohash/32/kup-8xx.h        |   3 +-
 arch/powerpc/include/asm/nohash/32/mmu-40x.h        |   2 +-
 arch/powerpc/include/asm/nohash/32/mmu-44x.h        |   2 +-
 arch/powerpc/include/asm/nohash/32/mmu-8xx.h        |   2 +-
 arch/powerpc/include/asm/nohash/mmu-book3e.h        |   2 +-
 arch/powerpc/include/asm/nohash/pgtable.h           |   4 +-
 arch/powerpc/include/asm/nohash/tlbflush.h          |   1 -
 arch/powerpc/include/asm/opal-api.h                 |   6 +-
 arch/powerpc/include/asm/page_32.h                  |   6 -
 arch/powerpc/include/asm/paravirt.h                 |  18 +
 arch/powerpc/include/asm/perf_event_server.h        |   1 +
 arch/powerpc/include/asm/pnv-ocxl.h                 |  54 ++
 arch/powerpc/include/asm/ppc-opcode.h               |  16 +-
 arch/powerpc/include/asm/ppc_asm.h                  |   8 +-
 arch/powerpc/include/asm/processor.h                |  33 +-
 arch/powerpc/include/asm/ps3.h                      |   4 +-
 arch/powerpc/include/asm/ptrace.h                   |  18 +-
 arch/powerpc/include/asm/reg.h                      |  44 +-
 arch/powerpc/include/asm/reg_booke.h                |  12 -
 arch/powerpc/include/asm/rtas-types.h               |   8 -
 arch/powerpc/include/asm/rtas.h                     |  17 +-
 arch/powerpc/include/asm/smp.h                      |   6 +
 arch/powerpc/include/asm/thread_info.h              |   2 -
 arch/powerpc/include/asm/time.h                     |  33 +-
 arch/powerpc/include/asm/timex.h                    |   2 +-
 arch/powerpc/include/asm/tlb.h                      |   3 -
 arch/powerpc/include/asm/vdso.h                     |  29 +-
 arch/powerpc/include/asm/vdso/clocksource.h         |   7 +
 arch/powerpc/include/asm/vdso/gettimeofday.h        | 201 ++++++
 arch/powerpc/include/asm/vdso/processor.h           |  23 +
 arch/powerpc/include/asm/vdso/timebase.h            |  79 +++
 arch/powerpc/include/asm/vdso/vsyscall.h            |  25 +
 arch/powerpc/include/asm/vdso_datapage.h            |  57 +-
 arch/powerpc/include/asm/xive.h                     |   8 +-
 arch/powerpc/kernel/Makefile                        |   3 +
 arch/powerpc/kernel/asm-offsets.c                   |  58 +-
 arch/powerpc/kernel/cacheinfo.c                     |  30 +-
 arch/powerpc/kernel/cpu_setup_fsl_booke.S           |   9 -
 arch/powerpc/kernel/cpu_setup_power.S               | 252 -------
 arch/powerpc/kernel/cpu_setup_power.c               | 272 ++++++++
 arch/powerpc/kernel/cputable.c                      | 175 ++---
 arch/powerpc/kernel/dt_cpu_ftrs.c                   |  31 +-
 arch/powerpc/kernel/entry_32.S                      |  49 +-
 arch/powerpc/kernel/entry_64.S                      |   8 +-
 arch/powerpc/kernel/exceptions-64e.S                |   2 +-
 arch/powerpc/kernel/exceptions-64s.S                |   6 +-
 arch/powerpc/kernel/firmware.c                      |  11 +-
 arch/powerpc/kernel/head_32.h                       |  37 +-
 arch/powerpc/kernel/head_64.S                       |  22 +-
 arch/powerpc/kernel/head_8xx.S                      |  59 +-
 arch/powerpc/kernel/head_book3s_32.S                |  96 +--
 arch/powerpc/kernel/head_booke.h                    |   5 +-
 arch/powerpc/kernel/head_fsl_booke.S                |  57 +-
 arch/powerpc/kernel/hw_breakpoint.c                 |  67 +-
 arch/powerpc/kernel/iomap.c                         | 166 -----
 arch/powerpc/kernel/irq.c                           |  53 +-
 arch/powerpc/kernel/mce.c                           |   4 +-
 arch/powerpc/kernel/mce_power.c                     |  98 +--
 arch/powerpc/kernel/paca.c                          |   4 +-
 arch/powerpc/kernel/pci-common.c                    |  82 ++-
 arch/powerpc/kernel/process.c                       | 108 +--
 arch/powerpc/kernel/prom.c                          |   1 -
 arch/powerpc/kernel/ptrace/Makefile                 |   3 +-
 arch/powerpc/kernel/ptrace/ptrace-decl.h            |  21 +
 arch/powerpc/kernel/ptrace/ptrace-fpu.c             |  40 ++
 arch/powerpc/kernel/ptrace/ptrace-tm.c              |  19 +-
 arch/powerpc/kernel/ptrace/ptrace-view.c            |  26 +-
 arch/powerpc/kernel/ptrace/ptrace.c                 |  54 +-
 arch/powerpc/kernel/ptrace/ptrace32.c               |   2 +
 arch/powerpc/kernel/rtas.c                          | 245 +++----
 arch/powerpc/kernel/setup-common.c                  |   8 +-
 arch/powerpc/kernel/setup.h                         |   6 -
 arch/powerpc/kernel/setup_32.c                      |   3 -
 arch/powerpc/kernel/setup_64.c                      |   2 +-
 arch/powerpc/kernel/signal.c                        |  59 +-
 arch/powerpc/kernel/signal.h                        | 115 +++-
 arch/powerpc/kernel/signal_32.c                     | 602 +++++++++--------
 arch/powerpc/kernel/signal_64.c                     |  25 +-
 arch/powerpc/kernel/smp.c                           | 241 +++++--
 arch/powerpc/kernel/syscall_64.c                    |  38 +-
 arch/powerpc/kernel/time.c                          | 100 +--
 arch/powerpc/kernel/traps.c                         |  33 +-
 arch/powerpc/kernel/vdso.c                          | 688 +++-----------------
 arch/powerpc/kernel/vdso32/Makefile                 |  53 +-
 arch/powerpc/kernel/vdso32/cacheflush.S             |  19 +-
 arch/powerpc/kernel/vdso32/datapage.S               |   7 +-
 arch/powerpc/kernel/vdso32/gen_vdso_offsets.sh      |  16 +
 arch/powerpc/kernel/vdso32/gettimeofday.S           | 300 +--------
 arch/powerpc/kernel/vdso32/vdso32.lds.S             |  68 +-
 arch/powerpc/kernel/vdso32/vgettimeofday.c          |  34 +
 arch/powerpc/kernel/vdso64/Makefile                 |  48 +-
 arch/powerpc/kernel/vdso64/cacheflush.S             |  18 +-
 arch/powerpc/kernel/vdso64/datapage.S               |   7 +-
 arch/powerpc/kernel/vdso64/gen_vdso_offsets.sh      |  16 +
 arch/powerpc/kernel/vdso64/gettimeofday.S           | 242 +------
 arch/powerpc/kernel/vdso64/vdso64.lds.S             |  67 +-
 arch/powerpc/kernel/vdso64/vgettimeofday.c          |  29 +
 arch/powerpc/kernel/vmlinux.lds.S                   |  19 +-
 arch/powerpc/kvm/book3s_emulate.c                   |   6 +
 arch/powerpc/kvm/book3s_hv.c                        |  33 +-
 arch/powerpc/kvm/book3s_hv_builtin.c                |  11 +-
 arch/powerpc/kvm/book3s_hv_ras.c                    |  23 +-
 arch/powerpc/kvm/book3s_pr.c                        |   2 +-
 arch/powerpc/kvm/book3s_rmhandlers.S                |   4 +-
 arch/powerpc/kvm/book3s_xics.c                      |   4 +-
 arch/powerpc/kvm/book3s_xive.c                      | 134 ++--
 arch/powerpc/kvm/book3s_xive.h                      |  13 +
 arch/powerpc/kvm/book3s_xive_native.c               |  24 +-
 arch/powerpc/kvm/book3s_xive_template.c             |   5 -
 arch/powerpc/kvm/booke.c                            |   6 +-
 arch/powerpc/kvm/powerpc.c                          |   4 +-
 arch/powerpc/lib/feature-fixups.c                   |   8 +-
 arch/powerpc/lib/sstep.c                            | 160 ++++-
 arch/powerpc/lib/test_emulate_step.c                | 270 ++++++++
 arch/powerpc/mm/book3s32/Makefile                   |   2 +-
 arch/powerpc/mm/book3s32/hash_low.S                 | 169 +----
 arch/powerpc/mm/book3s32/mmu.c                      |  30 +-
 arch/powerpc/mm/book3s32/nohash_low.S               |  80 +++
 arch/powerpc/mm/book3s32/tlb.c                      |  89 +--
 arch/powerpc/mm/book3s64/Makefile                   |   2 +-
 arch/powerpc/mm/book3s64/hash_4k.c                  |   2 +-
 arch/powerpc/mm/book3s64/hash_64k.c                 |   4 +-
 arch/powerpc/mm/book3s64/hash_hugepage.c            |   2 +-
 arch/powerpc/mm/book3s64/hash_hugetlbpage.c         |   2 +-
 arch/powerpc/mm/book3s64/hash_pgtable.c             |   2 +-
 arch/powerpc/mm/book3s64/hash_utils.c               |  12 +-
 arch/powerpc/mm/book3s64/iommu_api.c                |   2 +-
 arch/powerpc/mm/book3s64/pgtable.c                  |   8 +-
 arch/powerpc/mm/book3s64/pkeys.c                    | 151 +++--
 arch/powerpc/mm/book3s64/radix_pgtable.c            |  45 +-
 arch/powerpc/mm/book3s64/radix_tlb.c                |  23 +-
 arch/powerpc/mm/book3s64/slb.c                      |  66 +-
 arch/powerpc/mm/fault.c                             |  79 ++-
 arch/powerpc/mm/hugetlbpage.c                       |  64 +-
 arch/powerpc/mm/init-common.c                       |  10 +-
 arch/powerpc/mm/mem.c                               |  60 +-
 arch/powerpc/mm/mmu_decl.h                          |   6 -
 arch/powerpc/mm/nohash/8xx.c                        |   3 +-
 arch/powerpc/mm/nohash/fsl_booke.c                  |  12 +-
 arch/powerpc/mm/nohash/tlb_low.S                    |  29 +-
 arch/powerpc/mm/pgtable_32.c                        |   6 +-
 arch/powerpc/perf/8xx-pmu.c                         |  16 +-
 arch/powerpc/perf/callchain.h                       |   2 +-
 arch/powerpc/perf/callchain_32.c                    |   8 +-
 arch/powerpc/perf/callchain_64.c                    |   7 +-
 arch/powerpc/perf/core-book3s.c                     |  65 +-
 arch/powerpc/perf/isa207-common.c                   |  38 +-
 arch/powerpc/perf/isa207-common.h                   |  20 +-
 arch/powerpc/perf/power10-events-list.h             |   9 +
 arch/powerpc/perf/power10-pmu.c                     | 184 +++++-
 arch/powerpc/platforms/85xx/corenet_generic.c       |   3 +-
 arch/powerpc/platforms/8xx/Kconfig                  |   7 -
 arch/powerpc/platforms/8xx/micropatch.c             |  11 +
 arch/powerpc/platforms/Kconfig.cputype              |  57 +-
 arch/powerpc/platforms/powermac/sleep.S             | 132 ++--
 arch/powerpc/platforms/powernv/Kconfig              |   8 +-
 arch/powerpc/platforms/powernv/idle.c               |   3 +
 arch/powerpc/platforms/powernv/memtrace.c           | 175 +++--
 arch/powerpc/platforms/powernv/npu-dma.c            |  16 +-
 arch/powerpc/platforms/powernv/ocxl.c               | 114 ++++
 arch/powerpc/platforms/powernv/opal-elog.c          |   4 +-
 arch/powerpc/platforms/powernv/opal-hmi.c           |  29 +-
 arch/powerpc/platforms/powernv/opal.c               |   2 +-
 arch/powerpc/platforms/powernv/pci-ioda.c           |   4 +-
 arch/powerpc/platforms/powernv/pci-sriov.c          |   2 +-
 arch/powerpc/platforms/ps3/system-bus.c             |   5 +-
 arch/powerpc/platforms/pseries/hotplug-cpu.c        |   1 +
 arch/powerpc/platforms/pseries/hotplug-memory.c     |  12 +-
 arch/powerpc/platforms/pseries/mobility.c           | 358 ++++++++--
 arch/powerpc/platforms/pseries/pci.c                |  51 +-
 arch/powerpc/platforms/pseries/ras.c                |   5 +-
 arch/powerpc/platforms/pseries/smp.c                |   3 +-
 arch/powerpc/platforms/pseries/suspend.c            |  79 +--
 arch/powerpc/sysdev/mpic_msgr.c                     |   2 +-
 arch/powerpc/sysdev/xive/common.c                   | 207 +++---
 arch/powerpc/sysdev/xive/native.c                   |  46 +-
 arch/powerpc/sysdev/xive/spapr.c                    |   8 +-
 arch/powerpc/sysdev/xive/xive-internal.h            |   7 +-
 arch/powerpc/xmon/nonstdio.c                        |   2 +-
 arch/powerpc/xmon/xmon.c                            |   6 +-
 drivers/block/ps3disk.c                             |   3 +-
 drivers/block/ps3vram.c                             |   3 +-
 drivers/char/ps3flash.c                             |   3 +-
 drivers/misc/lkdtm/Makefile                         |   1 +
 drivers/misc/lkdtm/core.c                           |   3 +
 drivers/misc/lkdtm/lkdtm.h                          |   3 +
 drivers/misc/lkdtm/powerpc.c                        | 120 ++++
 drivers/misc/ocxl/context.c                         |   4 +-
 drivers/misc/ocxl/link.c                            |  70 +-
 drivers/misc/ocxl/ocxl_internal.h                   |   9 +-
 drivers/misc/ocxl/trace.h                           |  64 ++
 drivers/net/ethernet/toshiba/ps3_gelic_net.c        |   3 +-
 drivers/ps3/ps3-lpm.c                               |   3 +-
 drivers/ps3/ps3-vuart.c                             |  10 +-
 drivers/ps3/ps3stor_lib.c                           |   2 +-
 drivers/scsi/cxlflash/ocxl_hw.c                     |   6 +-
 drivers/scsi/ps3rom.c                               |   3 +-
 drivers/usb/host/ehci-ps3.c                         |   4 +-
 drivers/usb/host/ohci-ps3.c                         |   4 +-
 drivers/video/fbdev/ps3fb.c                         |   4 +-
 include/linux/compat.h                              |  32 +
 include/linux/memory_hotplug.h                      |   3 +
 include/linux/regset.h                              |  12 +
 include/misc/ocxl.h                                 |   2 +-
 sound/ppc/snd_ps3.c                                 |   3 +-
 tools/testing/selftests/lkdtm/tests.txt             |   1 +
 tools/testing/selftests/powerpc/eeh/Makefile        |   2 +-
 tools/testing/selftests/powerpc/eeh/settings        |   1 +
 tools/testing/selftests/powerpc/mm/bad_accesses.c   |   2 +-
 tools/testing/selftests/powerpc/nx-gzip/.gitignore  |   3 +
 tools/testing/selftests/powerpc/security/.gitignore |   1 +
 tools/testing/selftests/powerpc/signal/.gitignore   |   1 +
 tools/testing/selftests/powerpc/syscalls/.gitignore |   1 +
 258 files changed, 6011 insertions(+), 4965 deletions(-)
 create mode 100644 arch/powerpc/configs/disable-werror.config
 create mode 100644 arch/powerpc/configs/ppc64le.config
 create mode 100644 arch/powerpc/configs/security.config
 delete mode 100644 arch/powerpc/include/asm/book3s/64/kup-radix.h
 create mode 100644 arch/powerpc/include/asm/book3s/64/kup.h
 create mode 100644 arch/powerpc/include/asm/clocksource.h
 create mode 100644 arch/powerpc/include/asm/cpu_setup_power.h
 create mode 100644 arch/powerpc/include/asm/kvm_guest.h
 delete mode 100644 arch/powerpc/include/asm/mm-arch-hooks.h
 create mode 100644 arch/powerpc/include/asm/vdso/clocksource.h
 create mode 100644 arch/powerpc/include/asm/vdso/gettimeofday.h
 create mode 100644 arch/powerpc/include/asm/vdso/processor.h
 create mode 100644 arch/powerpc/include/asm/vdso/timebase.h
 create mode 100644 arch/powerpc/include/asm/vdso/vsyscall.h
 delete mode 100644 arch/powerpc/kernel/cpu_setup_power.S
 create mode 100644 arch/powerpc/kernel/cpu_setup_power.c
 create mode 100644 arch/powerpc/kernel/ptrace/ptrace-fpu.c
 create mode 100755 arch/powerpc/kernel/vdso32/gen_vdso_offsets.sh
 create mode 100644 arch/powerpc/kernel/vdso32/vgettimeofday.c
 create mode 100755 arch/powerpc/kernel/vdso64/gen_vdso_offsets.sh
 create mode 100644 arch/powerpc/kernel/vdso64/vgettimeofday.c
 create mode 100644 arch/powerpc/mm/book3s32/nohash_low.S
 create mode 100644 drivers/misc/lkdtm/powerpc.c
 create mode 100644 tools/testing/selftests/powerpc/eeh/settings
 create mode 100644 tools/testing/selftests/powerpc/nx-gzip/.gitignore
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAl/bW0UACgkQUevqPMjh
pYCkXg//TIbruNsuWQ1NF0Qg/o6r6Rw0meQ04fi1iqNvlg0q5IrAKaR4He75+i2R
foZZTStXZ/GZ1a8XdVjxPUBfgfXmbAtMucu8233EXLGvQ/z4G91OLRL1Rjml/DxD
GAbr+TGV2qZZZUHb+Bnefr1cDXbOgB+EArrb1pE3NFYQWBZCbgd/bq0aIUwpBX8a
ef7R9XtdRp5WowgU3ZX1SlQhY6obXz5Xuqz4K1k5rrl477K7BQCjqnD4jmmU33nI
UK5adRdNk/Fce4CTx/CxsaH197geeF3604j5qOUZdBhMhWeAHXKndigolaYgZNEg
sjlhJ7zSxXBC7vHK5fS6IeTI2dlZBnv63g6STHzj7MhGiaoZ9ETTYzF8Qlzl7Bg2
icx/KOt3bc09NYpqsiGQ1Hr8HbK5Nq+3DufYm1wFvk9ngOrPhCPnPk69wv1e6rlX
R5E7D7WIsNroiNNMsx5mfQIsU2ZScy+GLFK4EBr5I2sJfqiZULijmOnBdPRVaU1Q
p2yrw93ji2De+C5BsYq1YOPK6reDXXJjjye54C/7RyPg5zEmjUP40fLHU98n/ZPY
QDwj6uCQLTfYJ1INRt53FKvefFm6Y+EKB+9G/lC+7w4gne2WTLPRRl0go9jwEqba
4hShAIonoXq0UwcM2fNZRa6JfD0yJwqWjzHRghnMeNaXr6AgATU=
=LHXh
-----END PGP SIGNATURE-----

^ permalink raw reply

* [PATCH 0/7] powerpc/64s: TLB flushing improvements
From: Nicholas Piggin @ 2020-12-17 13:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

Another round of reducing TLB flushing (mostly on radix).

Thanks,
Nick

Nicholas Piggin (7):
  powerpc/64s/radix: add warning and comments in mm_cpumask trim
  powerpc/64s/radix: refactor TLB flush type selection
  powerpc/64s/radix: Check for no TLB flush required
  powerpc/64s/radix: Allow mm_cpumask trimming from external sources
  powerpc/64s/radix: occasionally attempt to trim mm_cpumask
  powerpc/64s/radix: serialize_against_pte_lookup IPIs trim mm_cpumask
  powerpc/64s: Implement ptep_clear_flush_young that does not flush TLBs

 arch/powerpc/include/asm/book3s/64/pgtable.h |  23 +-
 arch/powerpc/mm/book3s64/pgtable.c           |  13 +-
 arch/powerpc/mm/book3s64/radix_tlb.c         | 297 ++++++++++++-------
 3 files changed, 225 insertions(+), 108 deletions(-)

-- 
2.23.0


^ permalink raw reply

* [PATCH 1/7] powerpc/64s/radix: add warning and comments in mm_cpumask trim
From: Nicholas Piggin @ 2020-12-17 13:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin
In-Reply-To: <20201217134731.488135-1-npiggin@gmail.com>

Add a comment explaining part of the logic for mm_cpumask trimming, and
add a (hopefully graceful) check and warning in case something gets it
wrong.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/mm/book3s64/radix_tlb.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
index b487b489d4b6..5f09e0cd0016 100644
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
@@ -644,13 +644,14 @@ static void do_exit_flush_lazy_tlb(void *arg)
 {
 	struct mm_struct *mm = arg;
 	unsigned long pid = mm->context.id;
+	int cpu = smp_processor_id();
 
 	/*
 	 * A kthread could have done a mmget_not_zero() after the flushing CPU
-	 * checked mm_is_singlethreaded, and be in the process of
-	 * kthread_use_mm when interrupted here. In that case, current->mm will
-	 * be set to mm, because kthread_use_mm() setting ->mm and switching to
-	 * the mm is done with interrupts off.
+	 * checked mm_cpumask, and be in the process of kthread_use_mm when
+	 * interrupted here. In that case, current->mm will be set to mm,
+	 * because kthread_use_mm() setting ->mm and switching to the mm is
+	 * done with interrupts off.
 	 */
 	if (current->mm == mm)
 		goto out_flush;
@@ -664,8 +665,22 @@ static void do_exit_flush_lazy_tlb(void *arg)
 		mmdrop(mm);
 	}
 
-	atomic_dec(&mm->context.active_cpus);
-	cpumask_clear_cpu(smp_processor_id(), mm_cpumask(mm));
+	/*
+	 * This IPI is only initiated from a CPU which is running mm which
+	 * is a single-threaded process, so there will not be another racing
+	 * IPI coming in where we would find our cpumask already clear.
+	 *
+	 * Nothing else clears our bit in the cpumask except CPU offlining,
+	 * in which case we should not be taking IPIs here. However check
+	 * this just in case the logic is wrong somewhere, and don't underflow
+	 * the active_cpus count.
+	 */
+	if (cpumask_test_cpu(cpu, mm_cpumask(mm))) {
+		atomic_dec(&mm->context.active_cpus);
+		cpumask_clear_cpu(cpu, mm_cpumask(mm));
+	} else {
+		WARN_ON_ONCE(1);
+	}
 
 out_flush:
 	_tlbiel_pid(pid, RIC_FLUSH_ALL);
-- 
2.23.0


^ permalink raw reply related

* [PATCH 2/7] powerpc/64s/radix: refactor TLB flush type selection
From: Nicholas Piggin @ 2020-12-17 13:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin
In-Reply-To: <20201217134731.488135-1-npiggin@gmail.com>

The logic to decide what kind of TLB flush is required (local, global,
or IPI) is spread multiple times over the several kinds of TLB flushes.

Move it all into a single function which may issue IPIs if necessary,
and also returns a flush type that is to be used.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/mm/book3s64/radix_tlb.c | 176 ++++++++++++++-------------
 1 file changed, 94 insertions(+), 82 deletions(-)

diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
index 5f09e0cd0016..12481c864ab6 100644
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
@@ -618,15 +618,6 @@ void radix__local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmadd
 }
 EXPORT_SYMBOL(radix__local_flush_tlb_page);
 
-static bool mm_is_singlethreaded(struct mm_struct *mm)
-{
-	if (atomic_read(&mm->context.copros) > 0)
-		return false;
-	if (atomic_read(&mm->mm_users) <= 1 && current->mm == mm)
-		return true;
-	return false;
-}
-
 static bool mm_needs_flush_escalation(struct mm_struct *mm)
 {
 	/*
@@ -698,10 +689,58 @@ static void exit_flush_lazy_tlbs(struct mm_struct *mm)
 	smp_call_function_many(mm_cpumask(mm), do_exit_flush_lazy_tlb,
 				(void *)mm, 1);
 }
+#else /* CONFIG_SMP */
+static inline void exit_flush_lazy_tlbs(struct mm_struct *mm) { }
+#endif /* CONFIG_SMP */
+
+enum tlb_flush_type {
+	FLUSH_TYPE_LOCAL,
+	FLUSH_TYPE_GLOBAL,
+};
+
+static enum tlb_flush_type flush_type_needed(struct mm_struct *mm, bool fullmm)
+{
+	if (mm_is_thread_local(mm))
+		return FLUSH_TYPE_LOCAL;
+
+	/* Coprocessors require TLBIE to invalidate nMMU. */
+	if (atomic_read(&mm->context.copros) > 0)
+		return FLUSH_TYPE_GLOBAL;
+
+	/*
+	 * In the fullmm case there's no point doing the exit_flush_lazy_tlbs
+	 * because the mm is being taken down anyway, and a TLBIE tends to
+	 * be faster than an IPI+TLBIEL.
+	 */
+	if (fullmm)
+		return FLUSH_TYPE_GLOBAL;
+
+	/*
+	 * If we are running the only thread of a single-threaded process,
+	 * then we should almost always be able to trim off the rest of the
+	 * CPU mask (except in the case of use_mm() races), so always try
+	 * trimming the mask.
+	 */
+	if (atomic_read(&mm->mm_users) <= 1 && current->mm == mm) {
+		exit_flush_lazy_tlbs(mm);
+		/*
+		 * use_mm() race could prevent IPIs from being able to clear
+		 * the cpumask here, however those users are established
+		 * after our first check (and so after the PTEs are removed),
+		 * and the TLB still gets flushed by the IPI, so this CPU
+		 * will only require a local flush.
+		 */
+		return FLUSH_TYPE_LOCAL;
+	}
+
+	return FLUSH_TYPE_GLOBAL;
+}
 
+#ifdef CONFIG_SMP
 void radix__flush_tlb_mm(struct mm_struct *mm)
 {
 	unsigned long pid;
+	enum tlb_flush_type type;
 
 	pid = mm->context.id;
 	if (unlikely(pid == MMU_NO_CONTEXT))
@@ -709,16 +748,13 @@ void radix__flush_tlb_mm(struct mm_struct *mm)
 
 	preempt_disable();
 	/*
-	 * Order loads of mm_cpumask vs previous stores to clear ptes before
-	 * the invalidate. See barrier in switch_mm_irqs_off
+	 * Order loads of mm_cpumask (in flush_type_needed) vs previous
+	 * stores to clear ptes before the invalidate. See barrier in
+	 * switch_mm_irqs_off
 	 */
 	smp_mb();
-	if (!mm_is_thread_local(mm)) {
-		if (unlikely(mm_is_singlethreaded(mm))) {
-			exit_flush_lazy_tlbs(mm);
-			goto local;
-		}
-
+	type = flush_type_needed(mm, false);
+	if (type == FLUSH_TYPE_GLOBAL) {
 		if (!mmu_has_feature(MMU_FTR_GTSE)) {
 			unsigned long tgt = H_RPTI_TARGET_CMMU;
 
@@ -735,7 +771,6 @@ void radix__flush_tlb_mm(struct mm_struct *mm)
 			_tlbiel_pid_multicast(mm, pid, RIC_FLUSH_TLB);
 		}
 	} else {
-local:
 		_tlbiel_pid(pid, RIC_FLUSH_TLB);
 	}
 	preempt_enable();
@@ -745,6 +780,7 @@ EXPORT_SYMBOL(radix__flush_tlb_mm);
 static void __flush_all_mm(struct mm_struct *mm, bool fullmm)
 {
 	unsigned long pid;
+	enum tlb_flush_type type;
 
 	pid = mm->context.id;
 	if (unlikely(pid == MMU_NO_CONTEXT))
@@ -752,13 +788,8 @@ static void __flush_all_mm(struct mm_struct *mm, bool fullmm)
 
 	preempt_disable();
 	smp_mb(); /* see radix__flush_tlb_mm */
-	if (!mm_is_thread_local(mm)) {
-		if (unlikely(mm_is_singlethreaded(mm))) {
-			if (!fullmm) {
-				exit_flush_lazy_tlbs(mm);
-				goto local;
-			}
-		}
+	type = flush_type_needed(mm, fullmm);
+	if (type == FLUSH_TYPE_GLOBAL) {
 		if (!mmu_has_feature(MMU_FTR_GTSE)) {
 			unsigned long tgt = H_RPTI_TARGET_CMMU;
 			unsigned long type = H_RPTI_TYPE_TLB | H_RPTI_TYPE_PWC |
@@ -773,7 +804,6 @@ static void __flush_all_mm(struct mm_struct *mm, bool fullmm)
 		else
 			_tlbiel_pid_multicast(mm, pid, RIC_FLUSH_ALL);
 	} else {
-local:
 		_tlbiel_pid(pid, RIC_FLUSH_ALL);
 	}
 	preempt_enable();
@@ -789,6 +819,7 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
 				 int psize)
 {
 	unsigned long pid;
+	enum tlb_flush_type type;
 
 	pid = mm->context.id;
 	if (unlikely(pid == MMU_NO_CONTEXT))
@@ -796,11 +827,8 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
 
 	preempt_disable();
 	smp_mb(); /* see radix__flush_tlb_mm */
-	if (!mm_is_thread_local(mm)) {
-		if (unlikely(mm_is_singlethreaded(mm))) {
-			exit_flush_lazy_tlbs(mm);
-			goto local;
-		}
+	type = flush_type_needed(mm, false);
+	if (type == FLUSH_TYPE_GLOBAL) {
 		if (!mmu_has_feature(MMU_FTR_GTSE)) {
 			unsigned long tgt, pg_sizes, size;
 
@@ -818,7 +846,6 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
 		else
 			_tlbiel_va_multicast(mm, vmaddr, pid, psize, RIC_FLUSH_TLB);
 	} else {
-local:
 		_tlbiel_va(vmaddr, pid, psize, RIC_FLUSH_TLB);
 	}
 	preempt_enable();
@@ -834,8 +861,6 @@ void radix__flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
 }
 EXPORT_SYMBOL(radix__flush_tlb_page);
 
-#else /* CONFIG_SMP */
-static inline void exit_flush_lazy_tlbs(struct mm_struct *mm) { }
 #endif /* CONFIG_SMP */
 
 static void do_tlbiel_kernel(void *info)
@@ -899,7 +924,9 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
 	unsigned int page_shift = mmu_psize_defs[mmu_virtual_psize].shift;
 	unsigned long page_size = 1UL << page_shift;
 	unsigned long nr_pages = (end - start) >> page_shift;
-	bool local, full;
+	bool fullmm = (end == TLB_FLUSH_ALL);
+	bool flush_pid;
+	enum tlb_flush_type type;
 
 	pid = mm->context.id;
 	if (unlikely(pid == MMU_NO_CONTEXT))
@@ -907,24 +934,16 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
 
 	preempt_disable();
 	smp_mb(); /* see radix__flush_tlb_mm */
-	if (!mm_is_thread_local(mm)) {
-		if (unlikely(mm_is_singlethreaded(mm))) {
-			if (end != TLB_FLUSH_ALL) {
-				exit_flush_lazy_tlbs(mm);
-				goto is_local;
-			}
-		}
-		local = false;
-		full = (end == TLB_FLUSH_ALL ||
-				nr_pages > tlb_single_page_flush_ceiling);
-	} else {
-is_local:
-		local = true;
-		full = (end == TLB_FLUSH_ALL ||
-				nr_pages > tlb_local_single_page_flush_ceiling);
-	}
+	type = flush_type_needed(mm, fullmm);
+
+	if (fullmm)
+		flush_pid = true;
+	else if (type == FLUSH_TYPE_GLOBAL)
+		flush_pid = nr_pages > tlb_single_page_flush_ceiling;
+	else
+		flush_pid = nr_pages > tlb_local_single_page_flush_ceiling;
 
-	if (!mmu_has_feature(MMU_FTR_GTSE) && !local) {
+	if (!mmu_has_feature(MMU_FTR_GTSE) && type == FLUSH_TYPE_GLOBAL) {
 		unsigned long tgt = H_RPTI_TARGET_CMMU;
 		unsigned long pg_sizes = psize_to_rpti_pgsize(mmu_virtual_psize);
 
@@ -934,8 +953,8 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
 			tgt |= H_RPTI_TARGET_NMMU;
 		pseries_rpt_invalidate(pid, tgt, H_RPTI_TYPE_TLB, pg_sizes,
 				       start, end);
-	} else if (full) {
-		if (local) {
+	} else if (flush_pid) {
+		if (type == FLUSH_TYPE_LOCAL) {
 			_tlbiel_pid(pid, RIC_FLUSH_TLB);
 		} else {
 			if (cputlb_use_tlbie()) {
@@ -958,7 +977,7 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
 				hflush = true;
 		}
 
-		if (local) {
+		if (type == FLUSH_TYPE_LOCAL) {
 			asm volatile("ptesync": : :"memory");
 			__tlbiel_va_range(start, end, pid, page_size, mmu_virtual_psize);
 			if (hflush)
@@ -1091,32 +1110,28 @@ static __always_inline void __radix__flush_tlb_range_psize(struct mm_struct *mm,
 	unsigned int page_shift = mmu_psize_defs[psize].shift;
 	unsigned long page_size = 1UL << page_shift;
 	unsigned long nr_pages = (end - start) >> page_shift;
-	bool local, full;
+	bool fullmm = (end == TLB_FLUSH_ALL);
+	bool flush_pid;
+	enum tlb_flush_type type;
 
 	pid = mm->context.id;
 	if (unlikely(pid == MMU_NO_CONTEXT))
 		return;
 
+	fullmm = (end == TLB_FLUSH_ALL);
+
 	preempt_disable();
 	smp_mb(); /* see radix__flush_tlb_mm */
-	if (!mm_is_thread_local(mm)) {
-		if (unlikely(mm_is_singlethreaded(mm))) {
-			if (end != TLB_FLUSH_ALL) {
-				exit_flush_lazy_tlbs(mm);
-				goto is_local;
-			}
-		}
-		local = false;
-		full = (end == TLB_FLUSH_ALL ||
-				nr_pages > tlb_single_page_flush_ceiling);
-	} else {
-is_local:
-		local = true;
-		full = (end == TLB_FLUSH_ALL ||
-				nr_pages > tlb_local_single_page_flush_ceiling);
-	}
+	type = flush_type_needed(mm, fullmm);
 
-	if (!mmu_has_feature(MMU_FTR_GTSE) && !local) {
+	if (fullmm)
+		flush_pid = true;
+	else if (type == FLUSH_TYPE_GLOBAL)
+		flush_pid = nr_pages > tlb_single_page_flush_ceiling;
+	else
+		flush_pid = nr_pages > tlb_local_single_page_flush_ceiling;
+
+	if (!mmu_has_feature(MMU_FTR_GTSE) && type == FLUSH_TYPE_GLOBAL) {
 		unsigned long tgt = H_RPTI_TARGET_CMMU;
 		unsigned long type = H_RPTI_TYPE_TLB;
 		unsigned long pg_sizes = psize_to_rpti_pgsize(psize);
@@ -1126,8 +1141,8 @@ static __always_inline void __radix__flush_tlb_range_psize(struct mm_struct *mm,
 		if (atomic_read(&mm->context.copros) > 0)
 			tgt |= H_RPTI_TARGET_NMMU;
 		pseries_rpt_invalidate(pid, tgt, type, pg_sizes, start, end);
-	} else if (full) {
-		if (local) {
+	} else if (flush_pid) {
+		if (type == FLUSH_TYPE_LOCAL) {
 			_tlbiel_pid(pid, also_pwc ? RIC_FLUSH_ALL : RIC_FLUSH_TLB);
 		} else {
 			if (cputlb_use_tlbie()) {
@@ -1143,7 +1158,7 @@ static __always_inline void __radix__flush_tlb_range_psize(struct mm_struct *mm,
 
 		}
 	} else {
-		if (local)
+		if (type == FLUSH_TYPE_LOCAL)
 			_tlbiel_va_range(start, end, pid, page_size, psize, also_pwc);
 		else if (cputlb_use_tlbie())
 			_tlbie_va_range(start, end, pid, page_size, psize, also_pwc);
@@ -1170,6 +1185,7 @@ static void radix__flush_tlb_pwc_range_psize(struct mm_struct *mm, unsigned long
 void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
 {
 	unsigned long pid, end;
+	enum tlb_flush_type type;
 
 	pid = mm->context.id;
 	if (unlikely(pid == MMU_NO_CONTEXT))
@@ -1186,11 +1202,8 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
 	/* Otherwise first do the PWC, then iterate the pages. */
 	preempt_disable();
 	smp_mb(); /* see radix__flush_tlb_mm */
-	if (!mm_is_thread_local(mm)) {
-		if (unlikely(mm_is_singlethreaded(mm))) {
-			exit_flush_lazy_tlbs(mm);
-			goto local;
-		}
+	type = flush_type_needed(mm, false);
+	if (type == FLUSH_TYPE_GLOBAL) {
 		if (!mmu_has_feature(MMU_FTR_GTSE)) {
 			unsigned long tgt, type, pg_sizes;
 
@@ -1209,7 +1222,6 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
 			_tlbiel_va_range_multicast(mm,
 					addr, end, pid, PAGE_SIZE, mmu_virtual_psize, true);
 	} else {
-local:
 		_tlbiel_va_range(addr, end, pid, PAGE_SIZE, mmu_virtual_psize, true);
 	}
 
-- 
2.23.0


^ permalink raw reply related

* [PATCH 3/7] powerpc/64s/radix: Check for no TLB flush required
From: Nicholas Piggin @ 2020-12-17 13:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin
In-Reply-To: <20201217134731.488135-1-npiggin@gmail.com>

If there are no CPUs in mm_cpumask, no TLB flush is required at all.
This patch adds a check for this case.

Currently it's not tested for, in fact mm_is_thread_local() returns
false if the current CPU is not in mm_cpumask, so it's treated as a
global flush.

This can come up in some cases like exec failure before the new mm has
ever been switched to. This patch reduces TLBIE instructions required
to build a kernel from about 120,000 to 45,000. Another situation it
could help is page reclaim, KSM, THP, etc., (i.e., asynch operations
external to the process) where the process is sleeping and has all TLBs
flushed out of all CPUs.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/mm/book3s64/radix_tlb.c | 38 ++++++++++++++++++----------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
index 12481c864ab6..5b62e2e7371c 100644
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
@@ -694,13 +694,19 @@ static inline void exit_flush_lazy_tlbs(struct mm_struct *mm) { }
 #endif /* CONFIG_SMP */
 
 enum tlb_flush_type {
+	FLUSH_TYPE_NONE,
 	FLUSH_TYPE_LOCAL,
 	FLUSH_TYPE_GLOBAL,
 };
 
 static enum tlb_flush_type flush_type_needed(struct mm_struct *mm, bool fullmm)
 {
-	if (mm_is_thread_local(mm))
+	int active_cpus = atomic_read(&mm->context.active_cpus);
+	int cpu = smp_processor_id();
+
+	if (active_cpus == 0)
+		return FLUSH_TYPE_NONE;
+	if (active_cpus == 1 && cpumask_test_cpu(cpu, mm_cpumask(mm)))
 		return FLUSH_TYPE_LOCAL;
 
 	/* Coprocessors require TLBIE to invalidate nMMU. */
@@ -754,7 +760,9 @@ void radix__flush_tlb_mm(struct mm_struct *mm)
 	 */
 	smp_mb();
 	type = flush_type_needed(mm, false);
-	if (type == FLUSH_TYPE_GLOBAL) {
+	if (type == FLUSH_TYPE_LOCAL) {
+		_tlbiel_pid(pid, RIC_FLUSH_TLB);
+	} else if (type == FLUSH_TYPE_GLOBAL) {
 		if (!mmu_has_feature(MMU_FTR_GTSE)) {
 			unsigned long tgt = H_RPTI_TARGET_CMMU;
 
@@ -770,8 +778,6 @@ void radix__flush_tlb_mm(struct mm_struct *mm)
 		} else {
 			_tlbiel_pid_multicast(mm, pid, RIC_FLUSH_TLB);
 		}
-	} else {
-		_tlbiel_pid(pid, RIC_FLUSH_TLB);
 	}
 	preempt_enable();
 }
@@ -789,7 +795,9 @@ static void __flush_all_mm(struct mm_struct *mm, bool fullmm)
 	preempt_disable();
 	smp_mb(); /* see radix__flush_tlb_mm */
 	type = flush_type_needed(mm, fullmm);
-	if (type == FLUSH_TYPE_GLOBAL) {
+	if (type == FLUSH_TYPE_LOCAL) {
+		_tlbiel_pid(pid, RIC_FLUSH_ALL);
+	} else if (type == FLUSH_TYPE_GLOBAL) {
 		if (!mmu_has_feature(MMU_FTR_GTSE)) {
 			unsigned long tgt = H_RPTI_TARGET_CMMU;
 			unsigned long type = H_RPTI_TYPE_TLB | H_RPTI_TYPE_PWC |
@@ -803,8 +811,6 @@ static void __flush_all_mm(struct mm_struct *mm, bool fullmm)
 			_tlbie_pid(pid, RIC_FLUSH_ALL);
 		else
 			_tlbiel_pid_multicast(mm, pid, RIC_FLUSH_ALL);
-	} else {
-		_tlbiel_pid(pid, RIC_FLUSH_ALL);
 	}
 	preempt_enable();
 }
@@ -828,7 +834,9 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
 	preempt_disable();
 	smp_mb(); /* see radix__flush_tlb_mm */
 	type = flush_type_needed(mm, false);
-	if (type == FLUSH_TYPE_GLOBAL) {
+	if (type == FLUSH_TYPE_LOCAL) {
+		_tlbiel_va(vmaddr, pid, psize, RIC_FLUSH_TLB);
+	} else if (type == FLUSH_TYPE_GLOBAL) {
 		if (!mmu_has_feature(MMU_FTR_GTSE)) {
 			unsigned long tgt, pg_sizes, size;
 
@@ -845,8 +853,6 @@ void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr,
 			_tlbie_va(vmaddr, pid, psize, RIC_FLUSH_TLB);
 		else
 			_tlbiel_va_multicast(mm, vmaddr, pid, psize, RIC_FLUSH_TLB);
-	} else {
-		_tlbiel_va(vmaddr, pid, psize, RIC_FLUSH_TLB);
 	}
 	preempt_enable();
 }
@@ -935,6 +941,8 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
 	preempt_disable();
 	smp_mb(); /* see radix__flush_tlb_mm */
 	type = flush_type_needed(mm, fullmm);
+	if (type == FLUSH_TYPE_NONE)
+		goto out;
 
 	if (fullmm)
 		flush_pid = true;
@@ -999,6 +1007,7 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
 					hstart, hend, pid, PMD_SIZE, MMU_PAGE_2M, false);
 		}
 	}
+out:
 	preempt_enable();
 }
 
@@ -1123,6 +1132,8 @@ static __always_inline void __radix__flush_tlb_range_psize(struct mm_struct *mm,
 	preempt_disable();
 	smp_mb(); /* see radix__flush_tlb_mm */
 	type = flush_type_needed(mm, fullmm);
+	if (type == FLUSH_TYPE_NONE)
+		goto out;
 
 	if (fullmm)
 		flush_pid = true;
@@ -1166,6 +1177,7 @@ static __always_inline void __radix__flush_tlb_range_psize(struct mm_struct *mm,
 			_tlbiel_va_range_multicast(mm,
 					start, end, pid, page_size, psize, also_pwc);
 	}
+out:
 	preempt_enable();
 }
 
@@ -1203,7 +1215,9 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
 	preempt_disable();
 	smp_mb(); /* see radix__flush_tlb_mm */
 	type = flush_type_needed(mm, false);
-	if (type == FLUSH_TYPE_GLOBAL) {
+	if (type == FLUSH_TYPE_LOCAL) {
+		_tlbiel_va_range(addr, end, pid, PAGE_SIZE, mmu_virtual_psize, true);
+	} else if (type == FLUSH_TYPE_GLOBAL) {
 		if (!mmu_has_feature(MMU_FTR_GTSE)) {
 			unsigned long tgt, type, pg_sizes;
 
@@ -1221,8 +1235,6 @@ void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr)
 		else
 			_tlbiel_va_range_multicast(mm,
 					addr, end, pid, PAGE_SIZE, mmu_virtual_psize, true);
-	} else {
-		_tlbiel_va_range(addr, end, pid, PAGE_SIZE, mmu_virtual_psize, true);
 	}
 
 	preempt_enable();
-- 
2.23.0


^ permalink raw reply related

* [PATCH 4/7] powerpc/64s/radix: Allow mm_cpumask trimming from external sources
From: Nicholas Piggin @ 2020-12-17 13:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin
In-Reply-To: <20201217134731.488135-1-npiggin@gmail.com>

mm_cpumask trimming is currently restricted to be issued by the current
thread of a single-threaded mm. This patch relaxes that and allows the
mask to be trimmed from any context.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/mm/book3s64/radix_tlb.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
index 5b62e2e7371c..7b199bee4baa 100644
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
@@ -657,20 +657,16 @@ static void do_exit_flush_lazy_tlb(void *arg)
 	}
 
 	/*
-	 * This IPI is only initiated from a CPU which is running mm which
-	 * is a single-threaded process, so there will not be another racing
-	 * IPI coming in where we would find our cpumask already clear.
-	 *
-	 * Nothing else clears our bit in the cpumask except CPU offlining,
-	 * in which case we should not be taking IPIs here. However check
-	 * this just in case the logic is wrong somewhere, and don't underflow
-	 * the active_cpus count.
+	 * This IPI may be initiated from any source including those not
+	 * running the mm, so there may be a racing IPI that comes after
+	 * this one which finds the cpumask already clear. Check and avoid
+	 * underflowing the active_cpus count in that case. The race should
+	 * not otherwise be a problem, but the TLB must be flushed because
+	 * that's what the caller expects.
 	 */
 	if (cpumask_test_cpu(cpu, mm_cpumask(mm))) {
 		atomic_dec(&mm->context.active_cpus);
 		cpumask_clear_cpu(cpu, mm_cpumask(mm));
-	} else {
-		WARN_ON_ONCE(1);
 	}
 
 out_flush:
-- 
2.23.0


^ permalink raw reply related

* [PATCH 5/7] powerpc/64s/radix: occasionally attempt to trim mm_cpumask
From: Nicholas Piggin @ 2020-12-17 13:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin
In-Reply-To: <20201217134731.488135-1-npiggin@gmail.com>

A single-threaded process that is flushing its own address space is
so far the only case where the mm_cpumask is attempted to be trimmed.
This patch expands that to flush in other situations, multi-threaded
processes and external sources. For now it's a relatively simple
occasional trim attempt. The main aim is to add the mechanism,
tweaking and tuning can come with more data.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/mm/book3s64/radix_tlb.c | 60 ++++++++++++++++++++++++++--
 1 file changed, 56 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
index 7b199bee4baa..4dca7cbf07e9 100644
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
@@ -630,10 +630,8 @@ static bool mm_needs_flush_escalation(struct mm_struct *mm)
 	return false;
 }
 
-#ifdef CONFIG_SMP
-static void do_exit_flush_lazy_tlb(void *arg)
+static void exit_lazy_flush_tlb(struct mm_struct *mm)
 {
-	struct mm_struct *mm = arg;
 	unsigned long pid = mm->context.id;
 	int cpu = smp_processor_id();
 
@@ -673,6 +671,13 @@ static void do_exit_flush_lazy_tlb(void *arg)
 	_tlbiel_pid(pid, RIC_FLUSH_ALL);
 }
 
+#ifdef CONFIG_SMP
+static void do_exit_flush_lazy_tlb(void *arg)
+{
+	struct mm_struct *mm = arg;
+	exit_lazy_flush_tlb(mm);
+}
+
 static void exit_flush_lazy_tlbs(struct mm_struct *mm)
 {
 	/*
@@ -685,10 +690,32 @@ static void exit_flush_lazy_tlbs(struct mm_struct *mm)
 	smp_call_function_many(mm_cpumask(mm), do_exit_flush_lazy_tlb,
 				(void *)mm, 1);
 }
+
 #else /* CONFIG_SMP */
 static inline void exit_flush_lazy_tlbs(struct mm_struct *mm) { }
 #endif /* CONFIG_SMP */
 
+static DEFINE_PER_CPU(unsigned int, mm_cpumask_trim_clock);
+
+/*
+ * Interval between flushes at which we send out IPIs to check whether the
+ * mm_cpumask can be trimmed for the case where it's not a single-threaded
+ * process flushing its own mm. The intent is to reduce the cost of later
+ * flushes. Don't want this to be so low that it adds noticable cost to TLB
+ * flushing, or so high that it doesn't help reduce global TLBIEs.
+ */
+static unsigned long tlb_mm_cpumask_trim_timer = 1073;
+
+static bool tick_and_test_trim_clock(void)
+{
+	if (__this_cpu_inc_return(mm_cpumask_trim_clock) ==
+			tlb_mm_cpumask_trim_timer) {
+		__this_cpu_write(mm_cpumask_trim_clock, 0);
+		return true;
+	}
+	return false;
+}
+
 enum tlb_flush_type {
 	FLUSH_TYPE_NONE,
 	FLUSH_TYPE_LOCAL,
@@ -702,8 +729,20 @@ static enum tlb_flush_type flush_type_needed(struct mm_struct *mm, bool fullmm)
 
 	if (active_cpus == 0)
 		return FLUSH_TYPE_NONE;
-	if (active_cpus == 1 && cpumask_test_cpu(cpu, mm_cpumask(mm)))
+	if (active_cpus == 1 && cpumask_test_cpu(cpu, mm_cpumask(mm))) {
+		if (current->mm != mm) {
+			/*
+			 * Asynchronous flush sources may trim down to nothing
+			 * if the process is not running, so occasionally try
+			 * to trim.
+			 */
+			if (tick_and_test_trim_clock()) {
+				exit_lazy_flush_tlb(mm);
+				return FLUSH_TYPE_NONE;
+			}
+		}
 		return FLUSH_TYPE_LOCAL;
+	}
 
 	/* Coprocessors require TLBIE to invalidate nMMU. */
 	if (atomic_read(&mm->context.copros) > 0)
@@ -735,6 +774,19 @@ static enum tlb_flush_type flush_type_needed(struct mm_struct *mm, bool fullmm)
 		return FLUSH_TYPE_LOCAL;
 	}
 
+	/*
+	 * Occasionally try to trim down the cpumask. It's possible this can
+	 * bring the mask to zero, which results in no flush.
+	 */
+	if (tick_and_test_trim_clock()) {
+		exit_flush_lazy_tlbs(mm);
+		if (current->mm == mm)
+			return FLUSH_TYPE_LOCAL;
+		if (cpumask_test_cpu(cpu, mm_cpumask(mm)))
+			exit_lazy_flush_tlb(mm);
+		return FLUSH_TYPE_NONE;
+	}
+
 	return FLUSH_TYPE_GLOBAL;
 }
 
-- 
2.23.0


^ permalink raw reply related

* [PATCH 6/7] powerpc/64s/radix: serialize_against_pte_lookup IPIs trim mm_cpumask
From: Nicholas Piggin @ 2020-12-17 13:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin
In-Reply-To: <20201217134731.488135-1-npiggin@gmail.com>

serialize_against_pte_lookup() performs IPIs to all CPUs in mm_cpumask.
Take this opportunity to try trim the CPU out of mm_cpumask. This can
reduce the cost of future serialize_against_pte_lookup() and/or the
cost of future TLB flushes.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/mm/book3s64/pgtable.c   | 13 ++++++++++---
 arch/powerpc/mm/book3s64/radix_tlb.c | 20 +++++++++++++-------
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
index e18ae50a275c..ec23faf102b2 100644
--- a/arch/powerpc/mm/book3s64/pgtable.c
+++ b/arch/powerpc/mm/book3s64/pgtable.c
@@ -79,10 +79,17 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
 	return set_pte_at(mm, addr, pmdp_ptep(pmdp), pmd_pte(pmd));
 }
 
-static void do_nothing(void *unused)
-{
+void exit_lazy_flush_tlb(struct mm_struct *mm, bool always_flush);
 
+static void do_serialize(void *arg)
+{
+	/* We've taken the IPI, so try to trim the mask while here */
+	if (radix_enabled()) {
+		struct mm_struct *mm = arg;
+		exit_lazy_flush_tlb(mm, false);
+	}
 }
+
 /*
  * Serialize against find_current_mm_pte which does lock-less
  * lookup in page tables with local interrupts disabled. For huge pages
@@ -96,7 +103,7 @@ static void do_nothing(void *unused)
 void serialize_against_pte_lookup(struct mm_struct *mm)
 {
 	smp_mb();
-	smp_call_function_many(mm_cpumask(mm), do_nothing, NULL, 1);
+	smp_call_function_many(mm_cpumask(mm), do_serialize, mm, 1);
 }
 
 /*
diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
index 4dca7cbf07e9..d04c80d6f52c 100644
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
@@ -630,7 +630,11 @@ static bool mm_needs_flush_escalation(struct mm_struct *mm)
 	return false;
 }
 
-static void exit_lazy_flush_tlb(struct mm_struct *mm)
+/*
+ * If always_flush is true, then flush even if this CPU can't be removed
+ * from mm_cpumask.
+ */
+void exit_lazy_flush_tlb(struct mm_struct *mm, bool always_flush)
 {
 	unsigned long pid = mm->context.id;
 	int cpu = smp_processor_id();
@@ -643,7 +647,7 @@ static void exit_lazy_flush_tlb(struct mm_struct *mm)
 	 * done with interrupts off.
 	 */
 	if (current->mm == mm)
-		goto out_flush;
+		goto out;
 
 	if (current->active_mm == mm) {
 		WARN_ON_ONCE(current->mm != NULL);
@@ -665,17 +669,19 @@ static void exit_lazy_flush_tlb(struct mm_struct *mm)
 	if (cpumask_test_cpu(cpu, mm_cpumask(mm))) {
 		atomic_dec(&mm->context.active_cpus);
 		cpumask_clear_cpu(cpu, mm_cpumask(mm));
+		always_flush = true;
 	}
 
-out_flush:
-	_tlbiel_pid(pid, RIC_FLUSH_ALL);
+out:
+	if (always_flush)
+		_tlbiel_pid(pid, RIC_FLUSH_ALL);
 }
 
 #ifdef CONFIG_SMP
 static void do_exit_flush_lazy_tlb(void *arg)
 {
 	struct mm_struct *mm = arg;
-	exit_lazy_flush_tlb(mm);
+	exit_lazy_flush_tlb(mm, true);
 }
 
 static void exit_flush_lazy_tlbs(struct mm_struct *mm)
@@ -737,7 +743,7 @@ static enum tlb_flush_type flush_type_needed(struct mm_struct *mm, bool fullmm)
 			 * to trim.
 			 */
 			if (tick_and_test_trim_clock()) {
-				exit_lazy_flush_tlb(mm);
+				exit_lazy_flush_tlb(mm, true);
 				return FLUSH_TYPE_NONE;
 			}
 		}
@@ -783,7 +789,7 @@ static enum tlb_flush_type flush_type_needed(struct mm_struct *mm, bool fullmm)
 		if (current->mm == mm)
 			return FLUSH_TYPE_LOCAL;
 		if (cpumask_test_cpu(cpu, mm_cpumask(mm)))
-			exit_lazy_flush_tlb(mm);
+			exit_lazy_flush_tlb(mm, true);
 		return FLUSH_TYPE_NONE;
 	}
 
-- 
2.23.0


^ permalink raw reply related

* [PATCH 7/7] powerpc/64s: Implement ptep_clear_flush_young that does not flush TLBs
From: Nicholas Piggin @ 2020-12-17 13:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin
In-Reply-To: <20201217134731.488135-1-npiggin@gmail.com>

Similarly to the x86 commit b13b1d2d8692 ("x86/mm: In the PTE swapout
page reclaim case clear the accessed bit instead of flushing the TLB"),
implement ptep_clear_flush_young that does not actually flush the TLB
in the case the referenced bit is cleared.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/include/asm/book3s/64/pgtable.h | 23 +++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
index cd3feeac6e87..751f98a40aca 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
@@ -388,11 +388,28 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
 #define ptep_test_and_clear_young(__vma, __addr, __ptep)	\
 ({								\
-	int __r;						\
-	__r = __ptep_test_and_clear_young((__vma)->vm_mm, __addr, __ptep); \
-	__r;							\
+	__ptep_test_and_clear_young((__vma)->vm_mm, __addr, __ptep); \
 })
 
+/*
+ * On Book3S CPUs, clearing the accessed bit without a TLB flush
+ * doesn't cause data corruption. [ It could cause incorrect
+ * page aging and the (mistaken) reclaim of hot pages, but the
+ * chance of that should be relatively low. ]
+ *
+ * So as a performance optimization don't flush the TLB when
+ * clearing the accessed bit, it will eventually be flushed by
+ * a context switch or a VM operation anyway. [ In the rare
+ * event of it not getting flushed for a long time the delay
+ * shouldn't really matter because there's no real memory
+ * pressure for swapout to react to. ]
+ */
+#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
+#define ptep_clear_flush_young ptep_test_and_clear_young
+
+#define __HAVE_ARCH_PMDP_CLEAR_YOUNG_FLUSH
+#define pmdp_clear_flush_young pmdp_test_and_clear_young
+
 static inline int __pte_write(pte_t pte)
 {
 	return !!(pte_raw(pte) & cpu_to_be64(_PAGE_WRITE));
-- 
2.23.0


^ permalink raw reply related

* Re: powerpc VDSO files being unnecessarily rebuilt
From: Masahiro Yamada @ 2020-12-17 16:40 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Linux Kbuild mailing list
In-Reply-To: <CAK7LNASTXyxhLzH7kRyAKCixe6ksJaKPiuPxWnsYZ6NJVCWDhQ@mail.gmail.com>

On Thu, Dec 17, 2020 at 6:23 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Thu, Dec 17, 2020 at 11:56 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
> >
> > Hi all,
> >
> > Since the merge of the C VDSO I see we are repeatedly rebuilding some
> > files in the VDSO, eg:
> >
> >   $ make V=2
> >   make[1]: Entering directory '/home/michael/linux/build~'
> >     GEN     Makefile
> >     CALL    /home/michael/linux/scripts/checksyscalls.sh - due to target missing
> >     CALL    /home/michael/linux/scripts/atomic/check-atomics.sh - due to target missing
> >     CHK     include/generated/compile.h
> >     CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to vgettimeofday.o not in $(targets)
> >
> > This then causes multiple other files to be rebuilt.
> >
> > So the obvious fix is to add it to targets:
> >
> > diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
> > index d365810a689a..5386532866ce 100644
> > --- a/arch/powerpc/kernel/vdso64/Makefile
> > +++ b/arch/powerpc/kernel/vdso64/Makefile
> > @@ -5,6 +5,7 @@ ARCH_REL_TYPE_ABS := R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_
> >  include $(srctree)/lib/vdso/Makefile
> >
> >  obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o
> > +targets := $(obj-vdso64) vdso64.so.dbg
> >
> >  ifneq ($(c-gettimeofday-y),)
> >    CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
> > @@ -13,11 +14,11 @@ ifneq ($(c-gettimeofday-y),)
> >    CFLAGS_vgettimeofday.o += -DDISABLE_BRANCH_PROFILING
> >    CFLAGS_vgettimeofday.o += -ffreestanding -fasynchronous-unwind-tables
> >    CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE)
> > +  targets += vgettimeofday.o
> >  endif
> >
> >  # Build rules
> >
> > -targets := $(obj-vdso64) vdso64.so.dbg
> >  obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
> >
> >  GCOV_PROFILE := n
> >
> >
> > But then I see it still rebuilt:
> >
> >   CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
> >
> >
> > I'm not changing the command line, and AFAICS the .cmd file is not
> > changing either:
> >
> >   $ make V=2
> >   ...
> >     CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
> >
> >   $ sha256sum build\~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> >   7f635546bc2768c7b929d3de1724d83285f3cd54394fcd7104f8b1301d689d65  build~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> >
> >   $ make V=2
> >   ...
> >     CC      arch/powerpc/kernel/vdso64/vgettimeofday.o - due to command line change
> >
> >   $ sha256sum build\~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> >   7f635546bc2768c7b929d3de1724d83285f3cd54394fcd7104f8b1301d689d65  build~/arch/powerpc/kernel/vdso64/vgettimeofday.o
> >
> >
> > So any hints on what I'm missing here?
> >
> > cheers
>
>
> This is because PPC builds the vdso twice
> with different command arguments.
>
>
> First time:
>
> vdso_prepare: prepare0
>          $(if $(CONFIG_VDSO32),$(Q)$(MAKE) \
>                  $(build)=arch/powerpc/kernel/vdso32
> include/generated/vdso32-offsets.h)
>          $(if $(CONFIG_PPC64),$(Q)$(MAKE) \
>                  $(build)=arch/powerpc/kernel/vdso64
> include/generated/vdso64-offsets.h)
>
>
> Second time:
>    from  arch/powerpc/kernel/Makefile
>
>
>
>
>
> For the first build, -Werror is missing because
> Kbuild directly descends into arch/powerpc/kernel/vdso[32,64]/.
>
>
> For the second build,
>
> arch/powerpc/Kbuild appends the following:
>
> subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
>


This is very dangerous because the vdso offsets are wrong.

I think ppc followed arm64 implementation.

Let me figure out how to fix arm64 vdso.



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply

* Re: [PATCH 6/7] powerpc/64s/radix: serialize_against_pte_lookup IPIs trim mm_cpumask
From: kernel test robot @ 2020-12-17 18:23 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: kbuild-all, Nicholas Piggin
In-Reply-To: <20201217134731.488135-7-npiggin@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3681 bytes --]

Hi Nicholas,

I love your patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on v5.10 next-20201217]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nicholas-Piggin/powerpc-64s-TLB-flushing-improvements/20201217-220230
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-randconfig-m031-20201217 (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/5bd02bea3da4e21fa00729e7687fc93a5c653e2b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nicholas-Piggin/powerpc-64s-TLB-flushing-improvements/20201217-220230
        git checkout 5bd02bea3da4e21fa00729e7687fc93a5c653e2b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> arch/powerpc/mm/book3s64/radix_tlb.c:646:6: error: no previous prototype for 'exit_lazy_flush_tlb' [-Werror=missing-prototypes]
     646 | void exit_lazy_flush_tlb(struct mm_struct *mm, bool always_flush)
         |      ^~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors


vim +/exit_lazy_flush_tlb +646 arch/powerpc/mm/book3s64/radix_tlb.c

   641	
   642	/*
   643	 * If always_flush is true, then flush even if this CPU can't be removed
   644	 * from mm_cpumask.
   645	 */
 > 646	void exit_lazy_flush_tlb(struct mm_struct *mm, bool always_flush)
   647	{
   648		unsigned long pid = mm->context.id;
   649		int cpu = smp_processor_id();
   650	
   651		/*
   652		 * A kthread could have done a mmget_not_zero() after the flushing CPU
   653		 * checked mm_cpumask, and be in the process of kthread_use_mm when
   654		 * interrupted here. In that case, current->mm will be set to mm,
   655		 * because kthread_use_mm() setting ->mm and switching to the mm is
   656		 * done with interrupts off.
   657		 */
   658		if (current->mm == mm)
   659			goto out;
   660	
   661		if (current->active_mm == mm) {
   662			WARN_ON_ONCE(current->mm != NULL);
   663			/* Is a kernel thread and is using mm as the lazy tlb */
   664			mmgrab(&init_mm);
   665			current->active_mm = &init_mm;
   666			switch_mm_irqs_off(mm, &init_mm, current);
   667			mmdrop(mm);
   668		}
   669	
   670		/*
   671		 * This IPI may be initiated from any source including those not
   672		 * running the mm, so there may be a racing IPI that comes after
   673		 * this one which finds the cpumask already clear. Check and avoid
   674		 * underflowing the active_cpus count in that case. The race should
   675		 * not otherwise be a problem, but the TLB must be flushed because
   676		 * that's what the caller expects.
   677		 */
   678		if (cpumask_test_cpu(cpu, mm_cpumask(mm))) {
   679			atomic_dec(&mm->context.active_cpus);
   680			cpumask_clear_cpu(cpu, mm_cpumask(mm));
   681			always_flush = true;
   682		}
   683	
   684	out:
   685		if (always_flush)
   686			_tlbiel_pid(pid, RIC_FLUSH_ALL);
   687	}
   688	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40559 bytes --]

^ permalink raw reply

* Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.11-1 tag
From: pr-tracker-bot @ 2020-12-17 21:44 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: ego, clombard, david, aik, jniethe5, bala24, oohall, morbo, ardb,
	srikar, leobras.c, maddy, aneesh.kumar, miaoqinglang,
	vincent.stehle, tiwai, ganeshgr, u.kleine-koenig, harish, longman,
	nathanl, ravi.bangoria, ajd, amodra, linuxppc-dev, npiggin, oss,
	mathieu.desnoyers, clg, colin.king, ldufour, tangyouling,
	po-hsu.lin, dja, atrajeev, Kees Cook, zhangxiaoxu5, oleg, tyreld,
	linux-kernel, fbarrat, kaixuxia, Linus Torvalds
In-Reply-To: <87r1noy325.fsf@mpe.ellerman.id.au>

The pull request you sent on Fri, 18 Dec 2020 00:28:34 +1100:

> https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.11-1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/8a5be36b9303ae167468d4f5e1b3c090b9981396

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

^ permalink raw reply

* [powerpc:next] BUILD SUCCESS c1bea0a840ac75dca19bc6aa05575a33eb9fd058
From: kernel test robot @ 2020-12-17 22:28 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git  next
branch HEAD: c1bea0a840ac75dca19bc6aa05575a33eb9fd058  powerpc/32s: Fix cleanup_cpu_mmu_context() compile bug

elapsed time: 962m

configs tested: 170
configs skipped: 3

The following configs have been built successfully.
More configs may be tested in the coming days.

gcc tested configs:
arm                                 defconfig
arm64                            allyesconfig
arm64                               defconfig
arm                              allyesconfig
arm                              allmodconfig
arm                       omap2plus_defconfig
sh                                  defconfig
powerpc                 mpc8540_ads_defconfig
arm                        vexpress_defconfig
arm                        cerfcube_defconfig
h8300                     edosk2674_defconfig
arm                          pxa3xx_defconfig
arm                     eseries_pxa_defconfig
mips                         bigsur_defconfig
mips                          ath25_defconfig
arm                          simpad_defconfig
powerpc                      chrp32_defconfig
arm                           corgi_defconfig
powerpc                     tqm5200_defconfig
riscv                            alldefconfig
arm                      footbridge_defconfig
powerpc                     tqm8540_defconfig
c6x                        evmc6457_defconfig
sh                            shmin_defconfig
xtensa                       common_defconfig
arm                           sunxi_defconfig
sh                      rts7751r2d1_defconfig
arm                           h3600_defconfig
m68k                        stmark2_defconfig
sh                        sh7757lcr_defconfig
powerpc                      tqm8xx_defconfig
powerpc                 mpc834x_itx_defconfig
m68k                             alldefconfig
arm                           h5000_defconfig
powerpc                     akebono_defconfig
c6x                        evmc6678_defconfig
microblaze                      mmu_defconfig
powerpc                     skiroot_defconfig
mips                  cavium_octeon_defconfig
arm                       mainstone_defconfig
sh                   sh7724_generic_defconfig
arm                           sama5_defconfig
h8300                    h8300h-sim_defconfig
arm                         orion5x_defconfig
arm                         axm55xx_defconfig
arm                          prima2_defconfig
arm                         s5pv210_defconfig
arm                        oxnas_v6_defconfig
arm                         s3c6400_defconfig
powerpc                     tqm8555_defconfig
arm                        multi_v5_defconfig
powerpc                 mpc8315_rdb_defconfig
xtensa                         virt_defconfig
mips                          malta_defconfig
arm                         lubbock_defconfig
arm                          iop32x_defconfig
arm                         lpc32xx_defconfig
h8300                       h8s-sim_defconfig
arc                 nsimosci_hs_smp_defconfig
mips                      bmips_stb_defconfig
powerpc                   currituck_defconfig
s390                       zfcpdump_defconfig
powerpc                    ge_imp3a_defconfig
mips                      pistachio_defconfig
powerpc64                        alldefconfig
arm                  colibri_pxa300_defconfig
m68k                        m5407c3_defconfig
powerpc                       ppc64_defconfig
arm                         assabet_defconfig
sh                          lboxre2_defconfig
m68k                         apollo_defconfig
powerpc                     pseries_defconfig
m68k                       bvme6000_defconfig
powerpc                       eiger_defconfig
arm                         s3c2410_defconfig
arm                          pxa168_defconfig
mips                      fuloong2e_defconfig
powerpc                      cm5200_defconfig
sh                        apsh4ad0a_defconfig
arm                          ep93xx_defconfig
m68k                           sun3_defconfig
powerpc                      pcm030_defconfig
powerpc                     powernv_defconfig
arm                          tango4_defconfig
arm                            xcep_defconfig
arm                   milbeaut_m10v_defconfig
arm                           spitz_defconfig
xtensa                          iss_defconfig
powerpc                           allnoconfig
arm                         cm_x300_defconfig
sh                             espt_defconfig
c6x                        evmc6472_defconfig
ia64                                defconfig
sparc                            allyesconfig
arm                        spear6xx_defconfig
riscv                    nommu_virt_defconfig
powerpc                     stx_gp3_defconfig
sh                   rts7751r2dplus_defconfig
powerpc                      pasemi_defconfig
mips                        omega2p_defconfig
mips                         mpc30x_defconfig
mips                       bmips_be_defconfig
mips                         cobalt_defconfig
ia64                             allmodconfig
ia64                             allyesconfig
m68k                             allmodconfig
m68k                                defconfig
m68k                             allyesconfig
nios2                               defconfig
arc                              allyesconfig
nds32                             allnoconfig
c6x                              allyesconfig
nds32                               defconfig
nios2                            allyesconfig
csky                                defconfig
alpha                               defconfig
alpha                            allyesconfig
xtensa                           allyesconfig
h8300                            allyesconfig
arc                                 defconfig
sh                               allmodconfig
parisc                              defconfig
s390                             allyesconfig
parisc                           allyesconfig
s390                                defconfig
i386                             allyesconfig
sparc                               defconfig
i386                               tinyconfig
i386                                defconfig
mips                             allyesconfig
mips                             allmodconfig
powerpc                          allyesconfig
powerpc                          allmodconfig
x86_64               randconfig-a003-20201217
x86_64               randconfig-a006-20201217
x86_64               randconfig-a002-20201217
x86_64               randconfig-a005-20201217
x86_64               randconfig-a004-20201217
x86_64               randconfig-a001-20201217
i386                 randconfig-a001-20201217
i386                 randconfig-a004-20201217
i386                 randconfig-a003-20201217
i386                 randconfig-a002-20201217
i386                 randconfig-a006-20201217
i386                 randconfig-a005-20201217
i386                 randconfig-a014-20201217
i386                 randconfig-a013-20201217
i386                 randconfig-a012-20201217
i386                 randconfig-a011-20201217
i386                 randconfig-a015-20201217
i386                 randconfig-a016-20201217
riscv                    nommu_k210_defconfig
riscv                            allyesconfig
riscv                             allnoconfig
riscv                               defconfig
riscv                          rv32_defconfig
riscv                            allmodconfig
x86_64                                   rhel
x86_64                           allyesconfig
x86_64                    rhel-7.6-kselftests
x86_64                              defconfig
x86_64                               rhel-8.3
x86_64                      rhel-8.3-kbuiltin
x86_64                                  kexec

clang tested configs:
x86_64               randconfig-a016-20201217
x86_64               randconfig-a012-20201217
x86_64               randconfig-a013-20201217
x86_64               randconfig-a015-20201217
x86_64               randconfig-a014-20201217
x86_64               randconfig-a011-20201217

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply

* [powerpc:merge] BUILD SUCCESS 3ae03872115a0a158508ee5a91337648aede547d
From: kernel test robot @ 2020-12-17 22:28 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git  merge
branch HEAD: 3ae03872115a0a158508ee5a91337648aede547d  Automatic merge of 'next' into merge (2020-12-17 14:33)

elapsed time: 964m

configs tested: 129
configs skipped: 3

The following configs have been built successfully.
More configs may be tested in the coming days.

gcc tested configs:
arm                                 defconfig
arm64                            allyesconfig
arm64                               defconfig
arm                              allyesconfig
arm                              allmodconfig
arm                       omap2plus_defconfig
sh                                  defconfig
powerpc                 mpc8540_ads_defconfig
arm                        vexpress_defconfig
arm                        cerfcube_defconfig
c6x                        evmc6457_defconfig
sh                            shmin_defconfig
xtensa                       common_defconfig
arm                           sunxi_defconfig
arm                            lart_defconfig
mips                    maltaup_xpa_defconfig
arm                          badge4_defconfig
mips                            e55_defconfig
sh                           se7751_defconfig
powerpc                 mpc837x_mds_defconfig
sh                      rts7751r2d1_defconfig
arm                           h3600_defconfig
m68k                        stmark2_defconfig
sh                        sh7757lcr_defconfig
mips                  cavium_octeon_defconfig
arm                       mainstone_defconfig
sh                   sh7724_generic_defconfig
arm                           sama5_defconfig
h8300                    h8300h-sim_defconfig
arm                         orion5x_defconfig
xtensa                         virt_defconfig
mips                          malta_defconfig
arm                         lubbock_defconfig
arm                          iop32x_defconfig
arm                         lpc32xx_defconfig
h8300                       h8s-sim_defconfig
arc                 nsimosci_hs_smp_defconfig
mips                      bmips_stb_defconfig
powerpc                   currituck_defconfig
powerpc                     akebono_defconfig
mips                      fuloong2e_defconfig
powerpc                      cm5200_defconfig
sh                        apsh4ad0a_defconfig
arm                          ep93xx_defconfig
m68k                           sun3_defconfig
arm                            xcep_defconfig
arm                   milbeaut_m10v_defconfig
arm                           spitz_defconfig
xtensa                          iss_defconfig
arm                        spear6xx_defconfig
arm                      footbridge_defconfig
powerpc                     stx_gp3_defconfig
sh                   rts7751r2dplus_defconfig
mips                        workpad_defconfig
sparc                       sparc64_defconfig
mips                        nlm_xlr_defconfig
microblaze                      mmu_defconfig
powerpc                      makalu_defconfig
ia64                             allmodconfig
ia64                                defconfig
ia64                             allyesconfig
m68k                             allmodconfig
m68k                                defconfig
m68k                             allyesconfig
nios2                               defconfig
arc                              allyesconfig
nds32                             allnoconfig
c6x                              allyesconfig
nds32                               defconfig
nios2                            allyesconfig
csky                                defconfig
alpha                               defconfig
alpha                            allyesconfig
xtensa                           allyesconfig
h8300                            allyesconfig
arc                                 defconfig
sh                               allmodconfig
parisc                              defconfig
s390                             allyesconfig
parisc                           allyesconfig
s390                                defconfig
i386                             allyesconfig
sparc                            allyesconfig
sparc                               defconfig
i386                               tinyconfig
i386                                defconfig
mips                             allyesconfig
mips                             allmodconfig
powerpc                          allyesconfig
powerpc                          allmodconfig
powerpc                           allnoconfig
x86_64               randconfig-a003-20201217
x86_64               randconfig-a006-20201217
x86_64               randconfig-a002-20201217
x86_64               randconfig-a005-20201217
x86_64               randconfig-a004-20201217
x86_64               randconfig-a001-20201217
i386                 randconfig-a001-20201217
i386                 randconfig-a004-20201217
i386                 randconfig-a003-20201217
i386                 randconfig-a002-20201217
i386                 randconfig-a006-20201217
i386                 randconfig-a005-20201217
i386                 randconfig-a014-20201217
i386                 randconfig-a013-20201217
i386                 randconfig-a012-20201217
i386                 randconfig-a011-20201217
i386                 randconfig-a015-20201217
i386                 randconfig-a016-20201217
riscv                    nommu_k210_defconfig
riscv                            allyesconfig
riscv                    nommu_virt_defconfig
riscv                             allnoconfig
riscv                               defconfig
riscv                          rv32_defconfig
riscv                            allmodconfig
x86_64                                   rhel
x86_64                           allyesconfig
x86_64                    rhel-7.6-kselftests
x86_64                              defconfig
x86_64                               rhel-8.3
x86_64                      rhel-8.3-kbuiltin
x86_64                                  kexec

clang tested configs:
x86_64               randconfig-a016-20201217
x86_64               randconfig-a012-20201217
x86_64               randconfig-a013-20201217
x86_64               randconfig-a015-20201217
x86_64               randconfig-a014-20201217
x86_64               randconfig-a011-20201217

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply

* Re: [PATCH] powerpc/perf/hv-24x7: Dont create sysfs event files for dummy events
From: Michael Ellerman @ 2020-12-18  0:56 UTC (permalink / raw)
  To: Kajol Jain, linuxppc-dev; +Cc: kjain, suka, maddy, atrajeev
In-Reply-To: <20201217113230.1069882-1-kjain@linux.ibm.com>

Kajol Jain <kjain@linux.ibm.com> writes:
> hv_24x7 performance monitoring unit creates list of supported events
> from the event catalog obtained via HCALL. hv_24x7 catalog could also
> contain invalid or dummy events (with names like FREE_  or CPM_FREE_ so
> on). These events does not have any hardware counters backing them.
> So patch adds a check to string compare the event names to filter
> out them.
>
> Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
> ---
>  arch/powerpc/perf/hv-24x7.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
> index 6e7e820508df..c3252d8a7818 100644
> --- a/arch/powerpc/perf/hv-24x7.c
> +++ b/arch/powerpc/perf/hv-24x7.c
> @@ -894,6 +894,11 @@ static int create_events_from_catalog(struct attribute ***events_,
>  
>  		name = event_name(event, &nl);
>  
> +		if (strstr(name, "FREE_")) {
> +			pr_info("invalid event %zu (%.*s)\n", event_idx, nl, name);
> +			junk_events++;
> +			continue;

I don't think we want a print for each event, just one at the end saying
"Dropped %d invalid events" would be preferable I think.


> +		}
>  		if (event->event_group_record_len == 0) {
>  			pr_devel("invalid event %zu (%.*s): group_record_len == 0, skipping\n",
>  					event_idx, nl, name);
> @@ -955,6 +960,9 @@ static int create_events_from_catalog(struct attribute ***events_,
>  			continue;
>  
>  		name  = event_name(event, &nl);
> +		if (strstr(name, "FREE_"))
> +			continue;

Would be nice if the string comparison was in a single place, ie. in a
helper function.

cheers

^ permalink raw reply

* [PATCH] powerpc/mm: Limit allocation of SWIOTLB on server machines
From: Thiago Jung Bauermann @ 2020-12-18  6:21 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Satheesh Rajendran, Ram Pai, linux-kernel, Thiago Jung Bauermann

On server-class POWER machines, we don't need the SWIOTLB unless we're a
secure VM. Nevertheless, if CONFIG_SWIOTLB is enabled we unconditionally
allocate it.

In most cases this is harmless, but on a few machine configurations (e.g.,
POWER9 powernv systems with 4 GB area reserved for crashdump kernel) it can
happen that memblock can't find a 64 MB chunk of memory for the SWIOTLB and
fails with a scary-looking WARN_ONCE:

 ------------[ cut here ]------------
 memblock: bottom-up allocation failed, memory hotremove may be affected
 WARNING: CPU: 0 PID: 0 at mm/memblock.c:332 memblock_find_in_range_node+0x328/0x340
 Modules linked in:
 CPU: 0 PID: 0 Comm: swapper Not tainted 5.10.0-rc2-orig+ #6
 NIP:  c000000000442f38 LR: c000000000442f34 CTR: c0000000001e0080
 REGS: c000000001def900 TRAP: 0700   Not tainted  (5.10.0-rc2-orig+)
 MSR:  9000000002021033 <SF,HV,VEC,ME,IR,DR,RI,LE>  CR: 28022222  XER: 20040000
 CFAR: c00000000014b7b4 IRQMASK: 1
 GPR00: c000000000442f34 c000000001defba0 c000000001deff00 0000000000000047
 GPR04: 00000000ffff7fff c000000001def828 c000000001def820 0000000000000000
 GPR08: 0000001ffc3e0000 c000000001b75478 c000000001b75478 0000000000000001
 GPR12: 0000000000002000 c000000002030000 0000000000000000 0000000000000000
 GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000002030000
 GPR20: 0000000000000000 0000000000010000 0000000000010000 c000000001defc10
 GPR24: c000000001defc08 c000000001c91868 c000000001defc18 c000000001c91890
 GPR28: 0000000000000000 ffffffffffffffff 0000000004000000 00000000ffffffff
 NIP [c000000000442f38] memblock_find_in_range_node+0x328/0x340
 LR [c000000000442f34] memblock_find_in_range_node+0x324/0x340
 Call Trace:
 [c000000001defba0] [c000000000442f34] memblock_find_in_range_node+0x324/0x340 (unreliable)
 [c000000001defc90] [c0000000015ac088] memblock_alloc_range_nid+0xec/0x1b0
 [c000000001defd40] [c0000000015ac1f8] memblock_alloc_internal+0xac/0x110
 [c000000001defda0] [c0000000015ac4d0] memblock_alloc_try_nid+0x94/0xcc
 [c000000001defe30] [c00000000159c3c8] swiotlb_init+0x78/0x104
 [c000000001defea0] [c00000000158378c] mem_init+0x4c/0x98
 [c000000001defec0] [c00000000157457c] start_kernel+0x714/0xac8
 [c000000001deff90] [c00000000000d244] start_here_common+0x1c/0x58
 Instruction dump:
 2c230000 4182ffd4 ea610088 ea810090 4bfffe84 39200001 3d42fff4 3c62ff60
 3863c560 992a8bfc 4bd0881d 60000000 <0fe00000> ea610088 4bfffd94 60000000
 random: get_random_bytes called from __warn+0x128/0x184 with crng_init=0
 ---[ end trace 0000000000000000 ]---
 software IO TLB: Cannot allocate buffer

Unless this is a secure VM the message can actually be ignored, because the
SWIOTLB isn't needed. Therefore, let's avoid the SWIOTLB in those cases.

Fixes: eae9eec476d1 ("powerpc/pseries/svm: Allocate SWIOTLB buffer anywhere in memory")
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
 arch/powerpc/mm/mem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index afab328d0887..3af991844145 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -300,7 +300,8 @@ void __init mem_init(void)
 	memblock_set_bottom_up(true);
 	if (is_secure_guest())
 		svm_swiotlb_init();
-	else
+	/* Server machines don't need SWIOTLB if they're not secure guests. */
+	else if (!machine_is(pseries) && !machine_is(powernv))
 		swiotlb_init(0);
 #endif
 

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox