Re: [PATCH] powerpc: ignore the pkey system calls for now

2016-10-18 Thread Balbir Singh
On 18/10/16 09:33, Stephen Rothwell wrote: > Eliminates warning messages: > > :1316:2: warning: #warning syscall pkey_mprotect not implemented > [-Wcpp] > :1319:2: warning: #warning syscall pkey_alloc not implemented [-Wcpp] > :1322:2: warning: #warning syscall pkey_free not implemented [-Wcpp]

[PATCH] Setup per-cpu cpu<->node binding early

2016-10-18 Thread Balbir Singh
Michael Ellerman debugged an issue w.r.t workqueue changes (see https://lkml.org/lkml/2016/10/17/352) down to the fact that we don't setup our per cpu (cpu to node) binding early enough (in setup_per_cpu_areas like x86 does). This lead to a problem with workqueue changes where the cpus seen by for

[RFC PATCH 1/3] cxl: Split _CXL_LOOP_HCALL9 out into a separate macro

2016-10-18 Thread Michael Ellerman
In a subsequent patch we want to change the type of retbuf between plpar_hcall() and plpar_hcall9(), but we can't because _CXL_LOOP_HCALL expects the same type for retbuf regardless of the hcall type. So duplicate the logic in a separate macro for plpar_hcall9(). Signed-off-by: Michael Ellerman

[RFC PATCH 2/3] powerpc/pseries: Define & use a type for the plpar_hcall() retvals

2016-10-18 Thread Michael Ellerman
We have now had two nasty stack corruption bugs caused by incorrect sizing of the return buffer for plpar_hcall()/plpar_hcall9(). To avoid any more such bugs, define a type which encodes the size of the return buffer, and change the argument of plpar_hcall() to be of that type, meaning the compile

[RFC PATCH 3/3] powerpc/pseries: Define & use a type for the plpar_hcall9() retvals

2016-10-18 Thread Michael Ellerman
We have now had two nasty stack corruption bugs caused by incorrect sizing of the return buffer for plpar_hcall()/plpar_hcall9(). To avoid any more such bugs, define a type which encodes the size of the return buffer, and change the argument of plpar_hcall9() to be of that type, meaning the compil

[PATCH] powerpc: Fix numa topology console print

2016-10-18 Thread Aneesh Kumar K.V
With recent update to printk, we get console output like below [0.550639] Brought up 160 CPUs [0.550718] Node 0 CPUs: [0.550721] 0 [0.550754] -39 [0.550794] Node 1 CPUs: [0.550798] 40 [0.550817] -79 [0.550856] Node 16 CPUs: [0.550860] 80 [0.550880] -119

Re: [PATCH v2] console: Don't prefer first registered if DT specifies stdout-path

2016-10-18 Thread Paul Burton
On Monday, 17 October 2016 19:39:57 BST Andreas Schwab wrote: > On Okt 17 2016, Paul Burton wrote: > > Could you share the device tree from your system? > > This is the contents of chosen/linux,stdout-path on the systems I have: > > chosen/linux,stdout-path > "/pci@f000/ATY,

[PATCH] console: use first console if stdout-path device doesn't appear

2016-10-18 Thread Paul Burton
If a device tree specified a preferred device for kernel console output via the stdout-path or linux,stdout-path chosen node properties there's no guarantee that it will have specified a device for which we have a driver. It may also be the case that we do have a driver but it doesn't call of_conso

Re: [v12, 0/8] Fix eSDHC host version register bug

2016-10-18 Thread Ulf Hansson
On 21 September 2016 at 08:57, Yangbo Lu wrote: > This patchset is used to fix a host version register bug in the > T4240-R1.0-R2.0 > eSDHC controller. To match the SoC version and revision, 10 previous version > patchsets had tried many methods but all of them were rejected by reviewers. > Such

Re: [PATCH 01/10] mm: remove write/force parameters from __get_user_pages_locked()

2016-10-18 Thread Jan Kara
On Thu 13-10-16 01:20:11, Lorenzo Stoakes wrote: > This patch removes the write and force parameters from > __get_user_pages_locked() > to make the use of FOLL_FORCE explicit in callers as use of this flag can > result > in surprising behaviour (and hence bugs) within the mm subsystem. > > Signe

Re: [PATCH 02/10] mm: remove write/force parameters from __get_user_pages_unlocked()

2016-10-18 Thread Jan Kara
On Thu 13-10-16 01:20:12, Lorenzo Stoakes wrote: > This patch removes the write and force parameters from > __get_user_pages_unlocked() to make the use of FOLL_FORCE explicit in callers > as > use of this flag can result in surprising behaviour (and hence bugs) within > the > mm subsystem. > > S

Re: [PATCH 03/10] mm: replace get_user_pages_unlocked() write/force parameters with gup_flags

2016-10-18 Thread Jan Kara
On Thu 13-10-16 01:20:13, Lorenzo Stoakes wrote: > This patch removes the write and force parameters from > get_user_pages_unlocked() > and replaces them with a gup_flags parameter to make the use of FOLL_FORCE > explicit in callers as use of this flag can result in surprising behaviour > (and >

Re: [PATCH 04/10] mm: replace get_user_pages_locked() write/force parameters with gup_flags

2016-10-18 Thread Jan Kara
On Thu 13-10-16 01:20:14, Lorenzo Stoakes wrote: > This patch removes the write and force parameters from get_user_pages_locked() > and replaces them with a gup_flags parameter to make the use of FOLL_FORCE > explicit in callers as use of this flag can result in surprising behaviour > (and > hence

Re: [PATCH 04/10] mm: replace get_user_pages_locked() write/force parameters with gup_flags

2016-10-18 Thread Lorenzo Stoakes
On Tue, Oct 18, 2016 at 02:54:25PM +0200, Jan Kara wrote: > > @@ -1282,7 +1282,7 @@ long get_user_pages(unsigned long start, unsigned > > long nr_pages, > > int write, int force, struct page **pages, > > struct vm_area_struct **vmas); > > long get_u

Re: [RFC PATCH 2/3] powerpc/pseries: Define & use a type for the plpar_hcall() retvals

2016-10-18 Thread Balbir Singh
On 18/10/16 19:40, Michael Ellerman wrote: > We have now had two nasty stack corruption bugs caused by incorrect > sizing of the return buffer for plpar_hcall()/plpar_hcall9(). > > To avoid any more such bugs, define a type which encodes the size of the > return buffer, and change the argument o

Re: [PATCH 00/10] mm: adjust get_user_pages* functions to explicitly pass FOLL_* flags

2016-10-18 Thread Michal Hocko
On Thu 13-10-16 01:20:10, Lorenzo Stoakes wrote: > This patch series adjusts functions in the get_user_pages* family such that > desired FOLL_* flags are passed as an argument rather than implied by flags. > > The purpose of this change is to make the use of FOLL_FORCE explicit so it is > easier t

[PATCH] mm/hugetlb: Use the right pte val for compare in hugetlb_cow

2016-10-18 Thread Aneesh Kumar K.V
We cannot use the pte value used in set_pte_at for pte_same comparison, because archs like ppc64, filter/add new pte flag in set_pte_at. Instead fetch the pte value inside hugetlb_cow. We are comparing pte value to make sure the pte didn't change since we dropped the page table lock. hugetlb_cow ge

[PATCH v6 0/3] powerpc/pseries: Implement indexed-count memory hotplug

2016-10-18 Thread Nathan Fontenot
Indexed-count memory management allows addition and removal of contiguous lmb blocks with a single command. When compared to the series of calls previously required to manage contiguous blocks, indexed-count decreases command frequency and reduces risk of buffer overflow. -Nathan --- Changes in v

[PATCH v6 1/3] powerpc/pseries: Correct possible read beyond dlpar sysfs buffer

2016-10-18 Thread Nathan Fontenot
The pasrsing of data written to the dlpar file in sysfs does not correctly account for the possibility of reading past the end of the buffer. Correct this by updating the buffer parsing code to make a local copy and use the strsep() and sysfs_streq() routines to parse the buffer. This also separate

[PATCH v6 2/3] powerpc/pseries: Implement indexed-count hotplug memory add

2016-10-18 Thread Nathan Fontenot
From: Sahil Mehta Indexed-count add for memory hotplug guarantees that a contiguous block of lmbs beginning at a specified will be assigned (NOT that lmbs will be added). Because of Qemu's per-DIMM memory management, the addition of a contiguous block of memory currently requires a series of i

[PATCH v6 3/3] powerpc/pseries: Implement indexed-count hotplug memory remove

2016-10-18 Thread Nathan Fontenot
From: Sahil Mehta Indexed-count remove for memory hotplug guarantees that a contiguous block of lmbs beginning at a specified will be unassigned (NOT that lmbs will be removed). Because of Qemu's per-DIMM memory management, the removal of a contiguous block of memory currently requires a serie

Re: [PATCH] mm/hugetlb: Use the right pte val for compare in hugetlb_cow

2016-10-18 Thread Andrew Morton
On Tue, 18 Oct 2016 21:12:45 +0530 "Aneesh Kumar K.V" wrote: > We cannot use the pte value used in set_pte_at for pte_same comparison, > because archs like ppc64, filter/add new pte flag in set_pte_at. Instead > fetch the pte value inside hugetlb_cow. We are comparing pte value to > make sure th

Re: Oops on Power8 (was Re: [PATCH v2 1/7] workqueue: make workqueue available early during boot)

2016-10-18 Thread Tejun Heo
Hello, Michael. On Tue, Oct 18, 2016 at 03:37:42PM +1100, Michael Ellerman wrote: > That doesn't compile, wq doesn't exist. > > I guessed that you meant: > > + wq_numa_init(); > + list_for_each_entry(wq, &workqueues, list) > + wq_update_unbound_numa(wq, smp_processor_id

Re: [PATCH] console: use first console if stdout-path device doesn't appear

2016-10-18 Thread Andreas Schwab
On Okt 18 2016, Paul Burton wrote: > If a device tree specified a preferred device for kernel console output > via the stdout-path or linux,stdout-path chosen node properties there's > no guarantee that it will have specified a device for which we have a > driver. It may also be the case that we

Re: powerpc/64: Fix incorrect return value from __copy_tofrom_user

2016-10-18 Thread Michael Ellerman
On Tue, 2016-11-10 at 11:25:47 UTC, Paul Mackerras wrote: > Debugging a data corruption issue with virtio-net/vhost-net led to > the observation that __copy_tofrom_user was occasionally returning > a value 16 larger than it should. Since the return value from > __copy_tofrom_user is the number of

Re: powerpc/mm/hash64: Fix might_have_hea() check

2016-10-18 Thread Michael Ellerman
On Tue, 2016-11-10 at 10:15:04 UTC, Michael Ellerman wrote: > In commit 2b4e3ad8f579 ("powerpc/mm/hash64: Don't test for machine type > to detect HEA special case") we changed the logic in might_have_hea() > to check FW_FEATURE_SPLPAR rather than machine_is(pseries). > > However the check was inco

Re: powerpc/pseries: Fix stack corruption in htpe code

2016-10-18 Thread Michael Ellerman
On Thu, 2016-06-10 at 13:33:21 UTC, Laurent Dufour wrote: > This commit fixes a stack corruption in the pseries specific code dealing > with the huge pages. > > In __pSeries_lpar_hugepage_invalidate() the buffer used to pass arguments > to the hypervisor is not large enough. This leads to a stack

Re: MAINTAINERS: Drop separate pseries entry

2016-10-18 Thread Michael Ellerman
On Wed, 2016-05-10 at 05:04:00 UTC, Michael Ellerman wrote: > Paul is no longer acting as a separate maintainer for pseries, it is > handled along with the rest of powerpc. The URL no longer links anywhere > meaningful, so drop it also. > > Signed-off-by: Michael Ellerman Applied to powerpc next

Re: ppc64 qemu test failure since commit f9aa67142 ("powerpc/64s: Consolidate Alignment 0x600 interrupt")

2016-10-18 Thread Michael Ellerman
On Tue, 2016-11-10 at 07:47:56 UTC, Nicholas Piggin wrote: > On Mon, 10 Oct 2016 07:15:11 -0700 > Guenter Roeck wrote: > > > On 10/09/2016 10:49 PM, Nicholas Piggin wrote: > > > On Sun, 9 Oct 2016 08:21:21 -0700 > > > Guenter Roeck wrote: > > > > > >> Nicholas, > > >> > > >> some of my qemu te

Re: MAINTAINERS: Update powerpc website & add selftests

2016-10-18 Thread Michael Ellerman
On Wed, 2016-05-10 at 05:08:16 UTC, Michael Ellerman wrote: > The selftests under tools/testing/selftests/powerpc are maintained by > us, so add a file pattern for them. > > Also drop the www.penguinppc.org link, it's not dead, but the site is > dead (database error). Instead link to the wiki atta

Re: selftests/powerpc: Fix build break caused by EXPORT_SYMBOL changes

2016-10-18 Thread Michael Ellerman
On Wed, 2016-05-10 at 05:22:57 UTC, Michael Ellerman wrote: > The changes to make EXPORT_SYMBOL work in asm, specifically commit > 9445aa1a3062 ("ppc: move exports to definitions"), in the kbuild tree, > breaks some of our selftests. > > That is because we symlink the kernel code into the selftest

RE: [v12, 0/8] Fix eSDHC host version register bug

2016-10-18 Thread Y.B. Lu
> -Original Message- > From: Ulf Hansson [mailto:ulf.hans...@linaro.org] > Sent: Tuesday, October 18, 2016 6:48 PM > To: Y.B. Lu > Cc: linux-mmc; Scott Wood; Arnd Bergmann; linuxppc-dev@lists.ozlabs.org; > devicet...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux- > ker...@vge

RE: [v12, 0/8] Fix eSDHC host version register bug

2016-10-18 Thread Y.B. Lu
+ Greg Hi Greg, I submitted this patchset for a MMC bug fix, and introduce the below patch which needs your ACK. > > Arnd Bergmann (1): > > base: soc: introduce soc_device_match() interface https://patchwork.kernel.org/patch/9342913/ Could you help to review it and give some comments or ACK.

[PATCH 0/7] build updates

2016-10-18 Thread Nicholas Piggin
Hi, I was hoping to get these posted earlier, but they had a dependency on the kbuild tree which took a while to merge. Hopefully we can get at least the first 4 patches in, which are just sanity checks on the final binary. With this series applied, I'm able to build[*] and boot a 64-bit book3s a

[PATCH 1/7] powerpc: use the new post-link pass to check relocations

2016-10-18 Thread Nicholas Piggin
Currently powerpc has to introduce a dependency on its default build target zImage in order to run a relocation check pass over the linked vmlinux. This is deficient because the check is not run if the plain vmlinux target is built, or if one of the other boot targets is built. Switch to using the

[PATCH 2/7] powerpc: add arch/powerpc/tools directory

2016-10-18 Thread Nicholas Piggin
Move a couple of existing scripts there, and remove scripts directory: a script is a tool, a tool is not a script. I plan to add some tools that require compilation (though not in this series), so this matches other architectures more closely. Signed-off-by: Nick Piggin --- arch/powerpc/Makefile

[PATCH 3/7] powerpc/64s: tool to flag direct branches from unrelocated interrupt vectors

2016-10-18 Thread Nicholas Piggin
Direct banches from code below __end_interrupts to code above __end_interrupts when built with CONFIG_RELOCATABLE are disallowed because they will break when the kernel is not located at 0. Sample output: WARNING: Unrelocated relative branches c118 bl-> 0xc0038fb8

[PATCH 4/7] powerpc/64: tool to check head sections location sanity

2016-10-18 Thread Nicholas Piggin
Use a tool to check the location of "fixed sections" is where we expected them, which catches cases the linker script can't (stubs being added to start of .text section), and which ends up being neater. Sample output: ERROR: start_text address is c0008100, should be c0008000 E

[PATCH 6/7] powerpc: switch to using thin archives if COMPILE_TEST is set

2016-10-18 Thread Nicholas Piggin
Enable thin archives build for powerpc when COMPILE_TEST is set. Thin archives are explained in this commit: a5967db9af51a84f5e181600954714a9e4c69f1f This is a gradual way to introduce the option to testers. Some change to the way we invoke ar is required so it can be used by scripts/link-vmli

[PATCH 7/7] powerpc/64: allow CONFIG_RELOCATABLE if COMPILE_TEST

2016-10-18 Thread Nicholas Piggin
This is cruft to work around allmodconfig build breakage. Signed-off-by: Nicholas Piggin --- arch/powerpc/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 00d9e31..f48d2eb 100644 --- a/arch/powerpc/Kconfig +++ b/arc

[PATCH 5/7] powerpc/64: handle linker stubs in low .text code

2016-10-18 Thread Nicholas Piggin
Very large kernels require linker stubs, but the linker tends to place them in ways that make it very difficult to detect programatically with the assembler when taking absolute real (physical) addresses. This breaks the early boot code. Create a small section just before the .text section with an

Re: [PATCH 3/7] powerpc/64s: tool to flag direct branches from unrelocated interrupt vectors

2016-10-18 Thread Balbir Singh
On 19/10/16 14:15, Nicholas Piggin wrote: > Direct banches from code below __end_interrupts to code above > __end_interrupts when built with CONFIG_RELOCATABLE are disallowed > because they will break when the kernel is not located at 0. > > Sample output: > > WARNING: Unrelocated relative

Re: [PATCH] mm/hugetlb: Use the right pte val for compare in hugetlb_cow

2016-10-18 Thread Aneesh Kumar K.V
Andrew Morton writes: > On Tue, 18 Oct 2016 21:12:45 +0530 "Aneesh Kumar K.V" > wrote: > >> We cannot use the pte value used in set_pte_at for pte_same comparison, >> because archs like ppc64, filter/add new pte flag in set_pte_at. Instead >> fetch the pte value inside hugetlb_cow. We are compa

Re: [PATCH] mm/hugetlb: Use the right pte val for compare in hugetlb_cow

2016-10-18 Thread Hillf Danton
On Tuesday, October 18, 2016 11:43 PM Aneesh Kumar K.V wrote: > > We cannot use the pte value used in set_pte_at for pte_same comparison, > because archs like ppc64, filter/add new pte flag in set_pte_at. Instead > fetch the pte value inside hugetlb_cow. We are comparing pte value to > make sure t

[PATCH v2] powerpc/hash64: Be more careful when generating tlbiel

2016-10-18 Thread Michael Ellerman
From: Balbir Singh In ISA v2.05, the tlbiel instruction takes two arguments, RB and L: tlbiel RB,L +-+-++-+-+-++ |31 |/| L |/|RB | 274 | / | | 31 - 26 | 25 - 22 | 21 | 20 - 16 | 15 - 11 | 10 - 1 | 0 | +-

Re: [PATCH 6/7] powerpc: switch to using thin archives if COMPILE_TEST is set

2016-10-18 Thread Stephen Rothwell
Hi Nick, On Wed, 19 Oct 2016 14:15:59 +1100 Nicholas Piggin wrote: > > Enable thin archives build for powerpc when COMPILE_TEST is set. > Thin archives are explained in this commit: > > a5967db9af51a84f5e181600954714a9e4c69f1f This reference should be like this: a5967db9af51 ("kbuild: allo

Re: [PATCH v2] powernv: Simplify searching for compatible device nodes

2016-10-18 Thread Cyril Bur
On Wed, 2016-08-10 at 19:32 -0500, Jack Miller wrote: > This condenses the opal node searching into a single function that > finds > all compatible nodes, instead of just searching the ibm,opal > children, > for ipmi, flash, and prd similar to how opal-i2c nodes are found. > Hi Michael, It seems

Re: [PATCH 3/7] powerpc/64s: tool to flag direct branches from unrelocated interrupt vectors

2016-10-18 Thread Nicholas Piggin
On Wed, 19 Oct 2016 15:28:40 +1100 Balbir Singh wrote: > On 19/10/16 14:15, Nicholas Piggin wrote: > > Direct banches from code below __end_interrupts to code above > > __end_interrupts when built with CONFIG_RELOCATABLE are disallowed > > because they will break when the kernel is not located at

[PATCH v4 1/5] kernel/sched: introduce vcpu preempted check interface

2016-10-18 Thread Pan Xinhui
This patch support to fix lock holder preemption issue. For kernel users, we could use bool vcpu_is_preempted(int cpu) to detech if one vcpu is preempted or not. The default implementation is a macro defined by false. So compiler can wrap it out if arch dose not support such vcpu pteempted check.

[PATCH v4 0/5] implement vcpu preempted check

2016-10-18 Thread Pan Xinhui
change from v3: add x86 vcpu preempted check patch change from v2: no code change, fix typos, update some comments change from v1: a simplier definition of default vcpu_is_preempted skip mahcine type check on ppc, and add config. remove dedicated macro. add o

[PATCH v4 2/5] locking/osq: Drop the overload of osq_lock()

2016-10-18 Thread Pan Xinhui
An over-committed guest with more vCPUs than pCPUs has a heavy overload in osq_lock(). This is because vCPU A hold the osq lock and yield out, vCPU B wait per_cpu node->locked to be set. IOW, vCPU B wait vCPU A to run and unlock the osq lock. Kernel has an interface bool vcpu_is_preempted(int cpu

[PATCH v4 3/5] kernel/locking: Drop the overload of {mutex, rwsem}_spin_on_owner

2016-10-18 Thread Pan Xinhui
An over-committed guest with more vCPUs than pCPUs has a heavy overload in the two spin_on_owner. This blames on the lock holder preemption issue. Kernel has an interface bool vcpu_is_preempted(int cpu) to see if a vCPU is currently running or not. So break the spin loops on true condition. test-

[PATCH v4 4/5] powerpc/spinlock: support vcpu preempted check

2016-10-18 Thread Pan Xinhui
This is to fix some lock holder preemption issues. Some other locks implementation do a spin loop before acquiring the lock itself. Currently kernel has an interface of bool vcpu_is_preempted(int cpu). It takes the cpu as parameter and return true if the cpu is preempted. Then kernel can break the

[PATCH v4 5/5] x86, kvm: support vcpu preempted check

2016-10-18 Thread Pan Xinhui
This is to fix some lock holder preemption issues. Some other locks implementation do a spin loop before acquiring the lock itself. Currently kernel has an interface of bool vcpu_is_preempted(int cpu). It takes the cpu as parameter and return true if the cpu is preempted. Then kernel can break the

Re: [PATCH v4 0/5] implement vcpu preempted check

2016-10-18 Thread Christian Borntraeger
On 10/19/2016 12:20 PM, Pan Xinhui wrote: > change from v3: > add x86 vcpu preempted check patch If you want you could add the s390 patch that I provided for your last version. I also gave my Acked-by for all previous patches. > change from v2: > no code change, fix typos, update so