Re: [PATCH v4 02/12] KVM: define common KVM_GUESTDBG_USE_SW/HW_BP bits

2015-05-15 Thread David Hildenbrand
> Am 15.05.2015 um 16:27 schrieb Alex Bennée: > > +++ b/arch/s390/include/uapi/asm/kvm.h > > @@ -114,8 +114,6 @@ struct kvm_fpu { > > __u64 fprs[16]; > > }; > > > > -#define KVM_GUESTDBG_USE_HW_BP 0x0001 > [...] > > +++ b/include/uapi/linux/kvm.h > [...] > > +#define KVM_GUEST

[RFC 1/2] powerpc/fsl-pci: atomic get_user when pagefault_disabled

2014-11-25 Thread David Hildenbrand
Whenever we have pagefaults disabled, we have to use the atomic variants of (set|get)_user and copy_(from|to)_user. Signed-off-by: David Hildenbrand --- arch/powerpc/sysdev/fsl_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc

[RFC 0/2] Reenable might_sleep() checks for might_fault() when atomic

2014-11-25 Thread David Hildenbrand
riants usually don't perform access checks 5. .*_inatomic variants don't call might_fault() 6. If common code uses the __.* variants, it has to trigger access_ok() and call might_fault() 7. For pagefault_disable(), the inatomic variants are to be used Comments? Opinions? David Hilden

[RFC 2/2] mm, sched: trigger might_sleep() in might_fault() when atomic

2014-11-25 Thread David Hildenbrand
accessed while pagefault_disabled() is set, the atomic variants of copy_(to|from)_user can be used. This patch reverts commit 662bbcb2747c2422cf98d3d97619509379eee466 taking care of the !MMU optimization. Signed-off-by: David Hildenbrand --- include/linux/kernel.h | 8 ++-- mm/memory.c

Re: [RFC 0/2] Reenable might_sleep() checks for might_fault() when atomic

2014-11-26 Thread David Hildenbrand
to me. > On Tue, Nov 25, 2014 at 12:43:24PM +0100, David Hildenbrand wrote: > > I recently discovered that commit 662bbcb2747c2422cf98d3d97619509379eee466 > > removed/skipped all might_sleep checks for might_fault() calls when in > > atomic. > > Yes. You can add e.g.

Re: [RFC 0/2] Reenable might_sleep() checks for might_fault() when atomic

2014-11-26 Thread David Hildenbrand
> On Wed, Nov 26, 2014 at 05:17:29PM +0200, Michael S. Tsirkin wrote: > > On Wed, Nov 26, 2014 at 11:05:04AM +0100, David Hildenbrand wrote: > > > > What's the path you are trying to debug? > > > > > > Well, we had a problem where we held a spin_loc

Re: [RFC 0/2] Reenable might_sleep() checks for might_fault() when atomic

2014-11-26 Thread David Hildenbrand
> > This is what happened on our side (very recent kernel): > > > > spin_lock(&lock) > > copy_to_user(...) > > spin_unlock(&lock) > > That's a deadlock even without copy_to_user - it's > enough for the thread to be preempted and another one > to try taking the lock. > > > > 1. s390 locks/unlock

Re: [RFC 0/2] Reenable might_sleep() checks for might_fault() when atomic

2014-11-27 Thread David Hildenbrand
> Code like > spin_lock(&lock); > if (copy_to_user(...)) > rc = ... > spin_unlock(&lock); > really *should* generate warnings like it did before. > > And *only* code like > spin_lock(&lock); Is only code like this valid or also with the spin_lock() dropped? (

Re: [RFC 0/2] Reenable might_sleep() checks for might_fault() when atomic

2014-11-27 Thread David Hildenbrand
> On Thu, Nov 27, 2014 at 09:03:01AM +0100, David Hildenbrand wrote: > > > Code like > > > spin_lock(&lock); > > > if (copy_to_user(...)) > > > rc = ... > > > spin_unlock(&lock); > > > really *should* genera

Re: [RFC 0/2] Reenable might_sleep() checks for might_fault() when atomic

2014-11-27 Thread David Hildenbrand
> OTOH, there is no reason why we need to disable preemption over that > page_fault_disabled() region. There are code pathes which really do > not require to disable preemption for that. > > We have that seperated in preempt-rt for obvious reasons and IIRC > Peter Zijlstra tried to distangle it in

Re: [RFC 0/2] Reenable might_sleep() checks for might_fault() when atomic

2014-11-27 Thread David Hildenbrand
> From: David Hildenbrand > ... > > Although it might not be optimal, but keeping a separate counter for > > pagefault_disable() as part of the preemption counter seems to be the only > > doable thing right now. I am not sure if a completely separated counter is > >

Re: [RFC 0/2] Reenable might_sleep() checks for might_fault() when atomic

2014-11-27 Thread David Hildenbrand
> From: David Hildenbrand [mailto:d...@linux.vnet.ibm.com] > > > From: David Hildenbrand > > > ... > > > > Although it might not be optimal, but keeping a separate counter for > > > > pagefault_disable() as part of the preemption counter seems to be the

[PATCH RFC 1/2] preempt: track pagefault_disable() calls in the preempt counter

2014-11-27 Thread David Hildenbrand
imple atomic context or in pagefault_disable() context. Cleanup the PREEMPT_ACTIVE defines and fix the preempt count documentation on the way. Signed-off-by: David Hildenbrand --- include/linux/preempt_mask.h | 24 +++- include/linux/uaccess.h | 21 ++-

[PATCH RFC 0/2] Reenable might_sleep() checks for might_fault() when atomic

2014-11-27 Thread David Hildenbrand
over/underflows - Change documentation of user access methods to reflect the real behavior - Don't touch the preempt counter, only the pagefault disable counter (future work) David Hildenbrand (2): preempt: track pagefault_disable() calls in the preempt counter mm, sched: trigger might_s

[PATCH RFC 2/2] mm, sched: trigger might_sleep() in might_fault() when pagefaults are disabled

2014-11-27 Thread David Hildenbrand
g care of the !MMU optimization and the new pagefault_disabled() check. Signed-off-by: David Hildenbrand --- include/linux/kernel.h | 9 +++-- mm/memory.c| 15 --- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/linux/kernel.h b/include/linux/kerne

Re: [PATCH RFC 2/2] mm, sched: trigger might_sleep() in might_fault() when pagefaults are disabled

2014-11-27 Thread David Hildenbrand
> > > - > > > - __might_sleep(__FILE__, __LINE__, 0); > > > + if (unlikely(!pagefault_disabled())) > > > + __might_sleep(__FILE__, __LINE__, 0); > > > > > Same here: so maybe make might_fault a wrapper > around __might_fault as well. Yes, I also noticed that. It was part of the origin

Re: [RFC 0/2] Reenable might_sleep() checks for might_fault() when atomic

2014-11-27 Thread David Hildenbrand
> On Thu, 27 Nov 2014, David Hildenbrand wrote: > > > OTOH, there is no reason why we need to disable preemption over that > > > page_fault_disabled() region. There are code pathes which really do > > > not require to disable preemption for that. > > > >

Re: [RFC,1/2] powerpc/fsl-pci: atomic get_user when pagefault_disabled

2015-01-29 Thread David Hildenbrand
> On Tue, Nov 25, 2014 at 12:43:25PM +0100, David Hildenbrand wrote: > > Whenever we have pagefaults disabled, we have to use the atomic variants of > > (set|get)_user and copy_(from|to)_user. > > > > Signed-off-by: David Hildenbrand > > --- > > arch/powe

Re: [PATCH RFCv2 0/4] mm/memory_hotplug: Introduce memory block types

2019-03-27 Thread David Hildenbrand
On 20.12.18 14:08, Michal Hocko wrote: > On Thu 20-12-18 13:58:16, David Hildenbrand wrote: >> On 30.11.18 18:59, David Hildenbrand wrote: >>> This is the second approach, introducing more meaningful memory block >>> types and not changing online behavior in the kernel

[PATCH v1 4/4] mm/memory_hotplug: Make __remove_pages() and arch_remove_memory() never fail

2019-04-09 Thread David Hildenbrand
rnel.org Cc: linux-s...@vger.kernel.org Signed-off-by: David Hildenbrand --- arch/ia64/mm/init.c| 11 +++ arch/powerpc/mm/mem.c | 11 --- arch/s390/mm/init.c| 5 +++-- arch/sh/mm/init.c | 11 +++ arch/x86/mm/init_32.c

[PATCH v1 1/5] drivers/base/memory: rename MMOP_ONLINE_KEEP to MMOP_ONLINE

2020-03-11 Thread David Hildenbrand
: Wei Yang Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 9 + include/linux/memory_hotplug.h | 6 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 6448c9ece2cb..8c5ce42c0fc3 100644 --- a/dr

[PATCH v1 3/5] drivers/base/memory: store mapping between MMOP_* and string in an array

2020-03-11 Thread David Hildenbrand
Let's use a simple array which we can reuse soon. While at it, move the string->mmop conversion out of the device hotplug lock. Cc: Greg Kroah-Hartman Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off-by:

[PATCH v1 2/5] drivers/base/memory: map MMOP_OFFLINE to 0

2020-03-11 Thread David Hildenbrand
as an array index. Cc: Greg Kroah-Hartman Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 11 --- include/linux/memory_hotplug.h | 2 +- 2 fil

[PATCH v1 0/5] mm/memory_hotplug: allow to specify a default online_type

2020-03-11 Thread David Hildenbrand
hotplug behavior configured +PROGRAM=="grep online /sys/devices/system/memory/auto_online_blocks", GOTO="memory_hotplug_end" + PROGRAM="/bin/uname -p", RESULT=="s390*", GOTO="memory_hotplug_end" ENV{.state}="online" === [1] https://gi

[PATCH v1 4/5] mm/memory_hotplug: convert memhp_auto_online to store an online_type

2020-03-11 Thread David Hildenbrand
Mackerras Cc: Michael Ellerman Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Stephen Hemminger Cc: Wei Liu Cc: Thomas Gleixner Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-hyp...@vger.kernel.org Signed-off-by: David Hildenbrand --- arch/powerpc/platforms/powernv/memtrace.c | 2 +- d

[PATCH v1 5/5] mm/memory_hotplug: allow to specify a default online_type

2020-03-11 Thread David Hildenbrand
Greg Kroah-Hartman Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 11 +-- include/linux/memory_hotplug.h | 2 ++ mm/memory_hotplug.c

Re: [PATCH v1 5/5] mm/memory_hotplug: allow to specify a default online_type

2020-03-11 Thread David Hildenbrand
On 11.03.20 15:26, Wei Yang wrote: > On Wed, Mar 11, 2020 at 01:30:26PM +0100, David Hildenbrand wrote: >> For now, distributions implement advanced udev rules to essentially >> - Don't online any hotplugged memory (s390x) >> - Online all memory to ZONE_NORMAL (e.g., m

Re: [PATCH v1 5/5] mm/memory_hotplug: allow to specify a default online_type

2020-03-11 Thread David Hildenbrand
On 11.03.20 17:55, Vitaly Kuznetsov wrote: > David Hildenbrand writes: > >> For now, distributions implement advanced udev rules to essentially >> - Don't online any hotplugged memory (s390x) >> - Online all memory to ZONE_NORMAL (e.g., most virt environments like

Re: [PATCH v1 1/5] drivers/base/memory: rename MMOP_ONLINE_KEEP to MMOP_ONLINE

2020-03-16 Thread David Hildenbrand
On 16.03.20 16:12, Michal Hocko wrote: > On Wed 11-03-20 13:30:22, David Hildenbrand wrote: >> The name is misleading. Let's just name it like the online_type name we >> expose to user space ("online"). > > I would disagree the name is misleading. It just say

Re: [PATCH v1 4/5] mm/memory_hotplug: convert memhp_auto_online to store an online_type

2020-03-16 Thread David Hildenbrand
On 16.03.20 16:24, Michal Hocko wrote: > On Wed 11-03-20 13:30:25, David Hildenbrand wrote: > [...] >> diff --git a/arch/powerpc/platforms/powernv/memtrace.c >> b/arch/powerpc/platforms/powernv/memtrace.c >> index d6d64f8718e6..e15a600cfa4d 100644 >> --- a/

Re: [PATCH v1 5/5] mm/memory_hotplug: allow to specify a default online_type

2020-03-16 Thread David Hildenbrand
On 16.03.20 16:31, Michal Hocko wrote: > On Wed 11-03-20 13:30:26, David Hildenbrand wrote: >> For now, distributions implement advanced udev rules to essentially >> - Don't online any hotplugged memory (s390x) >> - Online all memory to ZONE_NORMAL (e.g., most virt env

[PATCH v2 0/8] mm/memory_hotplug: allow to specify a default online_type

2020-03-17 Thread David Hildenbrand
otplug_end" ACTION!="add", GOTO="memory_hotplug_end" +# memory hotplug behavior configured +PROGRAM=="grep online /sys/devices/system/memory/auto_online_blocks", GOTO="memory_hotplug_end" + PROGRAM="/bin/uname -p", RESULT=="s390*

[PATCH v2 1/8] drivers/base/memory: rename MMOP_ONLINE_KEEP to MMOP_ONLINE

2020-03-17 Thread David Hildenbrand
Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 9 + include/linux/memory_hotplug.h | 6 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/bas

[PATCH v2 2/8] drivers/base/memory: map MMOP_OFFLINE to 0

2020-03-17 Thread David Hildenbrand
ot;-1", which didn't use the enum value. This is a preparation to use the online_type as an array index. Reviewed-by: Wei Yang Acked-by: Michal Hocko Cc: Greg Kroah-Hartman Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Y

[PATCH v2 3/8] drivers/base/memory: store mapping between MMOP_* and string in an array

2020-03-17 Thread David Hildenbrand
t; Cc: Baoquan He Cc: Wei Yang Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 38 +++--- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index e7e77cafef80..8a7f29c0bf97 100644 --- a/dri

[PATCH v2 4/8] powernv/memtrace: always online added memory blocks

2020-03-17 Thread David Hildenbrand
socki" Cc: Baoquan He Cc: Wei Yang Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: David Hildenbrand --- arch/powerpc/platforms/powernv/memtrace.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/pl

[PATCH v2 5/8] hv_balloon: don't check for memhp_auto_online manually

2020-03-17 Thread David Hildenbrand
"K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Stephen Hemminger Cc: Wei Liu Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Cc: Vitaly Kuznetsov Cc: linux-hyp...@vger.kernel.org Signed-off-by: D

[PATCH v2 6/8] mm/memory_hotplug: unexport memhp_auto_online

2020-03-17 Thread David Hildenbrand
All in-tree users except the mm-core are gone. Let's drop the export. Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off-by: David Hildenbrand --- mm/memory_hotplug.c | 1 - 1 file changed, 1 deletion(-)

[PATCH v2 7/8] mm/memory_hotplug: convert memhp_auto_online to store an online_type

2020-03-17 Thread David Hildenbrand
... and rename it to memhp_default_online_type. This is a preparation for more detailed default online behavior. Reviewed-by: Wei Yang Cc: Greg Kroah-Hartman Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off

[PATCH v2 8/8] mm/memory_hotplug: allow to specify a default online_type

2020-03-17 Thread David Hildenbrand
memory block via /sys/devices/system/memory/memoryX/state Reviewed-by: Wei Yang Cc: Greg Kroah-Hartman Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 1

Re: [PATCH v2 8/8] mm/memory_hotplug: allow to specify a default online_type

2020-03-17 Thread David Hildenbrand
On 17.03.20 12:01, Michal Hocko wrote: > On Tue 17-03-20 11:49:42, David Hildenbrand wrote: >> For now, distributions implement advanced udev rules to essentially >> - Don't online any hotplugged memory (s390x) >> - Online all memory to ZONE_NORMAL (e.g., most virt env

Re: [PATCH v2 8/8] mm/memory_hotplug: allow to specify a default online_type

2020-03-17 Thread David Hildenbrand
On 17.03.20 11:49, David Hildenbrand wrote: > For now, distributions implement advanced udev rules to essentially > - Don't online any hotplugged memory (s390x) > - Online all memory to ZONE_NORMAL (e.g., most virt environments like > hyperv) > - Online all memory to ZONE

Re: [PATCH v2 5/8] hv_balloon: don't check for memhp_auto_online manually

2020-03-17 Thread David Hildenbrand
On 17.03.20 17:29, Vitaly Kuznetsov wrote: > David Hildenbrand writes: > >> We get the MEM_ONLINE notifier call if memory is added right from the >> kernel via add_memory() or later from user space. >> >> Let's get rid of the "ha_waiting" flag - the w

Re: [PATCH v2 5/8] hv_balloon: don't check for memhp_auto_online manually

2020-03-17 Thread David Hildenbrand
> @@ -1707,6 +1701,7 @@ static int balloon_probe(struct hv_device *dev, > #ifdef CONFIG_MEMORY_HOTPLUG > set_online_page_callback(&hv_online_page); > register_memory_notifier(&hv_memory_nb); > + init_completion(&dm_device.ol_waitevent); I'll move this one line up. > #endif > >

Re: [PATCH v2 0/8] mm/memory_hotplug: allow to specify a default online_type

2020-03-18 Thread David Hildenbrand
On 18.03.20 14:05, Baoquan He wrote: > On 03/17/20 at 11:49am, David Hildenbrand wrote: >> Distributions nowadays use udev rules ([1] [2]) to specify if and >> how to online hotplugged memory. The rules seem to get more complex with >> many special cases. Due to the

[PATCH v3 1/8] drivers/base/memory: rename MMOP_ONLINE_KEEP to MMOP_ONLINE

2020-03-19 Thread David Hildenbrand
Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 9 + include/linux/memory_hotplug.h | 6 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/bas

[PATCH v3 0/8] mm/memory_hotplug: allow to specify a default online_type

2020-03-19 Thread David Hildenbrand
uot;add", TEST=="online", ATTR{online}=="0", ATTR{online} # Memory hotadd request SUBSYSTEM!="memory", GOTO="memory_hotplug_end" ACTION!="add", GOTO="memory_hotplug_end" +# memory hotplug behavior configured +PROGRAM=="grep

[PATCH v3 2/8] drivers/base/memory: map MMOP_OFFLINE to 0

2020-03-19 Thread David Hildenbrand
ot;-1", which didn't use the enum value. This is a preparation to use the online_type as an array index. Reviewed-by: Wei Yang Acked-by: Michal Hocko Cc: Greg Kroah-Hartman Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Y

[PATCH v3 3/8] drivers/base/memory: store mapping between MMOP_* and string in an array

2020-03-19 Thread David Hildenbrand
t; Cc: Baoquan He Cc: Wei Yang Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 38 +++--- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index e7e77cafef80..8a7f29c0bf97 100644 --- a/dri

[PATCH v3 4/8] powernv/memtrace: always online added memory blocks

2020-03-19 Thread David Hildenbrand
rtman Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: David Hildenbrand --- arch/powerpc/platforms/powernv/memtrace.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) di

[PATCH v3 6/8] mm/memory_hotplug: unexport memhp_auto_online

2020-03-19 Thread David Hildenbrand
All in-tree users except the mm-core are gone. Let's drop the export. Reviewed-by: Wei Yang Acked-by: Michal Hocko Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off-by: David Hildenbrand --- mm/memory_hot

[PATCH v3 5/8] hv_balloon: don't check for memhp_auto_online manually

2020-03-19 Thread David Hildenbrand
viewed-by: Vitaly Kuznetsov Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Stephen Hemminger Cc: Wei Liu Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Cc: Vitaly Kuznetsov Cc: linux-hyp...@vger.kernel.or

[PATCH v3 7/8] mm/memory_hotplug: convert memhp_auto_online to store an online_type

2020-03-19 Thread David Hildenbrand
: Wei Yang Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 10 -- include/linux/memory_hotplug.h | 3 ++- mm/memory_hotplug.c| 11 ++- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memo

[PATCH v3 8/8] mm/memory_hotplug: allow to specify a default online_type

2020-03-19 Thread David Hildenbrand
memory block via /sys/devices/system/memory/memoryX/state Reviewed-by: Wei Yang Acked-by: Michal Hocko Cc: Greg Kroah-Hartman Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off-by: David Hildenbrand --- d

Re: [PATCH v3 3/8] drivers/base/memory: store mapping between MMOP_* and string in an array

2020-03-20 Thread David Hildenbrand
On 20.03.20 08:36, Baoquan He wrote: > On 03/19/20 at 02:12pm, David Hildenbrand wrote: >> Let's use a simple array which we can reuse soon. While at it, move the >> string->mmop conversion out of the device hotplug lock. >> >> Reviewed-by: Wei Yang >>

Re: [PATCH v2] mm/sparse: Fix kernel crash with pfn_section_valid check

2020-03-27 Thread David Hildenbrand
r vmmemap mapping > (16MB), > a specific vmemmap mapping can cover multiple sections. Hence before a vmemmap > mapping page can be freed, the kernel needs to make sure there are no valid > sections > within that mapping. Clearing the section valid bit before > depopulate_section_memap enables t

[PATCH RFC v1 03/12] KVM: x86/mmu: Prepare kvm_is_mmio_pfn() for PG_reserved changes

2019-10-22 Thread David Hildenbrand
Cc: "H. Peter Anvin" Cc: KarimAllah Ahmed Cc: Michal Hocko Cc: Dan Williams Signed-off-by: David Hildenbrand --- arch/x86/kvm/mmu.c | 30 ++ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 2

[PATCH RFC v1 04/12] KVM: Prepare kvm_is_reserved_pfn() for PG_reserved changes

2019-10-22 Thread David Hildenbrand
accessed). Cc: Paolo Bonzini Cc: "Radim Krčmář" Cc: Michal Hocko Cc: Dan Williams Cc: KarimAllah Ahmed Signed-off-by: David Hildenbrand --- virt/kvm/kvm_main.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_ma

[PATCH RFC v1 01/12] mm/memory_hotplug: Don't allow to online/offline memory blocks with holes

2019-10-22 Thread David Hildenbrand
-by: David Hildenbrand --- mm/memory_hotplug.c | 26 -- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 561371ead39a..7210f4375279 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1447,10 +1447,19

[PATCH RFC v1 07/12] staging: kpc2000: Prepare transfer_complete_cb() for PG_reserved changes

2019-10-22 Thread David Hildenbrand
" Cc: Dan Carpenter Cc: Nishka Dasgupta Cc: Madhumitha Prabakaran Cc: Fabio Estevam Cc: Matt Sickler Cc: Jeremy Sowden Signed-off-by: David Hildenbrand --- drivers/staging/kpc2000/kpc_dma/fileops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/

[PATCH RFC v1 08/12] powerpc/book3s: Prepare kvmppc_book3s_instantiate_page() for PG_reserved changes

2019-10-22 Thread David Hildenbrand
-by: David Hildenbrand --- arch/powerpc/kvm/book3s_64_mmu_radix.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c index 2d415c36a61d..05397c0561fc 100644 --- a/arch/powerpc/kvm

[PATCH RFC v1 05/12] vfio/type1: Prepare is_invalid_reserved_pfn() for PG_reserved changes

2019-10-22 Thread David Hildenbrand
accessed). Cc: Alex Williamson Cc: Cornelia Huck Signed-off-by: David Hildenbrand --- drivers/vfio/vfio_iommu_type1.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 2ada8e6cdb88

[PATCH RFC v1 09/12] powerpc/64s: Prepare hash_page_do_lazy_icache() for PG_reserved changes

2019-10-22 Thread David Hildenbrand
Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: "Aneesh Kumar K.V" Cc: Christophe Leroy Cc: Nicholas Piggin Cc: Andrew Morton Cc: Mike Rapoport Cc: YueHaibing Signed-off-by: David Hildenbrand --- arch/powerpc/mm/book3s64/hash_utils.c | 10 ++ 1 file changed, 6

[PATCH RFC v1 06/12] staging/gasket: Prepare gasket_release_page() for PG_reserved changes

2019-10-22 Thread David Hildenbrand
rtman Signed-off-by: David Hildenbrand --- drivers/staging/gasket/gasket_page_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/gasket/gasket_page_table.c b/drivers/staging/gasket/gasket_page_table.c index f6d715787da8..d43fed58bf65 100644 --- a/drivers/st

[PATCH RFC v1 10/12] powerpc/mm: Prepare maybe_pte_to_page() for PG_reserved changes

2019-10-22 Thread David Hildenbrand
Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Christophe Leroy Cc: "Aneesh Kumar K.V" Cc: Allison Randal Cc: Nicholas Piggin Cc: Thomas Gleixner Signed-off-by: David Hildenbrand --- arch/powerpc/mm/pgtable.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletion

[PATCH RFC v1 11/12] x86/mm: Prepare __ioremap_check_ram() for PG_reserved changes

2019-10-22 Thread David Hildenbrand
Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Signed-off-by: David Hildenbrand --- arch/x86/mm/ioremap.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/x86/mm/ioremap.c

[PATCH RFC v1 12/12] mm/memory_hotplug: Don't mark pages PG_reserved when initializing the memmap

2019-10-22 Thread David Hildenbrand
n Khandual Suggested-by: Michal Hocko Signed-off-by: David Hildenbrand --- drivers/hv/hv_balloon.c| 6 ++ drivers/xen/balloon.c | 7 +++ include/linux/page-flags.h | 8 +--- mm/memory_hotplug.c| 17 +++-- mm/page_alloc.c| 11 --

[PATCH RFC v1 00/12] mm: Don't mark hotplugged pages PG_reserved (including ZONE_DEVICE)

2019-10-22 Thread David Hildenbrand
tps://lkml.org/lkml/2019/10/21/736 [2] https://lkml.org/lkml/2019/10/21/1034 Cc: Michal Hocko Cc: Dan Williams Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: k...@vger.kernel.org Cc: linux-hyp...@vger.kernel.org Cc: de...@driverdev.osuosl.org Cc: xen-de...@lists.xenpr

[PATCH RFC v1 02/12] mm/usercopy.c: Prepare check_page_span() for PG_reserved changes

2019-10-22 Thread David Hildenbrand
ecks). Cc: Kees Cook Cc: Andrew Morton Cc: Kate Stewart Cc: Allison Randal Cc: "Isaac J. Manjarres" Cc: Qian Cai Cc: Thomas Gleixner Signed-off-by: David Hildenbrand --- mm/usercopy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/usercopy.c b

Re: [PATCH RFC v1 07/12] staging: kpc2000: Prepare transfer_complete_cb() for PG_reserved changes

2019-10-22 Thread David Hildenbrand
On 22.10.19 19:55, Matt Sickler wrote: Right now, ZONE_DEVICE memory is always set PG_reserved. We want to change that. The pages are obtained via get_user_pages_fast(). I assume, these could be ZONE_DEVICE pages. Let's just exclude them as well explicitly. I'm not sure what ZONE_DEVICE pages

Re: [PATCH RFC v1 00/12] mm: Don't mark hotplugged pages PG_reserved (including ZONE_DEVICE)

2019-10-23 Thread David Hildenbrand
On 22.10.19 23:54, Dan Williams wrote: > Hi David, > > Thanks for tackling this! Thanks for having a look :) [...] >> I am probably a little bit too careful (but I don't want to break things). >> In most places (besides KVM and vfio that are nuts), the >> pfn_to_online_page() check could most

Re: [PATCH RFC v1 06/12] staging/gasket: Prepare gasket_release_page() for PG_reserved changes

2019-10-23 Thread David Hildenbrand
On 22.10.19 19:12, David Hildenbrand wrote: Right now, ZONE_DEVICE memory is always set PG_reserved. We want to change that. The pages are obtained via get_user_pages_fast(). I assume, these could be ZONE_DEVICE pages. Let's just exclude them as well explicitly. Cc: Rob Springer Cc:

Re: [PATCH RFC v1 02/12] mm/usercopy.c: Prepare check_page_span() for PG_reserved changes

2019-10-23 Thread David Hildenbrand
On 22.10.19 19:12, David Hildenbrand wrote: Right now, ZONE_DEVICE memory is always set PG_reserved. We want to change that. Let's make sure that the logic in the function won't change. Once we no longer set these pages to reserved, we can rework this function to perform separate

Re: [PATCH RFC v1 02/12] mm/usercopy.c: Prepare check_page_span() for PG_reserved changes

2019-10-23 Thread David Hildenbrand
On 23.10.19 18:25, Kees Cook wrote: > On Wed, Oct 23, 2019 at 10:20:14AM +0200, David Hildenbrand wrote: >> On 22.10.19 19:12, David Hildenbrand wrote: >>> Right now, ZONE_DEVICE memory is always set PG_reserved. We want to >>> change that. >>> >>> L

Re: [PATCH RFC v1 00/12] mm: Don't mark hotplugged pages PG_reserved (including ZONE_DEVICE)

2019-10-23 Thread David Hildenbrand
>> I dislike this for three reasons >> >> a) It does not protect against any races, really, it does not improve things. >> b) We do have the exact same problem with pfn_to_online_page(). As long as we >>don't hold the memory hotplug lock, memory can get offlined and remove >> any time. Racy. >

Re: [PATCH RFC v1 00/12] mm: Don't mark hotplugged pages PG_reserved (including ZONE_DEVICE)

2019-10-23 Thread David Hildenbrand
On 23.10.19 21:39, Dan Williams wrote: > On Wed, Oct 23, 2019 at 10:28 AM David Hildenbrand wrote: >> >>>> I dislike this for three reasons >>>> >>>> a) It does not protect against any races, really, it does not improve >>>&g

Re: [PATCH RFC v1 01/12] mm/memory_hotplug: Don't allow to online/offline memory blocks with holes

2019-10-24 Thread David Hildenbrand
On 24.10.19 05:53, Anshuman Khandual wrote: On 10/22/2019 10:42 PM, David Hildenbrand wrote: Our onlining/offlining code is unnecessarily complicated. Only memory blocks added during boot can have holes. Hotplugged memory never has holes. That memory is already online. Why hot plugged memory

[PATCH v1 00/10] mm: Don't mark hotplugged pages PG_reserved (including ZONE_DEVICE)

2019-10-24 Thread David Hildenbrand
: Dan Williams Cc: kvm-...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: k...@vger.kernel.org Cc: linux-hyp...@vger.kernel.org Cc: de...@driverdev.osuosl.org Cc: xen-de...@lists.xenproject.org Cc: x...@kernel.org Cc: Alexander Duyck David Hildenbrand (10): mm/memory_hotplug: Don't allow to o

[PATCH v1 01/10] mm/memory_hotplug: Don't allow to online/offline memory blocks with holes

2019-10-24 Thread David Hildenbrand
: Michal Hocko Cc: Oscar Salvador Cc: Pavel Tatashin Cc: Dan Williams Cc: Anshuman Khandual Signed-off-by: David Hildenbrand --- mm/memory_hotplug.c | 26 -- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index

[PATCH v1 02/10] KVM: x86/mmu: Prepare kvm_is_mmio_pfn() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
Wanpeng Li Cc: Jim Mattson Cc: Joerg Roedel Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: KarimAllah Ahmed Cc: Michal Hocko Cc: Dan Williams Signed-off-by: David Hildenbrand --- arch/x86/kvm/mmu.c | 29 + 1 file chan

[PATCH v1 03/10] KVM: Prepare kvm_is_reserved_pfn() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
arimAllah Ahmed Signed-off-by: David Hildenbrand --- virt/kvm/kvm_main.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index e9eb666eb6e8..9d18cc67d124 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -151,9 +151,1

[PATCH v1 04/10] vfio/type1: Prepare is_invalid_reserved_pfn() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
have an initialized memmap (and don't have ZONE_DEVICE memory). Rewrite is_invalid_reserved_pfn() similar to kvm_is_reserved_pfn() to make sure the function produces the same result once we stop setting ZONE_DEVICE pages PG_reserved. Cc: Alex Williamson Cc: Cornelia Huck Signed-off-by:

[PATCH v1 05/10] powerpc/book3s: Prepare kvmppc_book3s_instantiate_page() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
t Cc: Michael Ellerman Signed-off-by: David Hildenbrand --- arch/powerpc/kvm/book3s_64_mmu_radix.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c index 2d415c36a61d..05397c0561fc 100644

[PATCH v1 06/10] powerpc/64s: Prepare hash_page_do_lazy_icache() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
: "Aneesh Kumar K.V" Cc: Christophe Leroy Cc: Nicholas Piggin Cc: Andrew Morton Cc: Mike Rapoport Cc: YueHaibing Signed-off-by: David Hildenbrand --- arch/powerpc/mm/book3s64/hash_utils.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/m

[PATCH v1 07/10] powerpc/mm: Prepare maybe_pte_to_page() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
Leroy Cc: "Aneesh Kumar K.V" Cc: Allison Randal Cc: Nicholas Piggin Cc: Thomas Gleixner Signed-off-by: David Hildenbrand --- arch/powerpc/mm/pgtable.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtab

[PATCH v1 08/10] x86/mm: Prepare __ioremap_check_ram() for PG_reserved changes

2019-10-24 Thread David Hildenbrand
: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Signed-off-by: David Hildenbrand --- arch/x86/mm/ioremap.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index a39dcdb5ae34..db6913b48edf 100644

[PATCH v1 09/10] mm/memory_hotplug: Don't mark pages PG_reserved when initializing the memmap

2019-10-24 Thread David Hildenbrand
Weiner Cc: Anthony Yznaga Cc: Michal Hocko Cc: Oscar Salvador Cc: Dan Williams Cc: Mel Gorman Cc: Mike Rapoport Cc: Anshuman Khandual Cc: Matt Sickler Cc: Kees Cook Suggested-by: Michal Hocko Signed-off-by: David Hildenbrand --- drivers/hv/hv_balloon.c| 6 ++ drivers/xen/balloon.

[PATCH v1 10/10] mm/usercopy.c: Update comment in check_page_span() regarding ZONE_DEVICE

2019-10-24 Thread David Hildenbrand
Cc: Thomas Gleixner Signed-off-by: David Hildenbrand --- mm/usercopy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/usercopy.c b/mm/usercopy.c index 660717a1ea5c..80f254024c97 100644 --- a/mm/usercopy.c +++ b/mm/usercopy.c @@ -199,9 +199,9 @@ static inline void check_

Re: [PATCH RFC v1 00/12] mm: Don't mark hotplugged pages PG_reserved (including ZONE_DEVICE)

2019-10-24 Thread David Hildenbrand
On 23.10.19 09:26, David Hildenbrand wrote: On 22.10.19 23:54, Dan Williams wrote: Hi David, Thanks for tackling this! Thanks for having a look :) [...] I am probably a little bit too careful (but I don't want to break things). In most places (besides KVM and vfio that are nuts)

Re: [PATCH v6 05/10] mm/memory_hotplug: Shrink zones when offlining memory

2019-10-27 Thread David Hildenbrand
On 06.10.19 10:56, David Hildenbrand wrote: We currently try to shrink a single zone when removing memory. We use the zone of the first page of the memory we are removing. If that memmap was never initialized (e.g., memory was never onlined), we will read garbage and can trigger kernel BUGs (due

[PATCH v1 01/12] powerpc/pseries: CMM: Implement release() function for sysfs device

2019-10-31 Thread David Hildenbrand
Greg Kroah-Hartman Cc: Thomas Gleixner Cc: Arun KS Signed-off-by: David Hildenbrand --- arch/powerpc/platforms/pseries/cmm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c index b33251d75927..572651a5c87b 100644

[PATCH v1 02/12] powerpc/pseries: CMM: Report errors when registering notifiers fails

2019-10-31 Thread David Hildenbrand
If we don't set the rc, we will return "0", making it look like we succeeded. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Andrew Morton Cc: Pavel Tatashin Cc: Richard Fontana Cc: Allison Randal Cc: Thomas Gleixner Cc: Arun KS Signed-off-by: Da

[PATCH v1 00/12] powerpc/pseries: CMM: Implement balloon compaction and remove isolate notifier

2019-10-31 Thread David Hildenbrand
d test with actual HW that has this feature. Cc: Alexander Duyck Cc: Alexander Potapenko Cc: Alexey Kardashevskiy Cc: Allison Randal Cc: Andrew Morton Cc: Anshuman Khandual Cc: Anshuman Khandual Cc: Arun KS Cc: Benjamin Herrenschmidt Cc: Christian Brauner Cc: Dan Williams Cc: David Hildenbr

[PATCH v1 03/12] powerpc/pseries: CMM: Cleanup rc handling in cmm_init()

2019-10-31 Thread David Hildenbrand
No need to initialize rc. Also, let's return 0 directly when succeeding. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Greg Kroah-Hartman Cc: Michal Hocko Cc: Konstantin Khlebnikov Cc: Andrew Morton Cc: Arun KS Cc: Thomas Gleixner Signed-off-by: David Hilden

[PATCH v1 04/12] powerpc/pseries: CMM: Drop page array

2019-10-31 Thread David Hildenbrand
: Thomas Gleixner Cc: Arun KS Signed-off-by: David Hildenbrand --- arch/powerpc/platforms/pseries/cmm.c | 163 ++- 1 file changed, 36 insertions(+), 127 deletions(-) diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c index 738e

[PATCH v1 05/12] powerpc/pseries: CMM: Use adjust_managed_page_count() insted of totalram_pages_*

2019-10-31 Thread David Hildenbrand
ashin Cc: Richard Fontana Cc: Allison Randal Cc: Thomas Gleixner Cc: Arun KS Signed-off-by: David Hildenbrand --- arch/powerpc/platforms/pseries/cmm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/ps

[PATCH v1 06/12] powerpc/pseries: CMM: Rip out memory isolate notifier

2019-10-31 Thread David Hildenbrand
Mackerras Cc: Michael Ellerman Cc: Andrew Morton Cc: Pavel Tatashin Cc: Richard Fontana Cc: Allison Randal Cc: Thomas Gleixner Cc: Arun KS Signed-off-by: David Hildenbrand --- arch/powerpc/platforms/pseries/cmm.c | 97 +--- 1 file changed, 1 insertion(+), 96 deletion

[PATCH v1 07/12] powerpc/pseries: CMM: Convert loaned_pages to an atomic_long_t

2019-10-31 Thread David Hildenbrand
thread and a concurrent OOM notifier. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Andrew Morton Cc: Pavel Tatashin Cc: Richard Fontana Cc: Allison Randal Cc: Thomas Gleixner Cc: Arun KS Signed-off-by: David Hildenbrand --- arch/powerpc/platforms/pseries/cmm.c | 35

[PATCH v1 08/12] powerpc/pseries: CMM: Implement balloon compaction

2019-10-31 Thread David Hildenbrand
ristian Brauner Cc: Gao Xiang Cc: Greg Hackmann Cc: David Howells Signed-off-by: David Hildenbrand --- arch/powerpc/platforms/pseries/Kconfig | 1 + arch/powerpc/platforms/pseries/cmm.c | 132 ++--- include/uapi/linux/magic.h | 1 + 3 files changed, 120 inse

[PATCH v1 09/12] powerpc/pseries: CMM: Switch to balloon_page_alloc()

2019-10-31 Thread David Hildenbrand
: Arun KS Signed-off-by: David Hildenbrand --- arch/powerpc/platforms/pseries/cmm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c index 235fd7fe9df1..a6ec2bbb1f91 100644 --- a/arch/powerpc

  1   2   3   4   5   6   7   8   9   10   >