Re: [PATCH 2 1/4] powerpc: drop the ability to tweak SMT mode at boot time
On Tue, 09 Dec 2014 15:11:02 +1100 Michael Ellerman wrote: > On Fri, 2014-12-05 at 12:52 -0600, Scott Wood wrote: > > On Fri, 2014-12-05 at 16:14 +0100, Greg Kurz wrote: > > > The smt-enabled kernel parameter basically leaves unwanted cpus executing > > > in firmware or wherever they happen to be. The very same applies to the > > > ibm,smt-enabled DT property which is no more used by anything known. These > > > are hacks that shoudn't be used in a production environment. > > > > > > Quoting mpe, "there are better ways for firmware to disable SMT". > > > > Those "better ways" don't apply to Freescale chips, where the OS enables > > (or not) SMT without any interaction with firmware. > > But how does it know there even are SMT threads? From the device tree? So > just don't present the threads in the device tree? > > cheers > > Michael, Maybe we can first kill the cpu_bootable hook in powernv only, for bug fix. Then we can take time to do the thing right for all platforms. Thoughts ? -- Greg ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v3] i2c: Driver to expose PowerNV platform i2c busses
> > Oh, I thought we agreed that you take it via powerpc. I still think this > > is the best solution. > > I threatened to do that :-) I don't remember you replying, did I miss > it ? It is here: http://thread.gmane.org/gmane.linux.drivers.i2c/20762/focus=21099 > If you are ok with the driver and are happy for me to take it, > please send an Ack. "Happy" is not the correct word, but let's just go over with it. Maybe like this: Acked-by: Wolfram Sang (I2C part, excluding the bindings) > From a binding perspective, it's just a piece of additional info that > the firmware provides for convenience. I do understand the use case. I even agree it makes sense to have something like this. It is just that I'd prefer a generic, widely acknowledged solution, with consensus where it belongs and how it should be named. Not a custom solution which, frankly, feels forced on me by time pressure I have nothing to do with. So, not happy here, but also not looking for drama. Let's move on... signature.asc Description: Digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v3] i2c: Driver to expose PowerNV platform i2c busses
On Tue, 2014-12-09 at 09:54 +0100, Wolfram Sang wrote: > > > Oh, I thought we agreed that you take it via powerpc. I still think this > > > is the best solution. > > > > I threatened to do that :-) I don't remember you replying, did I miss > > it ? > It is here: > http://thread.gmane.org/gmane.linux.drivers.i2c/20762/focus=21099 Weird, it never made it to my mbox... anyway: > I did not invent DT bindings. No I did :) Or rather Mitch did with OF and I contributed heavily at slapping it onto everbody's face :) Then I let Grant run with it and deal with the carnage... but as you can imagine, I feel like whatever rule I made for others don't apply to me :) > I did not invent that DT is/should be a >hardware description. This is the basic idea but it's flexible. It is in essence a description of the environment, which is essentially the HW but there is no taboo about adding various ancilliary pieces of informations that one deems useful, especially if they are prefixed by a vendor prefix to avoid collision with "well defined" properties. I think we ended up being fairly strict about the rules initially to try to rein in the crowd of ARM embedded folks who really went all over the place but like every rule, it's meant to be broken (hear the french guy talking ...). >For me, it is a burden that I (as a subsystem > maintainer for mainly drivers) have to prevent people from using DT ?> > for software configuration (some people use it as an 1:1 mapping for > platform data even.) Well, yes and no... for example, it's perfectly legit to have a node representing a UART, have the firmware slap into it the default expected baud rate as a property (or whatever it has configured it to be) which makes it then a reasonable default for the kernel to use. Generally speaking there is nothing fundamentally wrong about having configuration information in the device-tree, but it has to be clearly identifiable as such. The description of the HW in my world at least also implies how that HW is meant to be configured for a given platform. > Since there are no guidelines (probably there can't > be), I developed a set of rules out of experience and when those don't > match I ask for help. Having a different set of rules for > powerpc/arm/... (or server/embedded for that matter) will increase > this burden a lot. People will come and say "But they did it as > well..." The basic rule is "does it make sense ?". Really. Apply your jugement based on your experience as to whether something is a reasonable comprimise or not and whether it will turn into a big mess in the long run or, on the contrary, is a perfectly fine ad-hoc solution for a given setup. > It's getting quite tempting to just throw that driver into powerpc.git Maybe this is the easiest. Just make sure that MAINTAINERS also point this driver to you or PowerNV maintainers. And no Ack from me, please. Then, I can always say "I dunno" if people start asking questions. :) Technically I need your ack if we are to follow the process for Linux upstreaming. I doubt Linux will holler if I just put it in the tree but I'd rather follow the process if possible. >> And I don't give a flying crap about what random ARM SOC vendor >> thinks of my powerpc FW interface for a powerpc unique FW interface. > > But you are not alone here. If you open the box for giving busses a > configurable name, I can see other people (without FW) wanting this, > too. So, this discussion will come anyhow IMO. Right and I personally don't see a problem with that ... what's fundamentally wrong with letting the platform description (ie,. the DT) specify reasonable names for i2c busses ? It has pretty much no impact on drivers nowadays but means things are easier to figure out/locate for users/admin/developers and eases diagnostics. > > If you are ok with the driver and are happy for me to take it, > > please send an Ack. > > "Happy" is not the correct word, but let's just go over with it. Maybe > like this: > > Acked-by: Wolfram Sang (I2C part, excluding the bindings) Forget about the binding mess, Olof reminded me that the result of one of the recent KS was that the bindings no longer needed "approval", and are to be sent to the list purely for informational purposes, otherwise the process is a mess. We have to provide at least some trust here, and we can reject the driver if we think the binding is really way too gross. > > From a binding perspective, it's just a piece of additional info that > > the firmware provides for convenience. > > I do understand the use case. I even agree it makes sense to have > something like this. It is just that I'd prefer a generic, widely > acknowledged solution, with consensus where it belongs and how it should > be named. Not a custom solution which, frankly, feels forced on me > by time pressure I have nothing to do with. So, not happy here, but also > not looking for drama. Let's move on... Adding a generic binding for i2c controllers to name their
Re: [v3] i2c: Driver to expose PowerNV platform i2c busses
On Mon, 2014-08-12 at 06:36:16 UTC, Neelesh Gupta wrote: > The patch exposes the available i2c busses on the PowerNV platform > to the kernel and implements the bus driver to support i2c and > smbus commands. > The driver uses the platform device infrastructure to probe the busses > on the platform and registers them with the i2c driver framework. > arch/powerpc/include/asm/opal.h| 29 ++ > arch/powerpc/platforms/powernv/opal-wrappers.S |1 > arch/powerpc/platforms/powernv/opal.c | 11 + This had major conflicts in the above files. I've fixed it up but please check I did it correctly: https://github.com/mpe/powerpc-merge/commits/pw/neelesh-i2c It also doesn't build as a module: $ grep CONFIG_I2C_OPAL .config CONFIG_I2C_OPAL=m $ make ... ... ERROR: "opal_i2c_request" [drivers/i2c/busses/i2c-opal.ko] undefined! cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [4/5] powerpc, dscr: Added some in-code documentation
On Mon, 2014-08-12 at 06:30:11 UTC, Anshuman Khandual wrote: > This patch adds some in-code documentation to the DSCR related > code to make it more readable without having any functional > change to it. Adding documentation is always good, but ... > diff --git a/arch/powerpc/include/asm/processor.h > b/arch/powerpc/include/asm/processor.h > index dda7ac4..81c1aeb 100644 > --- a/arch/powerpc/include/asm/processor.h > +++ b/arch/powerpc/include/asm/processor.h > @@ -295,6 +295,14 @@ struct thread_struct { > #endif > #ifdef CONFIG_PPC64 > unsigned long dscr; > + /* > + * XXX: dscr_inherit indicates that the process has explicitly Please don't use XXX as a matter of practice. It should be saved for *really* tricky/complicated code, and this isn't that. > diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c > index 67fd2fd..edde3f0 100644 > --- a/arch/powerpc/kernel/sysfs.c > +++ b/arch/powerpc/kernel/sysfs.c > @@ -496,8 +496,21 @@ static DEVICE_ATTR(spurr, 0400, show_spurr, NULL); > static DEVICE_ATTR(purr, 0400, show_purr, store_purr); > static DEVICE_ATTR(pir, 0400, show_pir, NULL); > > +/* > + * XXX: This is the system wide DSCR register default value. > + * Any change to this value through the sysfs interface will > + * update all per-cpu DSCR default values across the system > + * stored in their respective PACA structures. > + */ > static unsigned long dscr_default; Yeah it seems you're right, writing updates the values in all pacas, reading returns the value in the current cpu's paca. So why do we need this copy of the value? > +/* > + * XXX: read_dscr and write_dscr are the functions for the > + * per-cpu DSCR default sysfs files present for each cpu. > + * Though updates to per-cpu DSCR value also gets called > + * for all the CPUs on the system when the system wide > + * global dscr_default gets changed. > + */ > static void read_dscr(void *val) > { Please make these proper kernel-doc comments. I've definitely asked you to do that at least once before on a different patch, to check you can do: $ ./scripts/kernel-doc -text arch/powerpc/kernel/sysfs.c The comments for write_dscr() should be attached to that function. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: powerpc32: missing accessors to pgprot_t objects
On Mon, 2014-08-12 at 14:16:29 UTC, LEROY Christophe wrote: > Compilation with #define STRICT_MM_TYPECHECKS in > arch/powerpc/include/asm/page.h > fails due to missing use of pgprot_val() when using pgprot_t objects. Any idea when this broke? Recently, or has it gone unnoticed for a long time? cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [1/5] powerpc: Fix handling of DSCR related facility unavailable exception
On Mon, 2014-08-12 at 06:30:08 UTC, Anshuman Khandual wrote: > Currently DSCR (Data Stream Control Register) can be accessed with > mfspr or mtspr instructions inside a thread via two different SPR > numbers. One being the user accessible problem state SPR number 0x03 > and the other being the privilege state SPR number 0x11. All access > through the privilege state SPR number get emulated through illegal > instruction exception. Any access through the problem state SPR number > raises one facility unavailable exception which sets the thread based > dscr_inherit bit and enables DSCR facility through FSCR register thus > allowing direct access to DSCR without going through this exception in > the future. We set the thread.dscr_inherit bit whether the access was > with mfspr or mtspr instruction which is neither correct nor does it > match the behaviour through the instruction emulation code path driven > from privilege state SPR number. User currently observes two different > kind of behaviour when accessing the DSCR through these two SPR numbers. > This problem can be observed through these two test cases by replacing > the privilege state SPR number with the problem state SPR number. > > (1) http://ozlabs.org/~anton/junkcode/dscr_default_test.c > (2) http://ozlabs.org/~anton/junkcode/dscr_explicit_test.c Can you convert those into a selftest please? cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: powerpc32: missing accessors to pgprot_t objects
On Tue, 2014-12-09 at 21:06 +1100, Michael Ellerman wrote: > On Mon, 2014-08-12 at 14:16:29 UTC, LEROY Christophe wrote: > > Compilation with #define STRICT_MM_TYPECHECKS in > > arch/powerpc/include/asm/page.h > > fails due to missing use of pgprot_val() when using pgprot_t objects. > > Any idea when this broke? Recently, or has it gone unnoticed for a long time? Probably a very long time... Now the reason we didn't leave STRICT_MM_TYPECHECKS enable back in the day is that gcc was doing a terrible job at compiling it resulting in bloated inefficient code. I wouldn't be surprised if that is all fixed... Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: powerpc32: missing accessors to pgprot_t objects
On Mon, 2014-08-12 at 14:16:29 UTC, LEROY Christophe wrote: > Compilation with #define STRICT_MM_TYPECHECKS in > arch/powerpc/include/asm/page.h > fails due to missing use of pgprot_val() when using pgprot_t objects. Hmm, looks like 64 bit doesn't build either. Aneesh I think you added this, mind fixing it up? In file included from ../arch/powerpc/include/asm/thread_info.h:34:0, from ../include/linux/thread_info.h:54, from ../include/asm-generic/preempt.h:4, from arch/powerpc/include/generated/asm/preempt.h:1, from ../include/linux/preempt.h:18, from ../include/linux/spinlock.h:50, from ../include/linux/mmzone.h:7, from ../include/linux/gfp.h:5, from ../include/linux/mm.h:9, from ../arch/powerpc/mm/tlb_hash64.c:25: ../arch/powerpc/mm/tlb_hash64.c: In function â__flush_hash_table_rangeâ: ../arch/powerpc/include/asm/page.h:286:24: error: request for member âpteâ in something not a structure or union #define pte_val(x) ((x).pte) ^ ../arch/powerpc/mm/tlb_hash64.c:219:37: note: in expansion of macro âpte_valâ trace_hugepage_invalidate(start, pte_val(pte)); ^ make[2]: *** [arch/powerpc/mm/tlb_hash64.o] Error 1 cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [v3] i2c: Driver to expose PowerNV platform i2c busses
On Tue, 2014-12-09 at 20:45 +1100, Michael Ellerman wrote: > On Mon, 2014-08-12 at 06:36:16 UTC, Neelesh Gupta wrote: > > The patch exposes the available i2c busses on the PowerNV platform > > to the kernel and implements the bus driver to support i2c and > > smbus commands. > > The driver uses the platform device infrastructure to probe the busses > > on the platform and registers them with the i2c driver framework. > > > arch/powerpc/include/asm/opal.h| 29 ++ > > arch/powerpc/platforms/powernv/opal-wrappers.S |1 > > arch/powerpc/platforms/powernv/opal.c | 11 + > > This had major conflicts in the above files. > > I've fixed it up but please check I did it correctly: > > https://github.com/mpe/powerpc-merge/commits/pw/neelesh-i2c > > It also doesn't build as a module: > > $ grep CONFIG_I2C_OPAL .config > CONFIG_I2C_OPAL=m > $ make ... > ... > ERROR: "opal_i2c_request" [drivers/i2c/busses/i2c-opal.ko] undefined! Right that needs to be exported, however for those OPAL wrappers to work when exported as modules on an LE kernel with ABI v2 (pfiew !) we need another patch from jk to sort out the external entry to the asm... Jeremy, is that already in or not yet ? Cheers, Ben. > cheers > -- > To unsubscribe from this list: send the line "unsubscribe devicetree" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [4/5] powerpc, dscr: Added some in-code documentation
On 12/09/2014 03:33 PM, Michael Ellerman wrote: > On Mon, 2014-08-12 at 06:30:11 UTC, Anshuman Khandual wrote: >> This patch adds some in-code documentation to the DSCR related >> code to make it more readable without having any functional >> change to it. > > Adding documentation is always good, but ... > >> diff --git a/arch/powerpc/include/asm/processor.h >> b/arch/powerpc/include/asm/processor.h >> index dda7ac4..81c1aeb 100644 >> --- a/arch/powerpc/include/asm/processor.h >> +++ b/arch/powerpc/include/asm/processor.h >> @@ -295,6 +295,14 @@ struct thread_struct { >> #endif >> #ifdef CONFIG_PPC64 >> unsigned long dscr; >> +/* >> + * XXX: dscr_inherit indicates that the process has explicitly > > Please don't use XXX as a matter of practice. > > It should be saved for *really* tricky/complicated code, and this isn't that. Sure, got it. Will remove them. > >> diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c >> index 67fd2fd..edde3f0 100644 >> --- a/arch/powerpc/kernel/sysfs.c >> +++ b/arch/powerpc/kernel/sysfs.c >> @@ -496,8 +496,21 @@ static DEVICE_ATTR(spurr, 0400, show_spurr, NULL); >> static DEVICE_ATTR(purr, 0400, show_purr, store_purr); >> static DEVICE_ATTR(pir, 0400, show_pir, NULL); >> >> +/* >> + * XXX: This is the system wide DSCR register default value. >> + * Any change to this value through the sysfs interface will >> + * update all per-cpu DSCR default values across the system >> + * stored in their respective PACA structures. >> + */ >> static unsigned long dscr_default; > > Yeah it seems you're right, writing updates the values in all pacas, reading > returns the value in the current cpu's paca. So why do we need this copy of > the > value? My comment here might be little confusing. The read_dscr/write_dscr functions are used for per-CPU PACA DSCR values which can read/update the per-CPU PACA variable directly. The functions show_dscr_default/store_dscr_default are used to read/update the system wide DSCR default which is the above 'dscr_default' variable. Function store_dscr_default also calls write_dscr to update PACA on every CPU present on the system. I will re-write the code comment to make more sense. > >> +/* >> + * XXX: read_dscr and write_dscr are the functions for the >> + * per-cpu DSCR default sysfs files present for each cpu. >> + * Though updates to per-cpu DSCR value also gets called >> + * for all the CPUs on the system when the system wide >> + * global dscr_default gets changed. >> + */ >> static void read_dscr(void *val) >> { > > Please make these proper kernel-doc comments. I've definitely asked you to do > that at least once before on a different patch, to check you can do: Yes you had. Thought that this function is too small but as you said if we are writing documentation for it we should write kernel-doc format only. Will make sure about this now onward. > > $ ./scripts/kernel-doc -text arch/powerpc/kernel/sysfs.c > > The comments for write_dscr() should be attached to that function. Sure. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [1/5] powerpc: Fix handling of DSCR related facility unavailable exception
On 12/09/2014 03:41 PM, Michael Ellerman wrote: > On Mon, 2014-08-12 at 06:30:08 UTC, Anshuman Khandual wrote: >> Currently DSCR (Data Stream Control Register) can be accessed with >> mfspr or mtspr instructions inside a thread via two different SPR >> numbers. One being the user accessible problem state SPR number 0x03 >> and the other being the privilege state SPR number 0x11. All access >> through the privilege state SPR number get emulated through illegal >> instruction exception. Any access through the problem state SPR number >> raises one facility unavailable exception which sets the thread based >> dscr_inherit bit and enables DSCR facility through FSCR register thus >> allowing direct access to DSCR without going through this exception in >> the future. We set the thread.dscr_inherit bit whether the access was >> with mfspr or mtspr instruction which is neither correct nor does it >> match the behaviour through the instruction emulation code path driven >> from privilege state SPR number. User currently observes two different >> kind of behaviour when accessing the DSCR through these two SPR numbers. >> This problem can be observed through these two test cases by replacing >> the privilege state SPR number with the problem state SPR number. >> >> (1) http://ozlabs.org/~anton/junkcode/dscr_default_test.c >> (2) http://ozlabs.org/~anton/junkcode/dscr_explicit_test.c > > Can you convert those into a selftest please? Hey Michael, Yeah I wanted to convert all these tests which are related to DSCR into individual self tests for powerpc. All these test cases have Anton Blanchard and IBM's copyright on it but they are licensed with GPL V2. Not sure whether Anton needs to okay this before I can modify them for self tests, put his (Anton's) signed-off-by and then post it in the mailing list. (1) http://ozlabs.org/~anton/junkcode/dscr_default_test.c (2) http://ozlabs.org/~anton/junkcode/dscr_explicit_test.c (3) http://ozlabs.org/~anton/junkcode/dscr_inherit_exec_test.c (4) http://ozlabs.org/~anton/junkcode/dscr_inherit_test.c (5) http://ozlabs.org/~anton/junkcode/user_dscr_test.c ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [v3] i2c: Driver to expose PowerNV platform i2c busses
On 12/09/2014 03:15 PM, Michael Ellerman wrote: On Mon, 2014-08-12 at 06:36:16 UTC, Neelesh Gupta wrote: The patch exposes the available i2c busses on the PowerNV platform to the kernel and implements the bus driver to support i2c and smbus commands. The driver uses the platform device infrastructure to probe the busses on the platform and registers them with the i2c driver framework. arch/powerpc/include/asm/opal.h| 29 ++ arch/powerpc/platforms/powernv/opal-wrappers.S |1 arch/powerpc/platforms/powernv/opal.c | 11 + This had major conflicts in the above files. I've fixed it up but please check I did it correctly: https://github.com/mpe/powerpc-merge/commits/pw/neelesh-i2c It also doesn't build as a module: $ grep CONFIG_I2C_OPAL .config CONFIG_I2C_OPAL=m $ make ... ... ERROR: "opal_i2c_request" [drivers/i2c/busses/i2c-opal.ko] undefined! Yeah, this needs to be exported. I think for the same reason, "opal-rtc" is still waiting, plus awaiting "ack" from maintainers. - Neelesh cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: powerpc32: missing accessors to pgprot_t objects
Michael Ellerman writes: > On Mon, 2014-08-12 at 14:16:29 UTC, LEROY Christophe wrote: >> Compilation with #define STRICT_MM_TYPECHECKS in >> arch/powerpc/include/asm/page.h >> fails due to missing use of pgprot_val() when using pgprot_t objects. > > Hmm, looks like 64 bit doesn't build either. > > Aneesh I think you added this, mind fixing it up? > > In file included from ../arch/powerpc/include/asm/thread_info.h:34:0, > from ../include/linux/thread_info.h:54, > from ../include/asm-generic/preempt.h:4, > from arch/powerpc/include/generated/asm/preempt.h:1, > from ../include/linux/preempt.h:18, > from ../include/linux/spinlock.h:50, > from ../include/linux/mmzone.h:7, > from ../include/linux/gfp.h:5, > from ../include/linux/mm.h:9, > from ../arch/powerpc/mm/tlb_hash64.c:25: > ../arch/powerpc/mm/tlb_hash64.c: In function ‘__flush_hash_table_range’: > ../arch/powerpc/include/asm/page.h:286:24: error: request for member ‘pte’ in > something not a structure or union > #define pte_val(x) ((x).pte) > ^ > ../arch/powerpc/mm/tlb_hash64.c:219:37: note: in expansion of macro ‘pte_val’ > trace_hugepage_invalidate(start, pte_val(pte)); > ^ > make[2]: *** [arch/powerpc/mm/tlb_hash64.o] Error 1 > Will send a proper patch after compile testing with other configs. The kvm hunk is really ugly, will try to rework. diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index 0aa8179..cd0ff37 100644 --- a/arch/powerpc/include/asm/kvm_book3s_64.h +++ b/arch/powerpc/include/asm/kvm_book3s_64.h @@ -291,11 +291,11 @@ static inline pte_t kvmppc_read_update_linux_pte(pte_t *ptep, int writing, pte_t old_pte, new_pte = __pte(0); while (1) { - old_pte = pte_val(*ptep); + old_pte = *ptep; /* * wait until _PAGE_BUSY is clear then set it atomically */ - if (unlikely(old_pte & _PAGE_BUSY)) { + if (unlikely(pte_val(old_pte) & _PAGE_BUSY)) { cpu_relax(); continue; } @@ -306,16 +306,18 @@ static inline pte_t kvmppc_read_update_linux_pte(pte_t *ptep, int writing, return __pte(0); #endif /* If pte is not present return None */ - if (unlikely(!(old_pte & _PAGE_PRESENT))) + if (unlikely(!(pte_val(old_pte) & _PAGE_PRESENT))) return __pte(0); new_pte = pte_mkyoung(old_pte); if (writing && pte_write(old_pte)) new_pte = pte_mkdirty(new_pte); - if (old_pte == __cmpxchg_u64((unsigned long *)ptep, old_pte, -new_pte)) + if (pte_val(old_pte) == __cmpxchg_u64((unsigned long *)ptep, + pte_val(old_pte), + pte_val(new_pte))) { break; + } } return new_pte; } diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index 26fe1ae..cc62ab9 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -278,7 +278,7 @@ extern long long virt_phys_offset; #ifndef __ASSEMBLY__ -#undef STRICT_MM_TYPECHECKS +#define STRICT_MM_TYPECHECKS 1 #ifdef STRICT_MM_TYPECHECKS /* These are used to make use of C type-checking. */ diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index 316f9a5..3e29088 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h @@ -77,8 +77,8 @@ static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr, * which was inherited from x86. For the purposes of powerpc pte_basic_t and * pmd_t are equivalent */ -#define pteval_t pte_basic_t -#define pmdval_t pmd_t +typedef unsigned long pteval_t; +typedef unsigned long pmdval_t; static inline pteval_t ptenuma_flags(pte_t pte) { return pte_val(pte) & _PAGE_NUMA_MASK; diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c index c8d709a..5162936 100644 --- a/arch/powerpc/mm/pgtable_64.c +++ b/arch/powerpc/mm/pgtable_64.c @@ -714,7 +714,7 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr, assert_spin_locked(&mm->page_table_lock); WARN_ON(!pmd_trans_huge(pmd)); #endif - trace_hugepage_set_pmd(addr, pmd); + trace_hugepage_set_pmd(addr, pmd_val(pmd)); return set_pte_at(mm, addr, pmdp_ptep(pmdp), pmd_pte(pmd)); } diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c index d2a94b8..c522969 100644 --- a/arch/powerpc/mm/tlb_hash64.c +++ b/arch/pow
[RFC PATCH 1/8] kprobes: Fix kallsyms lookup across powerpc ABIv1 and ABIv2
Currently, all non-dot symbols are being treated as function descriptors in ABIv1. This is incorrect and is resulting in perf probe not working: # perf probe do_fork Added new event: Failed to write event: Invalid argument Error: Failed to add events. # dmesg | tail -1 [192268.073063] Could not insert probe at _text+768432: -22 _text is being resolved incorrectly and is resulting in the above error. Fix this by changing how we lookup symbol addresses on ppc64. We first check for the dot variant of a symbol and look at the non-dot variant only if that fails. In this manner, we avoid having to look at the function descriptor. Signed-off-by: Naveen N. Rao --- arch/powerpc/include/asm/code-patching.h | 26 +- arch/powerpc/include/asm/kprobes.h | 58 ++-- 2 files changed, 58 insertions(+), 26 deletions(-) diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h index 840a550..19c5bab 100644 --- a/arch/powerpc/include/asm/code-patching.h +++ b/arch/powerpc/include/asm/code-patching.h @@ -47,18 +47,12 @@ void __patch_exception(int exc, unsigned long addr); #define ADDIS_R2_R12 0x3c4cUL #define ADDI_R2_R2 0x3842UL -static inline unsigned long ppc_function_entry(void *func) +static inline unsigned long ppc_local_function_entry(void *func) { -#if defined(CONFIG_PPC64) -#if defined(_CALL_ELF) && _CALL_ELF == 2 +#if defined(CONFIG_PPC64) && defined(_CALL_ELF) && _CALL_ELF == 2 u32 *insn = func; /* -* A PPC64 ABIv2 function may have a local and a global entry -* point. We need to use the local entry point when patching -* functions, so identify and step over the global entry point -* sequence. -* * The global entry point sequence is always of the form: * * addis r2,r12, @@ -76,6 +70,22 @@ static inline unsigned long ppc_function_entry(void *func) else return (unsigned long)func; #else + return (unsigned long)func; +#endif +} + +static inline unsigned long ppc_function_entry(void *func) +{ +#if defined(CONFIG_PPC64) +#if defined(_CALL_ELF) && _CALL_ELF == 2 + /* +* A PPC64 ABIv2 function may have a local and a global entry +* point. We need to use the local entry point when patching +* functions, so identify and step over the global entry point +* sequence. +*/ + return ppc_local_function_entry(func); +#else /* * On PPC64 ABIv1 the function pointer actually points to the * function's descriptor. The first entry in the descriptor is the diff --git a/arch/powerpc/include/asm/kprobes.h b/arch/powerpc/include/asm/kprobes.h index af15d4d..060bdea 100644 --- a/arch/powerpc/include/asm/kprobes.h +++ b/arch/powerpc/include/asm/kprobes.h @@ -42,30 +42,52 @@ typedef ppc_opcode_t kprobe_opcode_t; #ifdef CONFIG_PPC64 /* - * 64bit powerpc uses function descriptors. - * Handle cases where: - * - User passes a <.symbol> or - * - User passes a or - * - User passes a non-existent symbol, kallsyms_lookup_name - * returns 0. Don't deref the NULL pointer in that case + * ppc64[le] uses function descriptors with ABIv1 and global/local + * entry points for ABIv2: + * - Check for the dot variant of the symbol first. If that exists, then + * we know this is ABIv1 and we have the symbol and not the descriptor. + * - If that fails, try looking up the symbol provided. If that works, + * then we either have ABIv1 symbol (not the descriptor) or ABIv2 + * global entry point. + * + * Also handle format. */ #define kprobe_lookup_name(name, addr) \ { \ - addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); \ - if (addr) { \ - char *colon;\ - if ((colon = strchr(name, ':')) != NULL) { \ - colon++;\ - if (*colon != '\0' && *colon != '.')\ - addr = (kprobe_opcode_t *)ppc_function_entry(addr); \ - } else if (name[0] != '.') \ - addr = (kprobe_opcode_t *)ppc_function_entry(addr); \ - } else {\ - char dot_name[KSYM_NAME_LEN]; \ + char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; \ + char *modsym; \ + bool dot_appended = false; \ + if ((modsym = strchr(name, ':')) != NULL) { \ +
[RFC PATCH 0/8] Fix perf probe issues on powerpc
This patchset fixes various issues with perf probe on powerpc across ABIv1 and ABIv2: - in the presence of DWARF debug-info, - in the absence of DWARF, but with the symbol table, and - in the absence of debug-info, but with kallsyms. Applies cleanly on v3.18 and on -tip with minor changes to patch 6. Tested on ppc64 BE and LE. - Naveen Naveen N. Rao (8): kprobes: Fix kallsyms lookup across powerpc ABIv1 and ABIv2 perf probe powerpc: Fix symbol fixup issues due to ELF type perf probe: Improve detection of file/function name in the probe pattern perf probe powerpc: Handle powerpc dot symbols perf probe powerpc: Allow matching against dot symbols perf tools powerpc: Fix PPC64 ELF ABIv2 symbol decoding perf probe powerpc: Use DWARF info only if necessary perf probe powerpc: Fixup function entry if using kallsyms lookup arch/powerpc/include/asm/code-patching.h | 26 arch/powerpc/include/asm/kprobes.h| 58 ++- tools/perf/arch/powerpc/Makefile | 1 + tools/perf/arch/powerpc/util/elf-sym-decode.c | 27 + tools/perf/config/Makefile| 1 + tools/perf/util/elf_sym.h | 13 ++ tools/perf/util/probe-event.c | 57 -- tools/perf/util/symbol-elf.c | 11 - tools/perf/util/symbol.c | 6 +++ 9 files changed, 170 insertions(+), 30 deletions(-) create mode 100644 tools/perf/arch/powerpc/util/elf-sym-decode.c create mode 100644 tools/perf/util/elf_sym.h -- 2.1.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 2/8] perf probe powerpc: Fix symbol fixup issues due to ELF type
If using the symbol table, symbol addresses are not being fixed up properly, resulting in probes being placed at wrong addresses: # perf probe do_fork Added new event: probe:do_fork(on do_fork) You can now use it in all perf tools, such as: perf record -e probe:do_fork -aR sleep 1 # cat /sys/kernel/debug/tracing/kprobe_events p:probe/do_fork _text+635952 # printf "%x" 635952 9b430 # grep do_fork /boot/System.map c00ab430 T .do_fork Fix by checking for ELF type ET_DYN used by ppc64 kernels. Signed-off-by: Naveen N. Rao --- tools/perf/util/symbol-elf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 1e23a5b..67e4392 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -629,7 +629,8 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, NULL) != NULL); } else { ss->adjust_symbols = ehdr.e_type == ET_EXEC || -ehdr.e_type == ET_REL; +ehdr.e_type == ET_REL || +ehdr.e_type == ET_DYN; } ss->name = strdup(name); -- 2.1.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 3/8] perf probe: Improve detection of file/function name in the probe pattern
Currently, perf probe considers patterns including a '.' to be a file. However, this causes problems on powerpc ABIv1 where all functions have a leading '.': $ perf probe -F | grep schedule_timeout_interruptible .schedule_timeout_interruptible $ perf probe .schedule_timeout_interruptible Semantic error :File always requires line number or lazy pattern. Error: Command Parse Error. Fix this by checking the probe pattern in more detail. Signed-off-by: Naveen N. Rao --- tools/perf/util/probe-event.c | 23 --- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index c150ca4..c7e01ef 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -999,6 +999,24 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev) arg = tmp; } + /* +* Check arg is function or file name and copy it. +* +* We consider arg to be a file spec if and only if it satisfies +* all of the below criteria:: +* - it does not include any of "+@%", +* - it includes one of ":;", and +* - it has a period '.' in the name. +* +* Otherwise, we consider arg to be a function specification. +*/ + c = 0; + if (!strpbrk(arg, "+@%") && (ptr = strpbrk(arg, ";:")) != NULL) { + /* This is a file spec if it includes a '.' before ; or : */ + if (memchr(arg, '.', ptr-arg)) + c = 1; + } + ptr = strpbrk(arg, ";:+@%"); if (ptr) { nc = *ptr; @@ -1009,10 +1027,9 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev) if (tmp == NULL) return -ENOMEM; - /* Check arg is function or file and copy it */ - if (strchr(tmp, '.')) /* File */ + if (c == 1) pp->file = tmp; - else/* Function */ + else pp->function = tmp; /* Parse other options */ -- 2.1.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 4/8] perf probe powerpc: Handle powerpc dot symbols
Fix up various perf aspects related to ppc64's usage of dot functions: - ignore leading '.' when generating event names and when looking for existing events. - use the proper prefix when ignoring SyS symbol lookups. Signed-off-by: Naveen N. Rao --- tools/perf/util/probe-event.c | 8 tools/perf/util/symbol.c | 6 ++ 2 files changed, 14 insertions(+) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index c7e01ef..d465f7c 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -2080,6 +2080,10 @@ static int get_new_event_name(char *buf, size_t len, const char *base, { int i, ret; + /* Skip the leading dot on powerpc */ + if (*base == '.') + base++; + /* Try no suffix */ ret = e_snprintf(buf, len, "%s", base); if (ret < 0) { @@ -2538,6 +2542,10 @@ int del_perf_probe_events(struct strlist *dellist) event = str; } + /* Skip the leading dot on powerpc */ + if (event && *event == '.') + event++; + ret = e_snprintf(buf, 128, "%s:%s", group, event); if (ret < 0) { pr_err("Failed to copy event."); diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 0783311..cc04475 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -137,6 +137,12 @@ static int choose_best_symbol(struct symbol *syma, struct symbol *symb) if (na >= 10 && !strncmp(syma->name, "compat_SyS", 10)) return SYMBOL_B; + /* On powerpc, ignore the dot variants */ + if (na >= 4 && !strncmp(syma->name, ".SyS", 4)) + return SYMBOL_B; + if (na >= 11 && !strncmp(syma->name, ".compat_SyS", 11)) + return SYMBOL_B; + return SYMBOL_A; } -- 2.1.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 5/8] perf probe powerpc: Allow matching against dot symbols
Allow perf probe to work on powerpc ABIv1 without the need to specify the leading dot '.' for functions. 'perf probe do_fork' works with this patch. Signed-off-by: Naveen N. Rao --- tools/perf/util/probe-event.c | 9 + 1 file changed, 9 insertions(+) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index d465f7c..174c22e 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -2221,6 +2221,15 @@ static int probe_function_filter(struct map *map __maybe_unused, num_matched_functions++; return 0; } +#ifdef __powerpc64__ + /* Allow matching against the dot variant */ + if (sym->name[0] == '.' && looking_function_name[0] != '.' && + (sym->binding == STB_GLOBAL || sym->binding == STB_LOCAL) && + strcmp(looking_function_name, sym->name+1) == 0) { + num_matched_functions++; + return 0; + } +#endif return 1; } -- 2.1.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 6/8] perf tools powerpc: Fix PPC64 ELF ABIv2 symbol decoding
PPC64 ELF ABIv2 has a Global Entry Point (GEP) and a Local Entry Point (LEP). For purposes of probing, we need the LEP. Offset to the LEP is encoded in st_other. Signed-off-by: Ananth N Mavinakayanahalli Signed-off-by: Naveen N. Rao --- tools/perf/arch/powerpc/Makefile | 1 + tools/perf/arch/powerpc/util/elf-sym-decode.c | 27 +++ tools/perf/config/Makefile| 1 + tools/perf/util/elf_sym.h | 13 + tools/perf/util/symbol-elf.c | 8 5 files changed, 50 insertions(+) create mode 100644 tools/perf/arch/powerpc/util/elf-sym-decode.c create mode 100644 tools/perf/util/elf_sym.h diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile index 6f7782b..8621439 100644 --- a/tools/perf/arch/powerpc/Makefile +++ b/tools/perf/arch/powerpc/Makefile @@ -3,4 +3,5 @@ PERF_HAVE_DWARF_REGS := 1 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/skip-callchain-idx.o endif +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/elf-sym-decode.o LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o diff --git a/tools/perf/arch/powerpc/util/elf-sym-decode.c b/tools/perf/arch/powerpc/util/elf-sym-decode.c new file mode 100644 index 000..7434656 --- /dev/null +++ b/tools/perf/arch/powerpc/util/elf-sym-decode.c @@ -0,0 +1,27 @@ +/* + * Decode offset from Global Entry Point to Local Entry Point on PPC64 + * ELF ABIv2. + * + * Derived from definitions in arch/powerpc/kernel/module_64.c + * + * Copyright (C) 2014 Ananth N Mavinakayanahalli, IBM Corporation. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#include +#include "elf_sym.h" + +/* PowerPC64 ABIv2 specific values for the ELF64_Sym st_other field. */ +#define STO_PPC64_LOCAL_BIT5 +#define STO_PPC64_LOCAL_MASK (7 << STO_PPC64_LOCAL_BIT) +#define PPC64_LOCAL_ENTRY_OFFSET(other) \ + (((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2) + +unsigned int arch_elf_sym_decode_offset(GElf_Sym *sym) +{ + return PPC64_LOCAL_ENTRY_OFFSET(sym->st_other); +} diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 58f6091..8f64557 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -378,6 +378,7 @@ ifeq ($(ARCH),powerpc) ifndef NO_DWARF CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX endif + CFLAGS += -DHAVE_ELF_SYM_DECODE endif ifndef NO_LIBUNWIND diff --git a/tools/perf/util/elf_sym.h b/tools/perf/util/elf_sym.h new file mode 100644 index 000..0176f21 --- /dev/null +++ b/tools/perf/util/elf_sym.h @@ -0,0 +1,13 @@ +#ifndef __PERF_ELF_SYM_H +#define __PERF_ELF_SYM_H + +#ifdef HAVE_ELF_SYM_DECODE +extern unsigned int arch_elf_sym_decode_offset(GElf_Sym *sym); +#else +static inline unsigned int arch_elf_sym_decode_offset(GElf_Sym *sym __maybe_unused) +{ + return 0; +} +#endif + +#endif /* __PERF_ELF_SYM_H */ diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 67e4392..92a424e 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -10,6 +10,7 @@ #include "vdso.h" #include #include "debug.h" +#include "elf_sym.h" #ifndef HAVE_ELF_GETPHDRNUM_SUPPORT static int elf_getphdrnum(Elf *elf, size_t *dst) @@ -848,6 +849,13 @@ int dso__load_sym(struct dso *dso, struct map *map, (sym.st_value & 1)) --sym.st_value; + /* +* PPC64 ELF ABIv2 encodes Local Entry Point offset in +* the st_other field +*/ + if ((map->type == MAP__FUNCTION) && sym.st_other) + sym.st_value += arch_elf_sym_decode_offset(&sym); + if (dso->kernel || kmodule) { char dso_name[PATH_MAX]; -- 2.1.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 7/8] perf probe powerpc: Use DWARF info only if necessary
Use symbol table lookups by default if DWARF is not necessary, since powerpc ABIv2 encodes local entry points in the symbol table and the function entry address in DWARF may not be appropriate for kprobes, as described here: https://sourceware.org/bugzilla/show_bug.cgi?id=17638 Signed-off-by: Naveen N. Rao --- tools/perf/util/probe-event.c | 8 1 file changed, 8 insertions(+) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 174c22e..adcdbd2 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -2382,6 +2382,14 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev, } } +#if defined(__powerpc64__) && defined(_CALL_ELF) && _CALL_ELF == 2 + if (!perf_probe_event_need_dwarf(pev)) { + ret = find_probe_trace_events_from_map(pev, tevs, max_tevs, target); + if (ret > 0) + return ret; /* Found in symbol table */ + } +#endif + /* Convert perf_probe_event with debuginfo */ ret = try_to_find_probe_trace_events(pev, tevs, max_tevs, target); if (ret != 0) -- 2.1.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 8/8] perf probe powerpc: Fixup function entry if using kallsyms lookup
On powerpc ABIv2, if no debug-info is found and we use kallsyms, we need to fixup the function entry to point to the local entry point. Use offset of 8 since current toolchains always generate 2 instructions (8 bytes). Signed-off-by: Naveen N. Rao --- tools/perf/util/probe-event.c | 9 + 1 file changed, 9 insertions(+) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index adcdbd2..0970e2a 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -2318,6 +2318,15 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev, } /* Add one probe point */ tp->address = map->unmap_ip(map, sym->start) + pp->offset; +#if defined(__powerpc64__) && defined(_CALL_ELF) && _CALL_ELF == 2 + /* +* If we used kallsyms, we should fixup the function entry address here. +* ppc64le ABIv2 local entry point is currently always 2 instructions (8 bytes) +* after the global entry point. Fix this if it ever changes. +*/ + if (!pev->uprobes && map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) + tp->address += 8; +#endif if (reloc_sym) { tp->symbol = strdup_or_goto(reloc_sym->name, nomem_out); tp->offset = tp->address - reloc_sym->addr; -- 2.1.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc: Fix compile errors with STRICT_MM_TYPECHECKS enabled
Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/kvm_book3s_64.h | 12 +++- arch/powerpc/include/asm/page.h | 2 +- arch/powerpc/include/asm/pgtable.h | 4 ++-- arch/powerpc/mm/fsl_booke_mmu.c | 2 +- arch/powerpc/mm/pgtable_64.c | 2 +- arch/powerpc/mm/tlb_hash64.c | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index 0aa817933e6a..cd0ff37aea9f 100644 --- a/arch/powerpc/include/asm/kvm_book3s_64.h +++ b/arch/powerpc/include/asm/kvm_book3s_64.h @@ -291,11 +291,11 @@ static inline pte_t kvmppc_read_update_linux_pte(pte_t *ptep, int writing, pte_t old_pte, new_pte = __pte(0); while (1) { - old_pte = pte_val(*ptep); + old_pte = *ptep; /* * wait until _PAGE_BUSY is clear then set it atomically */ - if (unlikely(old_pte & _PAGE_BUSY)) { + if (unlikely(pte_val(old_pte) & _PAGE_BUSY)) { cpu_relax(); continue; } @@ -306,16 +306,18 @@ static inline pte_t kvmppc_read_update_linux_pte(pte_t *ptep, int writing, return __pte(0); #endif /* If pte is not present return None */ - if (unlikely(!(old_pte & _PAGE_PRESENT))) + if (unlikely(!(pte_val(old_pte) & _PAGE_PRESENT))) return __pte(0); new_pte = pte_mkyoung(old_pte); if (writing && pte_write(old_pte)) new_pte = pte_mkdirty(new_pte); - if (old_pte == __cmpxchg_u64((unsigned long *)ptep, old_pte, -new_pte)) + if (pte_val(old_pte) == __cmpxchg_u64((unsigned long *)ptep, + pte_val(old_pte), + pte_val(new_pte))) { break; + } } return new_pte; } diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index 26fe1ae15212..cc62ab9644b6 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -278,7 +278,7 @@ extern long long virt_phys_offset; #ifndef __ASSEMBLY__ -#undef STRICT_MM_TYPECHECKS +#define STRICT_MM_TYPECHECKS 1 #ifdef STRICT_MM_TYPECHECKS /* These are used to make use of C type-checking. */ diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index 316f9a5da173..3e290888ed37 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h @@ -77,8 +77,8 @@ static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr, * which was inherited from x86. For the purposes of powerpc pte_basic_t and * pmd_t are equivalent */ -#define pteval_t pte_basic_t -#define pmdval_t pmd_t +typedef unsigned long pteval_t; +typedef unsigned long pmdval_t; static inline pteval_t ptenuma_flags(pte_t pte) { return pte_val(pte) & _PAGE_NUMA_MASK; diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c index 94cd728166d3..a7a1b9b45eeb 100644 --- a/arch/powerpc/mm/fsl_booke_mmu.c +++ b/arch/powerpc/mm/fsl_booke_mmu.c @@ -183,7 +183,7 @@ static unsigned long map_mem_in_cams_addr(phys_addr_t phys, unsigned long virt, unsigned long cam_sz; cam_sz = calc_cam_sz(ram, virt, phys); - settlbcam(i, virt, phys, cam_sz, PAGE_KERNEL_X, 0); + settlbcam(i, virt, phys, cam_sz, pgprot_val(PAGE_KERNEL_X), 0); ram -= cam_sz; amount_mapped += cam_sz; diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c index c8d709ab489d..5162936c0c34 100644 --- a/arch/powerpc/mm/pgtable_64.c +++ b/arch/powerpc/mm/pgtable_64.c @@ -714,7 +714,7 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr, assert_spin_locked(&mm->page_table_lock); WARN_ON(!pmd_trans_huge(pmd)); #endif - trace_hugepage_set_pmd(addr, pmd); + trace_hugepage_set_pmd(addr, pmd_val(pmd)); return set_pte_at(mm, addr, pmdp_ptep(pmdp), pmd_pte(pmd)); } diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c index d2a94b85dbc2..c522969f012d 100644 --- a/arch/powerpc/mm/tlb_hash64.c +++ b/arch/powerpc/mm/tlb_hash64.c @@ -216,7 +216,7 @@ void __flush_hash_table_range(struct mm_struct *mm, unsigned long start, continue; pte = pte_val(*ptep); if (hugepage_shift) - trace_hugepage_invalidate(start, pte_val(pte)); + trace_hugepage_invalidate(start, pte); if (!(pte & _PAGE_HASHPTE)) continue; if (unlikely(hugepage_shift && pmd_
[PATCH V2] powerpc: Fix compile errors with STRICT_MM_TYPECHECKS enabled
Signed-off-by: Aneesh Kumar K.V --- Changes from V1 * Don't enable STRICT_MM_TYPECHECK for upstream arch/powerpc/include/asm/kvm_book3s_64.h | 12 +++- arch/powerpc/include/asm/pgtable.h | 4 ++-- arch/powerpc/mm/fsl_booke_mmu.c | 2 +- arch/powerpc/mm/pgtable_64.c | 2 +- arch/powerpc/mm/tlb_hash64.c | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index 0aa817933e6a..cd0ff37aea9f 100644 --- a/arch/powerpc/include/asm/kvm_book3s_64.h +++ b/arch/powerpc/include/asm/kvm_book3s_64.h @@ -291,11 +291,11 @@ static inline pte_t kvmppc_read_update_linux_pte(pte_t *ptep, int writing, pte_t old_pte, new_pte = __pte(0); while (1) { - old_pte = pte_val(*ptep); + old_pte = *ptep; /* * wait until _PAGE_BUSY is clear then set it atomically */ - if (unlikely(old_pte & _PAGE_BUSY)) { + if (unlikely(pte_val(old_pte) & _PAGE_BUSY)) { cpu_relax(); continue; } @@ -306,16 +306,18 @@ static inline pte_t kvmppc_read_update_linux_pte(pte_t *ptep, int writing, return __pte(0); #endif /* If pte is not present return None */ - if (unlikely(!(old_pte & _PAGE_PRESENT))) + if (unlikely(!(pte_val(old_pte) & _PAGE_PRESENT))) return __pte(0); new_pte = pte_mkyoung(old_pte); if (writing && pte_write(old_pte)) new_pte = pte_mkdirty(new_pte); - if (old_pte == __cmpxchg_u64((unsigned long *)ptep, old_pte, -new_pte)) + if (pte_val(old_pte) == __cmpxchg_u64((unsigned long *)ptep, + pte_val(old_pte), + pte_val(new_pte))) { break; + } } return new_pte; } diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index 316f9a5da173..3e290888ed37 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h @@ -77,8 +77,8 @@ static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr, * which was inherited from x86. For the purposes of powerpc pte_basic_t and * pmd_t are equivalent */ -#define pteval_t pte_basic_t -#define pmdval_t pmd_t +typedef unsigned long pteval_t; +typedef unsigned long pmdval_t; static inline pteval_t ptenuma_flags(pte_t pte) { return pte_val(pte) & _PAGE_NUMA_MASK; diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c index 94cd728166d3..a7a1b9b45eeb 100644 --- a/arch/powerpc/mm/fsl_booke_mmu.c +++ b/arch/powerpc/mm/fsl_booke_mmu.c @@ -183,7 +183,7 @@ static unsigned long map_mem_in_cams_addr(phys_addr_t phys, unsigned long virt, unsigned long cam_sz; cam_sz = calc_cam_sz(ram, virt, phys); - settlbcam(i, virt, phys, cam_sz, PAGE_KERNEL_X, 0); + settlbcam(i, virt, phys, cam_sz, pgprot_val(PAGE_KERNEL_X), 0); ram -= cam_sz; amount_mapped += cam_sz; diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c index c8d709ab489d..5162936c0c34 100644 --- a/arch/powerpc/mm/pgtable_64.c +++ b/arch/powerpc/mm/pgtable_64.c @@ -714,7 +714,7 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr, assert_spin_locked(&mm->page_table_lock); WARN_ON(!pmd_trans_huge(pmd)); #endif - trace_hugepage_set_pmd(addr, pmd); + trace_hugepage_set_pmd(addr, pmd_val(pmd)); return set_pte_at(mm, addr, pmdp_ptep(pmdp), pmd_pte(pmd)); } diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c index d2a94b85dbc2..c522969f012d 100644 --- a/arch/powerpc/mm/tlb_hash64.c +++ b/arch/powerpc/mm/tlb_hash64.c @@ -216,7 +216,7 @@ void __flush_hash_table_range(struct mm_struct *mm, unsigned long start, continue; pte = pte_val(*ptep); if (hugepage_shift) - trace_hugepage_invalidate(start, pte_val(pte)); + trace_hugepage_invalidate(start, pte); if (!(pte & _PAGE_HASHPTE)) continue; if (unlikely(hugepage_shift && pmd_trans_huge(*(pmd_t *)pte))) -- 2.1.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v4 0/4] powernv: cpuidle: Redesign idle states management
Deep idle states like sleep and winkle are per core idle states. A core enters these states only when all the threads enter either the particular idle state or a deeper one. There are tasks like fastsleep hardware bug workaround and hypervisor core state save which have to be done only by the last thread of the core entering deep idle state and similarly tasks like timebase resync, hypervisor core register restore that have to be done only by the first thread waking up from these states. The current idle state management does not have a way to distinguish the first/last thread of the core waking/entering idle states. Tasks like timebase resync are done for all the threads. This is not only is suboptimal, but can cause functionality issues when subcores are involved. Winkle is deeper idle state compared to fastsleep. In this state the power supply to the chiplet, i.e core, private L2 and private L3 is turned off. This results in a total hypervisor state loss. This patch set adds support for winkle and provides a way to track the idle states of the threads of the core and use it for idle state management of idle states sleep and winkle. Note- This patch set requires "powerpc: powernv: Return to cpu offline loop when finished in KVM guest" (http://patchwork.ozlabs.org/patch/417240/) TBD: - Remove duplication of branching to kvm code. Changes in v4: -- - Based patches on top of http://patchwork.ozlabs.org/patch/417240/ - isync ordering fix. - Save/Restore SRR1 value so that it doesn't get clobbered by opal_call_realmode. - Changed HSPRG0 handling. - Comment fixes. Changes in v3: - - Added barriers after lock - Added a paca field to that stores thread mask. - Changed code structure around fastsleep workaround, to allow for manual patching out if the platform does not require it. - Threads waiting on core_idle_state lock now loop in HMT_LOW - Using NV CRs to avoid save/restore of CR while making OPAL calls. - Fixed couple of flow issues in path where fastsleep workaround was not needed - Using PPC_LR_STKOFF instead of _LINK in opal_call_realmode - Restoring WORT and WORC Changes in v2: -- -Using PNV_THREAD_NAP/SLEEP defines while calling power7_powersave_common -Comment changes based on review -Rebased on top of 3.18-rc6 Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Rafael J. Wysocki Cc: linux...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: Vaidyanathan Srinivasan Cc: Preeti U Murthy Paul Mackerras (1): powerpc: powernv: Switch off MMU before entering nap/sleep/rvwinkle mode Preeti U. Murthy (1): powerpc/powernv: Enable Offline CPUs to enter deep idle states Shreyas B. Prabhu (2): powernv: cpuidle: Redesign idle states management powernv: powerpc: Add winkle support for offline cpus arch/powerpc/include/asm/cpuidle.h | 14 ++ arch/powerpc/include/asm/opal.h| 13 + arch/powerpc/include/asm/paca.h| 6 + arch/powerpc/include/asm/ppc-opcode.h | 2 + arch/powerpc/include/asm/processor.h | 1 + arch/powerpc/include/asm/reg.h | 4 + arch/powerpc/kernel/asm-offsets.c | 6 + arch/powerpc/kernel/cpu_setup_power.S | 4 + arch/powerpc/kernel/exceptions-64s.S | 30 ++- arch/powerpc/kernel/idle_power7.S | 332 + arch/powerpc/platforms/powernv/opal-wrappers.S | 39 +++ arch/powerpc/platforms/powernv/powernv.h | 2 + arch/powerpc/platforms/powernv/setup.c | 160 arch/powerpc/platforms/powernv/smp.c | 10 +- arch/powerpc/platforms/powernv/subcore.c | 34 +++ arch/powerpc/platforms/powernv/subcore.h | 1 + drivers/cpuidle/cpuidle-powernv.c | 10 +- 17 files changed, 608 insertions(+), 60 deletions(-) create mode 100644 arch/powerpc/include/asm/cpuidle.h -- 1.9.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v4 1/4] powerpc: powernv: Switch off MMU before entering nap/sleep/rvwinkle mode
From: Paul Mackerras Currently, when going idle, we set the flag indicating that we are in nap mode (paca->kvm_hstate.hwthread_state) and then execute the nap (or sleep or rvwinkle) instruction, all with the MMU on. This is bad for two reasons: (a) the architecture specifies that those instructions must be executed with the MMU off, and in fact with only the SF, HV, ME and possibly RI bits set, and (b) this introduces a race, because as soon as we set the flag, another thread can switch the MMU to a guest context. If the race is lost, this thread will typically start looping on relocation-on ISIs at 0xc...4400. This fixes it by setting the MSR as required by the architecture before setting the flag or executing the nap/sleep/rvwinkle instruction. [ shre...@linux.vnet.ibm.com: Edited to handle LE ] Signed-off-by: Paul Mackerras Signed-off-by: Shreyas B. Prabhu Cc: Benjamin Herrenschmidt Cc: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/include/asm/reg.h| 2 ++ arch/powerpc/kernel/idle_power7.S | 18 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index c998279..a68ee15 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h @@ -118,8 +118,10 @@ #define __MSR (MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_ISF |MSR_HV) #ifdef __BIG_ENDIAN__ #define MSR_ __MSR +#define MSR_IDLE (MSR_ME | MSR_SF | MSR_HV) #else #define MSR_ (__MSR | MSR_LE) +#define MSR_IDLE (MSR_ME | MSR_SF | MSR_HV | MSR_LE) #endif #define MSR_KERNEL (MSR_ | MSR_64BIT) #define MSR_USER32 (MSR_ | MSR_PR | MSR_EE) diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S index 18c0687..e5aba6a 100644 --- a/arch/powerpc/kernel/idle_power7.S +++ b/arch/powerpc/kernel/idle_power7.S @@ -101,7 +101,23 @@ _GLOBAL(power7_powersave_common) std r9,_MSR(r1) std r1,PACAR1(r13) -_GLOBAL(power7_enter_nap_mode) + /* +* Go to real mode to do the nap, as required by the architecture. +* Also, we need to be in real mode before setting hwthread_state, +* because as soon as we do that, another thread can switch +* the MMU context to the guest. +*/ + LOAD_REG_IMMEDIATE(r5, MSR_IDLE) + li r6, MSR_RI + andcr6, r9, r6 + LOAD_REG_ADDR(r7, power7_enter_nap_mode) + mtmsrd r6, 1 /* clear RI before setting SRR0/1 */ + mtspr SPRN_SRR0, r7 + mtspr SPRN_SRR1, r5 + rfid + + .globl power7_enter_nap_mode +power7_enter_nap_mode: #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE /* Tell KVM we're napping */ li r4,KVM_HWTHREAD_IN_NAP -- 1.9.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v4 2/4] powerpc/powernv: Enable Offline CPUs to enter deep idle states
The secondary threads should enter deep idle states so as to gain maximum powersavings when the entire core is offline. To do so the offline path must be made aware of the available deepest idle state. Hence probe the device tree for the possible idle states in powernv core code and expose the deepest idle state through flags. Since the device tree is probed by the cpuidle driver as well, move the parameters required to discover the idle states into an appropriate common place to both the driver and the powernv core code. Another point is that fastsleep idle state may require workarounds in the kernel to function properly. This workaround is introduced in the subsequent patches. However neither the cpuidle driver or the hotplug path need be bothered about this workaround. They will be taken care of by the core powernv code. Originally-by: Srivatsa S. Bhat Signed-off-by: Preeti U. Murthy Signed-off-by: Shreyas B. Prabhu Reviewed-by: Paul Mackerras Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Rafael J. Wysocki Cc: linux...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/include/asm/opal.h | 8 ++ arch/powerpc/platforms/powernv/powernv.h | 2 ++ arch/powerpc/platforms/powernv/setup.c | 49 arch/powerpc/platforms/powernv/smp.c | 7 - drivers/cpuidle/cpuidle-powernv.c| 9 ++ 5 files changed, 68 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 9124b0e..f8b95c0 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -155,6 +155,14 @@ struct opal_sg_list { #define OPAL_REGISTER_DUMP_REGION 101 #define OPAL_UNREGISTER_DUMP_REGION102 +/* Device tree flags */ + +/* Flags set in power-mgmt nodes in device tree if + * respective idle states are supported in the platform. + */ +#define OPAL_PM_NAP_ENABLED0x0001 +#define OPAL_PM_SLEEP_ENABLED 0x0002 + #ifndef __ASSEMBLY__ #include diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h index 6c8e2d1..604c48e 100644 --- a/arch/powerpc/platforms/powernv/powernv.h +++ b/arch/powerpc/platforms/powernv/powernv.h @@ -29,6 +29,8 @@ static inline u64 pnv_pci_dma_get_required_mask(struct pci_dev *pdev) } #endif +extern u32 pnv_get_supported_cpuidle_states(void); + extern void pnv_lpc_init(void); bool cpu_core_split_required(void); diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c index 3f9546d..34c6665 100644 --- a/arch/powerpc/platforms/powernv/setup.c +++ b/arch/powerpc/platforms/powernv/setup.c @@ -290,6 +290,55 @@ static void __init pnv_setup_machdep_rtas(void) } #endif /* CONFIG_PPC_POWERNV_RTAS */ +static u32 supported_cpuidle_states; + +u32 pnv_get_supported_cpuidle_states(void) +{ + return supported_cpuidle_states; +} + +static int __init pnv_init_idle_states(void) +{ + struct device_node *power_mgt; + int dt_idle_states; + const __be32 *idle_state_flags; + u32 len_flags, flags; + int i; + + supported_cpuidle_states = 0; + + if (cpuidle_disable != IDLE_NO_OVERRIDE) + return 0; + + if (!firmware_has_feature(FW_FEATURE_OPALv3)) + return 0; + + power_mgt = of_find_node_by_path("/ibm,opal/power-mgt"); + if (!power_mgt) { + pr_warn("opal: PowerMgmt Node not found\n"); + return 0; + } + + idle_state_flags = of_get_property(power_mgt, + "ibm,cpu-idle-state-flags", &len_flags); + if (!idle_state_flags) { + pr_warn("DT-PowerMgmt: missing ibm,cpu-idle-state-flags\n"); + return 0; + } + + dt_idle_states = len_flags / sizeof(u32); + + for (i = 0; i < dt_idle_states; i++) { + flags = be32_to_cpu(idle_state_flags[i]); + supported_cpuidle_states |= flags; + } + + return 0; +} + +subsys_initcall(pnv_init_idle_states); + + static int __init pnv_probe(void) { unsigned long root = of_get_flat_dt_root(); diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c index b716f66..83299ef 100644 --- a/arch/powerpc/platforms/powernv/smp.c +++ b/arch/powerpc/platforms/powernv/smp.c @@ -150,6 +150,7 @@ static void pnv_smp_cpu_kill_self(void) { unsigned int cpu; unsigned long srr1; + u32 idle_states; /* Standard hot unplug procedure */ local_irq_disable(); @@ -160,13 +161,17 @@ static void pnv_smp_cpu_kill_self(void) generic_set_cpu_dead(cpu); smp_wmb(); + idle_states = pnv_get_supported_cpuidle_states(); /* We don't want to take decrementer interrupts while we are offline, * so clear LPCR:PECE1. We keep PECE2 enabled. */ mtspr(SPRN_LPCR, mfspr(SPRN_L
[PATCH v4 3/4] powernv: cpuidle: Redesign idle states management
Deep idle states like sleep and winkle are per core idle states. A core enters these states only when all the threads enter either the particular idle state or a deeper one. There are tasks like fastsleep hardware bug workaround and hypervisor core state save which have to be done only by the last thread of the core entering deep idle state and similarly tasks like timebase resync, hypervisor core register restore that have to be done only by the first thread waking up from these state. The current idle state management does not have a way to distinguish the first/last thread of the core waking/entering idle states. Tasks like timebase resync are done for all the threads. This is not only is suboptimal, but can cause functionality issues when subcores and kvm is involved. This patch adds the necessary infrastructure to track idle states of threads in a per-core structure. It uses this info to perform tasks like fastsleep workaround and timebase resync only once per core. Signed-off-by: Shreyas B. Prabhu Originally-by: Preeti U. Murthy Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Rafael J. Wysocki Cc: linux...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/include/asm/cpuidle.h | 20 +++ arch/powerpc/include/asm/opal.h| 2 + arch/powerpc/include/asm/paca.h| 6 + arch/powerpc/include/asm/processor.h | 2 +- arch/powerpc/kernel/asm-offsets.c | 6 + arch/powerpc/kernel/exceptions-64s.S | 24 +-- arch/powerpc/kernel/idle_power7.S | 197 +++-- arch/powerpc/platforms/powernv/opal-wrappers.S | 37 + arch/powerpc/platforms/powernv/setup.c | 49 +- arch/powerpc/platforms/powernv/smp.c | 3 +- drivers/cpuidle/cpuidle-powernv.c | 3 +- 11 files changed, 291 insertions(+), 58 deletions(-) create mode 100644 arch/powerpc/include/asm/cpuidle.h diff --git a/arch/powerpc/include/asm/cpuidle.h b/arch/powerpc/include/asm/cpuidle.h new file mode 100644 index 000..d2f99ca --- /dev/null +++ b/arch/powerpc/include/asm/cpuidle.h @@ -0,0 +1,20 @@ +#ifndef _ASM_POWERPC_CPUIDLE_H +#define _ASM_POWERPC_CPUIDLE_H + +#ifdef CONFIG_PPC_POWERNV +/* Used in powernv idle state management */ +#define PNV_THREAD_RUNNING 0 +#define PNV_THREAD_NAP 1 +#define PNV_THREAD_SLEEP2 +#define PNV_THREAD_WINKLE 3 +#define PNV_CORE_IDLE_LOCK_BIT 0x100 +#define PNV_CORE_IDLE_THREAD_BITS 0x0FF + +#ifndef __ASSEMBLY__ +extern u32 pnv_fastsleep_workaround_at_entry[]; +extern u32 pnv_fastsleep_workaround_at_exit[]; +#endif + +#endif + +#endif diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index f8b95c0..bef7fbc 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -152,6 +152,7 @@ struct opal_sg_list { #define OPAL_PCI_ERR_INJECT96 #define OPAL_PCI_EEH_FREEZE_SET97 #define OPAL_HANDLE_HMI98 +#define OPAL_CONFIG_CPU_IDLE_STATE 99 #define OPAL_REGISTER_DUMP_REGION 101 #define OPAL_UNREGISTER_DUMP_REGION102 @@ -162,6 +163,7 @@ struct opal_sg_list { */ #define OPAL_PM_NAP_ENABLED0x0001 #define OPAL_PM_SLEEP_ENABLED 0x0002 +#define OPAL_PM_SLEEP_ENABLED_ER1 0x0008 #ifndef __ASSEMBLY__ diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h index a5139ea..e2c4737 100644 --- a/arch/powerpc/include/asm/paca.h +++ b/arch/powerpc/include/asm/paca.h @@ -158,6 +158,12 @@ struct paca_struct { * early exception handler for use by high level C handler */ struct opal_machine_check_event *opal_mc_evt; + + /* Per-core mask tracking idle threads and a lock bit-[L][] */ + u32 *core_idle_state_ptr; + u8 thread_idle_state; /* PNV_THREAD_RUNNING/NAP/SLEEP */ + /* Mask to indicate thread id in core */ + u8 thread_mask; #endif #ifdef CONFIG_PPC_BOOK3S_64 /* Exclusive emergency stack pointer for machine check exception. */ diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 29c3798..f5c45b3 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h @@ -452,7 +452,7 @@ enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF}; extern int powersave_nap; /* set if nap mode can be used in idle loop */ extern unsigned long power7_nap(int check_irq); -extern void power7_sleep(void); +extern unsigned long power7_sleep(void); extern void flush_instruction_cache(void); extern void hard_reset_now(void); extern void poweroff_now(void); diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 9d7dede..3bc0352 100644 --- a/arch/powerpc/kernel/asm-offset
[PATCH v4 4/4] powernv: powerpc: Add winkle support for offline cpus
Winkle is a deep idle state supported in power8 chips. A core enters winkle when all the threads of the core enter winkle. In this state power supply to the entire chiplet i.e core, private L2 and private L3 is turned off. As a result it gives higher powersavings compared to sleep. But entering winkle results in a total hypervisor state loss. Hence the hypervisor context has to be preserved before entering winkle and restored upon wake up. Power-on Reset Engine (PORE) is a dedicated engine which is responsible for powering on the chiplet during wake up. It can be programmed to restore the register contests of a few specific registers. This patch uses PORE to restore register state wherever possible and uses stack to save and restore rest of the necessary registers. With hypervisor state restore things fall under three categories- per-core state, per-subcore state and per-thread state. To manage this, extend the infrastructure introduced for sleep. Mainly we add a paca variable subcore_sibling_mask. Using this and the core_idle_state we can distingush first thread in core and subcore. Signed-off-by: Shreyas B. Prabhu Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/include/asm/opal.h| 3 + arch/powerpc/include/asm/paca.h| 2 + arch/powerpc/include/asm/ppc-opcode.h | 2 + arch/powerpc/include/asm/processor.h | 1 + arch/powerpc/include/asm/reg.h | 2 + arch/powerpc/kernel/asm-offsets.c | 2 + arch/powerpc/kernel/exceptions-64s.S | 11 +- arch/powerpc/kernel/idle_power7.S | 141 +++-- arch/powerpc/platforms/powernv/opal-wrappers.S | 1 + arch/powerpc/platforms/powernv/setup.c | 73 + arch/powerpc/platforms/powernv/smp.c | 4 +- arch/powerpc/platforms/powernv/subcore.c | 34 ++ arch/powerpc/platforms/powernv/subcore.h | 1 + 13 files changed, 266 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index bef7fbc..f0ca2d9 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -153,6 +153,7 @@ struct opal_sg_list { #define OPAL_PCI_EEH_FREEZE_SET97 #define OPAL_HANDLE_HMI98 #define OPAL_CONFIG_CPU_IDLE_STATE 99 +#define OPAL_SLW_SET_REG 100 #define OPAL_REGISTER_DUMP_REGION 101 #define OPAL_UNREGISTER_DUMP_REGION102 @@ -163,6 +164,7 @@ struct opal_sg_list { */ #define OPAL_PM_NAP_ENABLED0x0001 #define OPAL_PM_SLEEP_ENABLED 0x0002 +#define OPAL_PM_WINKLE_ENABLED 0x0004 #define OPAL_PM_SLEEP_ENABLED_ER1 0x0008 #ifndef __ASSEMBLY__ @@ -972,6 +974,7 @@ int64_t opal_sensor_read(uint32_t sensor_hndl, int token, __be32 *sensor_data); int64_t opal_handle_hmi(void); int64_t opal_register_dump_region(uint32_t id, uint64_t start, uint64_t end); int64_t opal_unregister_dump_region(uint32_t id); +int64_t opal_slw_set_reg(uint64_t cpu_pir, uint64_t sprn, uint64_t val); int64_t opal_pci_set_phb_cxl_mode(uint64_t phb_id, uint64_t mode, uint64_t pe_number); /* Internal functions */ diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h index e2c4737..c979577 100644 --- a/arch/powerpc/include/asm/paca.h +++ b/arch/powerpc/include/asm/paca.h @@ -164,6 +164,8 @@ struct paca_struct { u8 thread_idle_state; /* PNV_THREAD_RUNNING/NAP/SLEEP */ /* Mask to indicate thread id in core */ u8 thread_mask; + /* Mask to denote subcore sibling threads */ + u8 subcore_sibling_mask; #endif #ifdef CONFIG_PPC_BOOK3S_64 /* Exclusive emergency stack pointer for machine check exception. */ diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h index 6f85362..5155be7 100644 --- a/arch/powerpc/include/asm/ppc-opcode.h +++ b/arch/powerpc/include/asm/ppc-opcode.h @@ -194,6 +194,7 @@ #define PPC_INST_NAP 0x4c000364 #define PPC_INST_SLEEP 0x4c0003a4 +#define PPC_INST_WINKLE0x4c0003e4 /* A2 specific instructions */ #define PPC_INST_ERATWE0x7c0001a6 @@ -374,6 +375,7 @@ #define PPC_NAPstringify_in_c(.long PPC_INST_NAP) #define PPC_SLEEP stringify_in_c(.long PPC_INST_SLEEP) +#define PPC_WINKLE stringify_in_c(.long PPC_INST_WINKLE) /* BHRB instructions */ #define PPC_CLRBHRBstringify_in_c(.long PPC_INST_CLRBHRB) diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index f5c45b3..bf117d8 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h @@ -453,6 +453,7 @@ enum idle_boot_override {IDLE_NO_OVERRIDE = 0,
Re: linux-next: build failure after merge of the access_once tree
Am 08.12.2014 um 12:26 schrieb Stephen Rothwell: > Hi Christian, > > After merging the acess_once tree, today's linux-next build (powerpc > allnoconfig) failed like this: > > arch/powerpc/mm/hugetlbpage.c: In function 'find_linux_pte_or_hugepte': > arch/powerpc/mm/hugetlbpage.c:981:3: error: invalid initializer >pud = ACCESS_ONCE(*pudp); >^ > arch/powerpc/mm/hugetlbpage.c:993:4: error: invalid initializer > pmd = ACCESS_ONCE(*pmdp); > ^ > > These are preexisting ... > > mm/gup.c: In function 'gup_pmd_range': > mm/gup.c:929:3: error: invalid initializer >pmd_t pmd = ACCESS_ONCE(*pmdp); >^ > mm/gup.c:929:3: error: (near initialization for 'pmd') > > This is from commit f30c59e921f1 ("mm: Update generic gup > implementation to handle hugepage directory") from the powerpc-mpe (and > powerpc) tree and so will require a merge fix patch (presumable > s/ACCESS_ONCE/READ_ONCE/). > > I am not sure how many architectures you are trying to cover, but > powerpc is one I care about :-) > > I have dropped the access_once tree again today, sorry (its too late at > night). > Next try. I removed the change of ACCESS_ONCE and just left the new interfaces and the simple reworks in the queue. I will tackle everything else after rc1 when next should be small again. Keeping fingers crossed Christian ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/1] uio: uio_fsl_elbc_gpcm: new driver
[Trimmed excessive CC list] On Tue, 2014-12-09 at 17:43 +0100, John Ogness wrote: > This driver provides UIO access to memory of a peripheral connected > to the Freescale enhanced local bus controller (eLBC) interface > using the general purpose chip-select mode (GPCM). > > Signed-off-by: John Ogness > --- > There are currently drivers that use FCM and UPM modes. But there > are no drivers using the very simple GPCM mode. Yes, there are -- the NOR flash driver, various board FPGAs, etc. > If other drivers from other subsystems should start using this mode > (for example, mtd, eeprom, char) then it may make sense to try to > implement generic GPCM support in arch/powerpc/sysdev/fsl_lbc.c. It's already there, though all that's needed is error handling. Setting up the chipselects is handled in U-Boot (same as with FCM -- and probably UPM, though I'm less familiar with that). > diff --git a/Documentation/devicetree/bindings/powerpc/fsl/lbc.txt > b/Documentation/devicetree/bindings/powerpc/fsl/lbc.txt > index 3300fec..1c80fce 100644 > --- a/Documentation/devicetree/bindings/powerpc/fsl/lbc.txt > +++ b/Documentation/devicetree/bindings/powerpc/fsl/lbc.txt > @@ -16,20 +16,28 @@ Example: > "fsl,pq2-localbus"; > #address-cells = <2>; > #size-cells = <1>; > - reg = ; > + reg = <0xf0010100 0x40>; > > - ranges = <0 0 fe00 0200 > - 1 0 f450 8000>; > + ranges = <0x0 0x0 0xfe00 0x0200 > + 0x1 0x0 0xf450 0x8000 > + 0x2 0x0 0xfd81 0x0001>; > > flash@0,0 { > compatible = "jedec-flash"; > - reg = <0 0 200>; > + reg = <0x0 0x0 0x200>; > bank-width = <4>; > device-width = <1>; > }; > > board-control@1,0 { > - reg = <1 0 20>; > + reg = <0x1 0x0 0x20>; > compatible = "fsl,mpc8272ads-bcsr"; > }; > + Ideally this sort of cleanup change would be a separate patch. > + simple-periph@2,0 { > + compatible = "fsl,elbc-gpcm-uio"; > + reg = <0x2 0x0 0x1>; > + elbc-gpcm-br = <0xfd810800>; > + elbc-gpcm-or = <0x09f7>; > + }; This is not an acceptable compatible string. Compatible should describe what the hardware is, not how you plan to use it in Linux. I also see no description of elbc-gpcm-br/or, and in general putting register values in the device tree is not a good idea. As with compatible, the device tree should describe the hardware, not how to configure it. > }; > diff --git a/arch/powerpc/include/asm/fsl_lbc.h > b/arch/powerpc/include/asm/fsl_lbc.h > index 067fb0d..c7240a0 100644 > --- a/arch/powerpc/include/asm/fsl_lbc.h > +++ b/arch/powerpc/include/asm/fsl_lbc.h > @@ -95,6 +95,9 @@ struct fsl_lbc_bank { > #define OR_FCM_TRLX_SHIFT2 > #define OR_FCM_EHTR 0x0002 > #define OR_FCM_EHTR_SHIFT1 > + > +#define OR_GPCM_AM 0x8000 > +#define OR_GPCM_AM_SHIFT 15 > }; Please maintain a consistent whitespace style with what's already there. > diff --git a/drivers/uio/uio_fsl_elbc_gpcm.c b/drivers/uio/uio_fsl_elbc_gpcm.c > new file mode 100644 > index 000..b6cac91 > --- /dev/null > +++ b/drivers/uio/uio_fsl_elbc_gpcm.c > @@ -0,0 +1,499 @@ > +/* uio_fsl_elbc_gpcm: UIO driver for eLBC/GPCM peripherals > + > + Copyright (C) 2014 Linutronix GmbH > + Author: John Ogness > + > + This driver provides UIO access to memory of a peripheral connected > + to the Freescale enhanced local bus controller (eLBC) interface > + using the general purpose chip-select mode (GPCM). > + > + Here is an example of the device tree entries: > + > + localbus@ffe05000 { > + ranges = <0x2 0x0 0x0 0xff81 0x1>; > + > + dpm@2,0 { > + compatible = "fsl,elbc-gpcm-uio"; > + reg = <0x2 0x0 0x1>; > + elbc-gpcm-br = <0xff810800>; > + elbc-gpcm-or = <0x09f7>; > + interrupt-parent = <&mpic>; > + interrupts = <4 1>; > + device_type = "netx5152"; > + uio_name = "netx_custom"; > + netx5152,init-win0-offset = <0x0>; > + }; > + }; What is "uio_name"? Again, not hardware description. Where is the binding for this device? What is netx5152,init-win0-offset? Documentations go in Documentation/devicetree/bindings, not code comments. Don't use device_type. > +#ifdef CONFIG_UIO_FSL_ELBC_GPCM_NETX5152 > +#define DPM_HOST_WIN0_OFFSET 0xff00 > +#define DPM_HOST_INT_STAT0 0xe0 > +#define DP
[PATCH 1/1] uio: uio_fsl_elbc_gpcm: new driver
This driver provides UIO access to memory of a peripheral connected to the Freescale enhanced local bus controller (eLBC) interface using the general purpose chip-select mode (GPCM). Signed-off-by: John Ogness --- There are currently drivers that use FCM and UPM modes. But there are no drivers using the very simple GPCM mode. If other drivers from other subsystems should start using this mode (for example, mtd, eeprom, char) then it may make sense to try to implement generic GPCM support in arch/powerpc/sysdev/fsl_lbc.c. There would not be much overlap, but there is no point in having multiple drivers implement bank and OR/BR validation. As for the device-specific netX support, I considered if a common header file with the PCI variant drivers/uio/uio_netx.c should exist. Merging the two drivers didn't seem to make sense since this is actually a generic eLBC-GPCM driver (that optionally supports netX) and the other is a PCI netX driver. .../devicetree/bindings/powerpc/fsl/lbc.txt| 18 +- arch/powerpc/include/asm/fsl_lbc.h |3 + drivers/uio/Kconfig| 20 + drivers/uio/Makefile |1 + drivers/uio/uio_fsl_elbc_gpcm.c| 499 5 files changed, 536 insertions(+), 5 deletions(-) create mode 100644 drivers/uio/uio_fsl_elbc_gpcm.c diff --git a/Documentation/devicetree/bindings/powerpc/fsl/lbc.txt b/Documentation/devicetree/bindings/powerpc/fsl/lbc.txt index 3300fec..1c80fce 100644 --- a/Documentation/devicetree/bindings/powerpc/fsl/lbc.txt +++ b/Documentation/devicetree/bindings/powerpc/fsl/lbc.txt @@ -16,20 +16,28 @@ Example: "fsl,pq2-localbus"; #address-cells = <2>; #size-cells = <1>; - reg = ; + reg = <0xf0010100 0x40>; - ranges = <0 0 fe00 0200 - 1 0 f450 8000>; + ranges = <0x0 0x0 0xfe00 0x0200 + 0x1 0x0 0xf450 0x8000 + 0x2 0x0 0xfd81 0x0001>; flash@0,0 { compatible = "jedec-flash"; - reg = <0 0 200>; + reg = <0x0 0x0 0x200>; bank-width = <4>; device-width = <1>; }; board-control@1,0 { - reg = <1 0 20>; + reg = <0x1 0x0 0x20>; compatible = "fsl,mpc8272ads-bcsr"; }; + + simple-periph@2,0 { + compatible = "fsl,elbc-gpcm-uio"; + reg = <0x2 0x0 0x1>; + elbc-gpcm-br = <0xfd810800>; + elbc-gpcm-or = <0x09f7>; + }; }; diff --git a/arch/powerpc/include/asm/fsl_lbc.h b/arch/powerpc/include/asm/fsl_lbc.h index 067fb0d..c7240a0 100644 --- a/arch/powerpc/include/asm/fsl_lbc.h +++ b/arch/powerpc/include/asm/fsl_lbc.h @@ -95,6 +95,9 @@ struct fsl_lbc_bank { #define OR_FCM_TRLX_SHIFT2 #define OR_FCM_EHTR 0x0002 #define OR_FCM_EHTR_SHIFT1 + +#define OR_GPCM_AM 0x8000 +#define OR_GPCM_AM_SHIFT 15 }; struct fsl_lbc_regs { diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig index 5a90914..8a15c32 100644 --- a/drivers/uio/Kconfig +++ b/drivers/uio/Kconfig @@ -104,6 +104,26 @@ config UIO_NETX To compile this driver as a module, choose M here; the module will be called uio_netx. +config UIO_FSL_ELBC_GPCM + tristate "eLBC/GPCM driver" + depends on FSL_LBC + help + Generic driver for accessing a peripheral connected to an eLBC port + that is running in GPCM mode. GPCM is an interface for simple lower + performance memories and memory-mapped devices. For devices using + FCM or UPM eLBC modes, other device-specific drivers are available. + +config UIO_FSL_ELBC_GPCM_NETX5152 + bool "eLBC/GPCM netX 51/52 support" + depends on UIO_FSL_ELBC_GPCM + help + This will add support for netX 51/52 devices connected via eLBC/GPCM. + In particular, it implements interrupt handling. This can be used + together with the userspace netX stack from Hilscher. + + Information about this hardware can be found at: + http://www.hilscher.com/netx + config UIO_PRUSS tristate "Texas Instruments PRUSS driver" depends on ARCH_DAVINCI_DA850 diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile index d3218bd..8560dad 100644 --- a/drivers/uio/Makefile +++ b/drivers/uio/Makefile @@ -8,3 +8,4 @@ obj-$(CONFIG_UIO_PCI_GENERIC) += uio_pci_generic.o obj-$(CONFIG_UIO_NETX) += uio_netx.o obj-$(CONFIG_UIO_PRUSS) += uio_pruss.o obj-$(CONFIG_UIO_MF624) += uio_mf624.o +obj-
[PATCH V4] powerpc: add little endian flag to syscall_get_arch()
Since both ppc and ppc64 have LE variants which are now reported by uname, add that flag (__AUDIT_ARCH_LE) to syscall_get_arch() and add AUDIT_ARCH_PPC64LE variant. Without this, perf trace and auditctl fail. Mainline kernel reports ppc64le (per a058801) but there is no matching AUDIT_ARCH_PPC64LE. Since 32-bit PPC LE is not supported by audit, don't advertise it in AUDIT_ARCH_PPC* variants. See: https://www.redhat.com/archives/linux-audit/2014-August/msg00082.html https://www.redhat.com/archives/linux-audit/2014-December/msg4.html Signed-off-by: Richard Guy Briggs --- arch/powerpc/include/asm/syscall.h |6 +- include/uapi/linux/audit.h |2 ++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h index 6fa2708..d1934e5 100644 --- a/arch/powerpc/include/asm/syscall.h +++ b/arch/powerpc/include/asm/syscall.h @@ -90,6 +90,10 @@ static inline void syscall_set_arguments(struct task_struct *task, static inline int syscall_get_arch(void) { - return is_32bit_task() ? AUDIT_ARCH_PPC : AUDIT_ARCH_PPC64; + int arch = is_32bit_task() ? AUDIT_ARCH_PPC : AUDIT_ARCH_PPC64; +#ifdef __LITTLE_ENDIAN__ + arch |= __AUDIT_ARCH_LE; +#endif + return arch; } #endif /* _ASM_SYSCALL_H */ diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h index 4d100c8..d82beec 100644 --- a/include/uapi/linux/audit.h +++ b/include/uapi/linux/audit.h @@ -364,7 +364,9 @@ enum { #define AUDIT_ARCH_PARISC (EM_PARISC) #define AUDIT_ARCH_PARISC64(EM_PARISC|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_PPC (EM_PPC) +/* do not define AUDIT_ARCH_PPCLE since it is not supported by audit */ #define AUDIT_ARCH_PPC64 (EM_PPC64|__AUDIT_ARCH_64BIT) +#define AUDIT_ARCH_PPC64LE (EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) #define AUDIT_ARCH_S390(EM_S390) #define AUDIT_ARCH_S390X (EM_S390|__AUDIT_ARCH_64BIT) #define AUDIT_ARCH_SH (EM_SH) -- 1.7.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc: secondary CPUs signal to master before setting active and online (fixes kernel BUG at kernel/smpboot.c:134!)
On Mon, Dec 8, 2014 at 3:58 PM, Anton Blanchard wrote: > Hi Ingo, > >> At that point I thought the previous task_cpu() was somewhat ingrained >> in the scheduler and came up with the patch. If not, we could go on a >> hunt to see what else needs fixing. > > I had another look. The scheduled does indeed make assumptions about the > previous task_cpu, but we have a hammer to fix it up called > select_fallback_rq. > > I annotated select_fallback_rq, and did hit a case where the CPU was > not active. ppc64 patch below. Anton, I'll assume I will get this through the usual powerpc pull requests? > I think x86 have a similar (although harder to hit) issue. Ingo? Linus ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 2 1/4] powerpc: drop the ability to tweak SMT mode at boot time
On Tue, 2014-12-09 at 15:11 +1100, Michael Ellerman wrote: > On Fri, 2014-12-05 at 12:52 -0600, Scott Wood wrote: > > On Fri, 2014-12-05 at 16:14 +0100, Greg Kurz wrote: > > > The smt-enabled kernel parameter basically leaves unwanted cpus executing > > > in firmware or wherever they happen to be. The very same applies to the > > > ibm,smt-enabled DT property which is no more used by anything known. These > > > are hacks that shoudn't be used in a production environment. > > > > > > Quoting mpe, "there are better ways for firmware to disable SMT". > > > > Those "better ways" don't apply to Freescale chips, where the OS enables > > (or not) SMT without any interaction with firmware. > > But how does it know there even are SMT threads? From the device tree? So > just don't present the threads in the device tree? The device tree is for hardware description, not configuration... -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC PATCH 2/8] perf probe powerpc: Fix symbol fixup issues due to ELF type
Em Tue, Dec 09, 2014 at 11:04:00PM +0530, Naveen N. Rao escreveu: > If using the symbol table, symbol addresses are not being fixed up > properly, resulting in probes being placed at wrong addresses: > > # perf probe do_fork > Added new event: > probe:do_fork(on do_fork) > > You can now use it in all perf tools, such as: > > perf record -e probe:do_fork -aR sleep 1 > > # cat /sys/kernel/debug/tracing/kprobe_events > p:probe/do_fork _text+635952 > # printf "%x" 635952 > 9b430 > # grep do_fork /boot/System.map > c00ab430 T .do_fork > > Fix by checking for ELF type ET_DYN used by ppc64 kernels. Are you sure this doesn't need to be enclosed in ifdef PPC64? - Arnaldo > Signed-off-by: Naveen N. Rao > --- > tools/perf/util/symbol-elf.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c > index 1e23a5b..67e4392 100644 > --- a/tools/perf/util/symbol-elf.c > +++ b/tools/perf/util/symbol-elf.c > @@ -629,7 +629,8 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, > const char *name, >NULL) != NULL); > } else { > ss->adjust_symbols = ehdr.e_type == ET_EXEC || > - ehdr.e_type == ET_REL; > + ehdr.e_type == ET_REL || > + ehdr.e_type == ET_DYN; > } > > ss->name = strdup(name); > -- > 2.1.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC PATCH 8/8] perf probe powerpc: Fixup function entry if using kallsyms lookup
Em Tue, Dec 09, 2014 at 11:04:06PM +0530, Naveen N. Rao escreveu: > On powerpc ABIv2, if no debug-info is found and we use kallsyms, > we need to fixup the function entry to point to the local entry point. > Use offset of 8 since current toolchains always generate 2 > instructions (8 bytes). Hi Michael and Ananth, may I have your Acked-by or Reviewed-by for these patches? The ones, like this, that are affects only ppc I'm can assume was tested and applying it won't break other arch users, but having a/rev-by from ppc developers should speed up this process. Thanks, - Arnaldo > Signed-off-by: Naveen N. Rao > --- > tools/perf/util/probe-event.c | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c > index adcdbd2..0970e2a 100644 > --- a/tools/perf/util/probe-event.c > +++ b/tools/perf/util/probe-event.c > @@ -2318,6 +2318,15 @@ static int find_probe_trace_events_from_map(struct > perf_probe_event *pev, > } > /* Add one probe point */ > tp->address = map->unmap_ip(map, sym->start) + pp->offset; > +#if defined(__powerpc64__) && defined(_CALL_ELF) && _CALL_ELF == 2 > + /* > + * If we used kallsyms, we should fixup the function entry > address here. > + * ppc64le ABIv2 local entry point is currently always 2 > instructions (8 bytes) > + * after the global entry point. Fix this if it ever changes. > + */ > + if (!pev->uprobes && map->dso->symtab_type == > DSO_BINARY_TYPE__KALLSYMS) > + tp->address += 8; > +#endif > if (reloc_sym) { > tp->symbol = strdup_or_goto(reloc_sym->name, nomem_out); > tp->offset = tp->address - reloc_sym->addr; > -- > 2.1.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 2 1/4] powerpc: drop the ability to tweak SMT mode at boot time
On Tue, 2014-12-09 at 15:04 -0600, Scott Wood wrote: > On Tue, 2014-12-09 at 15:11 +1100, Michael Ellerman wrote: > > On Fri, 2014-12-05 at 12:52 -0600, Scott Wood wrote: > > > On Fri, 2014-12-05 at 16:14 +0100, Greg Kurz wrote: > > > > The smt-enabled kernel parameter basically leaves unwanted cpus > > > > executing > > > > in firmware or wherever they happen to be. The very same applies to the > > > > ibm,smt-enabled DT property which is no more used by anything known. > > > > These > > > > are hacks that shoudn't be used in a production environment. > > > > > > > > Quoting mpe, "there are better ways for firmware to disable SMT". > > > > > > Those "better ways" don't apply to Freescale chips, where the OS enables > > > (or not) SMT without any interaction with firmware. > > > > But how does it know there even are SMT threads? From the device tree? So > > just don't present the threads in the device tree? > > The device tree is for hardware description, not configuration... Oh please, you're quoting device tree scripture to me now? cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 2 1/4] powerpc: drop the ability to tweak SMT mode at boot time
On Wed, 2014-12-10 at 10:56 +1100, Michael Ellerman wrote: > On Tue, 2014-12-09 at 15:04 -0600, Scott Wood wrote: > > On Tue, 2014-12-09 at 15:11 +1100, Michael Ellerman wrote: > > > On Fri, 2014-12-05 at 12:52 -0600, Scott Wood wrote: > > > > On Fri, 2014-12-05 at 16:14 +0100, Greg Kurz wrote: > > > > > The smt-enabled kernel parameter basically leaves unwanted cpus > > > > > executing > > > > > in firmware or wherever they happen to be. The very same applies to > > > > > the > > > > > ibm,smt-enabled DT property which is no more used by anything known. > > > > > These > > > > > are hacks that shoudn't be used in a production environment. > > > > > > > > > > Quoting mpe, "there are better ways for firmware to disable SMT". > > > > > > > > Those "better ways" don't apply to Freescale chips, where the OS enables > > > > (or not) SMT without any interaction with firmware. > > > > > > But how does it know there even are SMT threads? From the device tree? So > > > just don't present the threads in the device tree? > > > > The device tree is for hardware description, not configuration... > > Oh please, you're quoting device tree scripture to me now? What benefit is there to ignoring "scripture" here? Going from an easy to use command line option to needing to mess around with the dts file is not a usability improvement. If you want to make it Freescale-only, fine. If you want to push me to fix the problems with the implementation, fine. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V4] powerpc: add little endian flag to syscall_get_arch()
On Tuesday, December 09, 2014 03:37:07 PM Richard Guy Briggs wrote: > Since both ppc and ppc64 have LE variants which are now reported by uname, > add that flag (__AUDIT_ARCH_LE) to syscall_get_arch() and add > AUDIT_ARCH_PPC64LE variant. > > Without this, perf trace and auditctl fail. > > Mainline kernel reports ppc64le (per a058801) but there is no matching > AUDIT_ARCH_PPC64LE. > > Since 32-bit PPC LE is not supported by audit, don't advertise it in > AUDIT_ARCH_PPC* variants. > > See: > https://www.redhat.com/archives/linux-audit/2014-August/msg00082.html > https://www.redhat.com/archives/linux-audit/2014-December/msg4.html > > Signed-off-by: Richard Guy Briggs > --- > arch/powerpc/include/asm/syscall.h |6 +- > include/uapi/linux/audit.h |2 ++ > 2 files changed, 7 insertions(+), 1 deletions(-) The audit changes look fine to me, but as I mentioned earlier, this should go in via the ppc tree and not the audit tree. Acked-by: Paul Moore > diff --git a/arch/powerpc/include/asm/syscall.h > b/arch/powerpc/include/asm/syscall.h index 6fa2708..d1934e5 100644 > --- a/arch/powerpc/include/asm/syscall.h > +++ b/arch/powerpc/include/asm/syscall.h > @@ -90,6 +90,10 @@ static inline void syscall_set_arguments(struct > task_struct *task, > > static inline int syscall_get_arch(void) > { > - return is_32bit_task() ? AUDIT_ARCH_PPC : AUDIT_ARCH_PPC64; > + int arch = is_32bit_task() ? AUDIT_ARCH_PPC : AUDIT_ARCH_PPC64; > +#ifdef __LITTLE_ENDIAN__ > + arch |= __AUDIT_ARCH_LE; > +#endif > + return arch; > } > #endif /* _ASM_SYSCALL_H */ > diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h > index 4d100c8..d82beec 100644 > --- a/include/uapi/linux/audit.h > +++ b/include/uapi/linux/audit.h > @@ -364,7 +364,9 @@ enum { > #define AUDIT_ARCH_PARISC(EM_PARISC) > #define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT) > #define AUDIT_ARCH_PPC (EM_PPC) > +/* do not define AUDIT_ARCH_PPCLE since it is not supported by audit */ > #define AUDIT_ARCH_PPC64 (EM_PPC64|__AUDIT_ARCH_64BIT) > +#define AUDIT_ARCH_PPC64LE (EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) > #define AUDIT_ARCH_S390 (EM_S390) > #define AUDIT_ARCH_S390X (EM_S390|__AUDIT_ARCH_64BIT) > #define AUDIT_ARCH_SH(EM_SH) -- paul moore security and virtualization @ redhat ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 2 1/4] powerpc: drop the ability to tweak SMT mode at boot time
On Tue, 2014-12-09 at 18:14 -0600, Scott Wood wrote: > On Wed, 2014-12-10 at 10:56 +1100, Michael Ellerman wrote: > > On Tue, 2014-12-09 at 15:04 -0600, Scott Wood wrote: > > > On Tue, 2014-12-09 at 15:11 +1100, Michael Ellerman wrote: > > > > On Fri, 2014-12-05 at 12:52 -0600, Scott Wood wrote: > > > > > On Fri, 2014-12-05 at 16:14 +0100, Greg Kurz wrote: > > > > > > The smt-enabled kernel parameter basically leaves unwanted cpus > > > > > > executing > > > > > > in firmware or wherever they happen to be. The very same applies to > > > > > > the > > > > > > ibm,smt-enabled DT property which is no more used by anything > > > > > > known. These > > > > > > are hacks that shoudn't be used in a production environment. > > > > > > > > > > > > Quoting mpe, "there are better ways for firmware to disable SMT". > > > > > > > > > > Those "better ways" don't apply to Freescale chips, where the OS > > > > > enables > > > > > (or not) SMT without any interaction with firmware. > > > > > > > > But how does it know there even are SMT threads? From the device tree? > > > > So > > > > just don't present the threads in the device tree? > > > > > > The device tree is for hardware description, not configuration... > > > > Oh please, you're quoting device tree scripture to me now? > > What benefit is there to ignoring "scripture" here? Going from an easy > to use command line option to needing to mess around with the dts file > is not a usability improvement. If you want to make it Freescale-only, > fine. If you want to push me to fix the problems with the > implementation, fine. It's easy to use but it doesn't necessarily work. You said in your other mail to Greg "Sometimes it's useful to ensure that the second thread has never run when debugging a problem.". But you don't know that, for all you know your firmware has started the thread and it's busy looping somewhere. Perhaps you guys know that your firmware doesn't do that, but it's still a hack. We end up with cpus in the present map, but we have no idea where they are or what they are doing. So as far as I'm concerned it's only useful as a debugging hack, and one that we don't really use anymore. But if you guys think it's useful then we'll keep it. I'll work out with Greg what the cleanest solution is. It looks like you only need it on e6500? Which is platforms/85xx I think. Anywhere else? cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V4] powerpc: add little endian flag to syscall_get_arch()
On Tue, 2014-12-09 at 21:11 -0500, Paul Moore wrote: > On Tuesday, December 09, 2014 03:37:07 PM Richard Guy Briggs wrote: > > Since both ppc and ppc64 have LE variants which are now reported by uname, > > add that flag (__AUDIT_ARCH_LE) to syscall_get_arch() and add > > AUDIT_ARCH_PPC64LE variant. > > > > Without this, perf trace and auditctl fail. > > > > Mainline kernel reports ppc64le (per a058801) but there is no matching > > AUDIT_ARCH_PPC64LE. > > > > Since 32-bit PPC LE is not supported by audit, don't advertise it in > > AUDIT_ARCH_PPC* variants. > > > > See: > > https://www.redhat.com/archives/linux-audit/2014-August/msg00082.html > > https://www.redhat.com/archives/linux-audit/2014-December/msg4.html > > > > Signed-off-by: Richard Guy Briggs > > --- > > arch/powerpc/include/asm/syscall.h |6 +- > > include/uapi/linux/audit.h |2 ++ > > 2 files changed, 7 insertions(+), 1 deletions(-) > > The audit changes look fine to me, but as I mentioned earlier, this should go > in via the ppc tree and not the audit tree. > > Acked-by: Paul Moore Thanks. Yep I'll take it via the powerpc tree, I'll CC stable as well as presumably we want this to work in all versions that had LE support. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V4] powerpc: add little endian flag to syscall_get_arch()
On 14/12/10, Michael Ellerman wrote: > On Tue, 2014-12-09 at 21:11 -0500, Paul Moore wrote: > > On Tuesday, December 09, 2014 03:37:07 PM Richard Guy Briggs wrote: > > > Since both ppc and ppc64 have LE variants which are now reported by uname, > > > add that flag (__AUDIT_ARCH_LE) to syscall_get_arch() and add > > > AUDIT_ARCH_PPC64LE variant. > > > > > > Without this, perf trace and auditctl fail. > > > > > > Mainline kernel reports ppc64le (per a058801) but there is no matching > > > AUDIT_ARCH_PPC64LE. > > > > > > Since 32-bit PPC LE is not supported by audit, don't advertise it in > > > AUDIT_ARCH_PPC* variants. > > > > > > See: > > > https://www.redhat.com/archives/linux-audit/2014-August/msg00082.html > > > https://www.redhat.com/archives/linux-audit/2014-December/msg4.html > > > > > > Signed-off-by: Richard Guy Briggs > > > --- > > > arch/powerpc/include/asm/syscall.h |6 +- > > > include/uapi/linux/audit.h |2 ++ > > > 2 files changed, 7 insertions(+), 1 deletions(-) > > > > The audit changes look fine to me, but as I mentioned earlier, this should > > go > > in via the ppc tree and not the audit tree. > > > > Acked-by: Paul Moore > > Thanks. > > Yep I'll take it via the powerpc tree, I'll CC stable as well as presumably we > want this to work in all versions that had LE support. Yes, please! (I was very tempted to change the #error to #warning, but figured the placeholder comment in the uapi file was sufficient.) > cheers - RGB -- Richard Guy Briggs Senior Software Engineer, Kernel Security, AMER ENG Base Operating Systems, Red Hat Remote, Ottawa, Canada Voice: +1.647.777.2635, Internal: (81) 32635, Alt: +1.613.693.0684x3545 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC PATCH 8/8] perf probe powerpc: Fixup function entry if using kallsyms lookup
On Tue, Dec 09, 2014 at 06:14:00PM -0300, Arnaldo Carvalho de Melo wrote: > Em Tue, Dec 09, 2014 at 11:04:06PM +0530, Naveen N. Rao escreveu: > > On powerpc ABIv2, if no debug-info is found and we use kallsyms, > > we need to fixup the function entry to point to the local entry point. > > Use offset of 8 since current toolchains always generate 2 > > instructions (8 bytes). > > Hi Michael and Ananth, may I have your Acked-by or Reviewed-by for these > patches? > > The ones, like this, that are affects only ppc I'm can assume was tested > and applying it won't break other arch users, but having a/rev-by from > ppc developers should speed up this process. Hi Arnaldo, Yes, I have reviewed the patches. So, for all patches... Reviewed-by: Ananth N Mavinakayanahalli ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC PATCH 0/8] Fix perf probe issues on powerpc
On Tue, Dec 09, 2014 at 11:03:58PM +0530, Naveen N. Rao wrote: > This patchset fixes various issues with perf probe on powerpc > across ABIv1 and ABIv2: > - in the presence of DWARF debug-info, > - in the absence of DWARF, but with the symbol table, and > - in the absence of debug-info, but with kallsyms. > > Applies cleanly on v3.18 and on -tip with minor changes to patch 6. > Tested on ppc64 BE and LE. > > - Naveen > > Naveen N. Rao (8): > kprobes: Fix kallsyms lookup across powerpc ABIv1 and ABIv2 > perf probe powerpc: Fix symbol fixup issues due to ELF type > perf probe: Improve detection of file/function name in the probe > pattern > perf probe powerpc: Handle powerpc dot symbols > perf probe powerpc: Allow matching against dot symbols > perf tools powerpc: Fix PPC64 ELF ABIv2 symbol decoding > perf probe powerpc: Use DWARF info only if necessary > perf probe powerpc: Fixup function entry if using kallsyms lookup > > arch/powerpc/include/asm/code-patching.h | 26 > arch/powerpc/include/asm/kprobes.h| 58 > ++- > tools/perf/arch/powerpc/Makefile | 1 + > tools/perf/arch/powerpc/util/elf-sym-decode.c | 27 + > tools/perf/config/Makefile| 1 + > tools/perf/util/elf_sym.h | 13 ++ > tools/perf/util/probe-event.c | 57 -- > tools/perf/util/symbol-elf.c | 11 - > tools/perf/util/symbol.c | 6 +++ > 9 files changed, 170 insertions(+), 30 deletions(-) > create mode 100644 tools/perf/arch/powerpc/util/elf-sym-decode.c > create mode 100644 tools/perf/util/elf_sym.h For the full patchset... Reviewed-by: Ananth N Mavinakayanahalli ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/2] perf/powerpc/hv-24x7: Use per-cpu page buffer
From 470c16c8955672103a9529c78dffbb239e9e27b8 Mon Sep 17 00:00:00 2001 From: Sukadev Bhattiprolu Date: Tue, 9 Dec 2014 22:17:46 -0500 Subject: [PATCH 1/2] perf/poweprc/hv-24x7: Use per-cpu page buffer The 24x7 counters are continuously running and not updated on an interrupt. So we record the event counts when stopping the event or deleting it. But to "read" a single counter in 24x7, we allocate a page and pass it into the hypervisor (The HV returns the page full of counters from which we extract the specific counter for this event). We allocate a page using GFP_USER and when deleting the event, we end up with the following warning because we are blocking in interrupt context. [ 698.641709] BUG: scheduling while atomic: swapper/0/0/0x1001 We could use GFP_ATOMIC but that could result in failures. Pre-allocate a buffer so we don't have to allocate in interrupt context. Further as Michael Ellerman suggested, use Per-CPU buffer so we only need to allocate once per CPU. Signed-off-by: Sukadev Bhattiprolu --- arch/powerpc/perf/hv-24x7.c | 21 + 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index dba3408..18e1f49 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -217,11 +217,14 @@ static bool is_physical_domain(int domain) domain == HV_24X7_PERF_DOMAIN_PHYSICAL_CORE; } +DEFINE_PER_CPU(char, hv_24x7_reqb[4096]); +DEFINE_PER_CPU(char, hv_24x7_resb[4096]); + static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix, u16 lpar, u64 *res, bool success_expected) { - unsigned long ret = -ENOMEM; + unsigned long ret; /* * request_buffer and result_buffer are not required to be 4k aligned, @@ -243,13 +246,11 @@ static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix, BUILD_BUG_ON(sizeof(*request_buffer) > 4096); BUILD_BUG_ON(sizeof(*result_buffer) > 4096); - request_buffer = kmem_cache_zalloc(hv_page_cache, GFP_USER); - if (!request_buffer) - goto out; + request_buffer = (void *)get_cpu_var(hv_24x7_reqb); + result_buffer = (void *)get_cpu_var(hv_24x7_resb); - result_buffer = kmem_cache_zalloc(hv_page_cache, GFP_USER); - if (!result_buffer) - goto out_free_request_buffer; + memset(request_buffer, 0, 4096); + memset(result_buffer, 0, 4096); *request_buffer = (struct reqb) { .buf = { @@ -278,15 +279,11 @@ static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix, domain, offset, ix, lpar, ret, ret, result_buffer->buf.detailed_rc, result_buffer->buf.failing_request_ix); - goto out_free_result_buffer; + goto out; } *res = be64_to_cpu(result_buffer->result); -out_free_result_buffer: - kfree(result_buffer); -out_free_request_buffer: - kfree(request_buffer); out: return ret; } -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/2] perf/power/hv-24x7: Use kmem_cache_free() instead of kfree
From 982bf5a660ae33fbe2f9187187caa6752c66783d Mon Sep 17 00:00:00 2001 From: Sukadev Bhattiprolu Date: Wed, 10 Dec 2014 01:43:34 -0500 Subject: [PATCH 2/2] power/perf: hv-24x7: Use kmem_cache_free() instead of kfree Use kmem_cache_free() to free a buffer allocated with kmem_cache_alloc(). Signed-off-by: Sukadev Bhattiprolu p# set2.log --- arch/powerpc/perf/hv-24x7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 18e1f49..a2c6211 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -177,7 +177,7 @@ static ssize_t _name##_show(struct device *dev, \ } \ ret = sprintf(buf, _fmt, _expr);\ e_free:\ - kfree(page);\ + kmem_cache_free(hv_page_cache, page); \ return ret; \ } \ static DEVICE_ATTR_RO(_name) -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev