Re: [Patch v2] mm/memblock: discard .text/.data if CONFIG_ARCH_KEEP_MEMBLOCK not set

2024-05-23 Thread Wei Yang
On Tue, May 21, 2024 at 10:21:52AM +0300, Mike Rapoport wrote: >Hi, > >On Fri, May 10, 2024 at 02:04:22AM +0000, Wei Yang wrote: >> When CONFIG_ARCH_KEEP_MEMBLOCK not set, we expect to discard related >> code and data. But it doesn't until CONFIG_MEMORY_HOTPLUG not s

[Patch v2] mm/memblock: discard .text/.data if CONFIG_ARCH_KEEP_MEMBLOCK not set

2024-05-09 Thread Wei Yang
e and data. After this, from the log message in mem_init_print_info(), init size increase from 2420K to 2432K on arch x86. Signed-off-by: Wei Yang --- v2: fix orphan section for powerpc --- arch/powerpc/kernel/vmlinux.lds.S | 1 + include/asm-generic/vmlinux.lds.h | 14 +- include/linux/

Re: [PATCH v1 2/2] mm/memory_hotplug: remove is_mem_section_removable()

2020-04-07 Thread Wei Yang
ew Morton >Cc: Oscar Salvador >Cc: Baoquan He >Cc: Wei Yang >Signed-off-by: David Hildenbrand Nice. Reviewed-by: Wei Yang -- Wei Yang Help you, Help me

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

2020-03-26 Thread Wei Yang
n 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 this. > >Fixes: d41e2f3bd546 ("mm/hotplug: fix

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

2020-03-17 Thread Wei Yang
On Tue, Mar 17, 2020 at 11:49:40AM +0100, David Hildenbrand wrote: >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

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

2020-03-17 Thread Wei Yang
llerman >Cc: Andrew Morton >Cc: Greg Kroah-Hartman >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 Looks good. Reviewed-by: Wei Yang >

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

2020-03-11 Thread Wei Yang
On Wed, Mar 11, 2020 at 02:20:02PM +, Wei Yang wrote: >On Wed, Mar 11, 2020 at 01:30:24PM +0100, 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. >> &

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

2020-03-11 Thread Wei Yang
/devices/systemn/memory/auto_online_blocks >just like we are able to specify for a single memory block via >/sys/devices/systemn/memory/memoryX/state > >Cc: Greg Kroah-Hartman >Cc: Andrew Morton >Cc: Michal Hocko >Cc: Oscar Salvador >Cc: "Rafael J. Wysocki"

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

2020-03-11 Thread Wei Yang
"Rafael J. Wysocki" >Cc: Baoquan He >Cc: Wei Yang >Cc: Benjamin Herrenschmidt >Cc: Paul Mackerras >Cc: Michael Ellerman >Cc: "K. Y. Srinivasan" >Cc: Haiyang Zhang >Cc: Stephen Hemminger >Cc: Wei Liu >Cc: Thomas Gleixner >Cc: linuxppc

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

2020-03-11 Thread Wei Yang
scar Salvador >Cc: "Rafael J. Wysocki" >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/

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

2020-03-11 Thread Wei Yang
e default is now always MMOP_OFFLINE. > >This is a preparation to use the online_type 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 >S

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

2020-03-11 Thread Wei Yang
orton >Cc: Michal Hocko >Cc: Oscar Salvador >Cc: "Rafael J. Wysocki" >Cc: Baoquan He >Cc: Wei Yang >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- > drivers/base/memory.c | 9 + > include/linux/memory_hotplug.h | 6 +- > 2

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Wei Yang
On Thu, Feb 06, 2020 at 07:30:51AM +0800, Baoquan He wrote: >On 02/06/20 at 07:26am, Wei Yang wrote: >> On Thu, Feb 06, 2020 at 07:08:26AM +0800, Baoquan He wrote: >> >On 02/06/20 at 06:56am, Wei Yang wrote: >> >> On Wed, Feb 05, 2020 at 10:48:11PM +0800, Baoqua

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Wei Yang
On Thu, Feb 06, 2020 at 07:08:26AM +0800, Baoquan He wrote: >On 02/06/20 at 06:56am, Wei Yang wrote: >> On Wed, Feb 05, 2020 at 10:48:11PM +0800, Baoquan He wrote: >> >Hi Wei Yang, >> > >> >On 02/05/20 at 05:59pm, Wei Yang wrote: >> >> >dif

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Wei Yang
On Wed, Feb 05, 2020 at 10:48:11PM +0800, Baoquan He wrote: >Hi Wei Yang, > >On 02/05/20 at 05:59pm, Wei Yang wrote: >> >diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c >> >index f294918f7211..8dafa1ba8d9f 100644 >> >--- a/mm/memory_hotplug.c >>

Re: [PATCH v6 10/10] mm/memory_hotplug: Cleanup __remove_pages()

2020-02-05 Thread Wei Yang
alvador >Cc: Michal Hocko >Cc: Pavel Tatashin >Cc: Dan Williams >Cc: Wei Yang >Signed-off-by: David Hildenbrand Finally understand the code. Reviewed-by: Wei Yang -- Wei Yang Help you, Help me

Re: [PATCH v6 09/10] mm/memory_hotplug: Drop local variables in shrink_zone_span()

2020-02-05 Thread Wei Yang
On Sun, Oct 06, 2019 at 10:56:45AM +0200, David Hildenbrand wrote: >Get rid of the unnecessary local variables. > >Cc: Andrew Morton >Cc: Oscar Salvador >Cc: David Hildenbrand >Cc: Michal Hocko >Cc: Pavel Tatashin >Cc: Dan Williams >Cc: Wei Yang >Signed-off

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Wei Yang
hal Hocko >Cc: David Hildenbrand >Cc: Pavel Tatashin >Cc: Dan Williams >Cc: Wei Yang >Signed-off-by: David Hildenbrand >--- > mm/memory_hotplug.c | 34 +++--- > 1 file changed, 7 insertions(+), 27 deletions(-) > >diff --git a/mm/memory_

Re: [PATCH v6 07/10] mm/memory_hotplug: We always have a zone in find_(smallest|biggest)_section_pfn

2020-02-05 Thread Wei Yang
On Wed, Feb 05, 2020 at 09:59:41AM +0100, David Hildenbrand wrote: >On 05.02.20 09:57, Wei Yang wrote: >> On Sun, Oct 06, 2019 at 10:56:43AM +0200, David Hildenbrand wrote: >>> With shrink_pgdat_span() out of the way, we now always have a valid >>> zone. >>>

Re: [PATCH v6 07/10] mm/memory_hotplug: We always have a zone in find_(smallest|biggest)_section_pfn

2020-02-05 Thread Wei Yang
On Sun, Oct 06, 2019 at 10:56:43AM +0200, David Hildenbrand wrote: >With shrink_pgdat_span() out of the way, we now always have a valid >zone. > >Cc: Andrew Morton >Cc: Oscar Salvador >Cc: David Hildenbrand >Cc: Michal Hocko >Cc: Pavel Tatashin >Cc: Dan Williams &g

Re: [PATCH v3 07/11] mm/memory_hotplug: Create memory block devices after arch_add_memory()

2019-06-05 Thread Wei Yang
;>> + end_block_id = block_id; >>>> + for (block_id = start_block_id; block_id != end_block_id; >>>> + block_id++) { >>>> + mem = find_memory_block_by_id(block_id, NULL); >>>> + mem->section_count = 0; >>>> + unregister_memory(mem); >>>> + } >>>>} >>> >>> Would it be better to do this in reverse order? >>> >>> And unregister_memory() would free mem, so it is still necessary to set >>> section_count to 0? >> >> 1. I kept the existing behavior (setting it to 0) for now. I am planning >> to eventually remove the section count completely (it could be >> beneficial to detect removing of partially populated memory blocks). > >Correction: We already use it to block offlining of partially populated >memory blocks \o/ Would you mind letting me know where we leverage this? > >> >> 2. Reverse order: We would have to start with "block_id - 1", I don't >> like that better. >> >> Thanks for having a look! >> > > >-- > >Thanks, > >David / dhildenb -- Wei Yang Help you, Help me

Re: [PATCH v3 11/11] mm/memory_hotplug: Remove "zone" parameter from sparse_remove_one_section

2019-06-05 Thread Wei Yang
gt;Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- > include/linux/memory_hotplug.h | 2 +- > mm/memory_hotplug.c| 2 +- > mm/sparse.c| 4 ++-- > 3 files changed, 4 insertions(+), 4 deletions(-) > >diff --git a/include/linux/memory_hotpl

Re: [PATCH v3 10/11] mm/memory_hotplug: Make unregister_memory_block_under_nodes() never fail

2019-06-05 Thread Wei Yang
n >Cc: Chris Wilson >Cc: David Hildenbrand >Cc: Oscar Salvador >Cc: Andrew Morton >Cc: Jonathan Cameron >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang >--- > drivers/base/node.c | 18 +- > include/linux/node.h | 5 ++--- > 2 files chan

Re: [PATCH v3 09/11] mm/memory_hotplug: Remove memory block devices before arch_remove_memory()

2019-06-04 Thread Wei Yang
)) > return; > >- unregister_memory_section(ms); >- > scn_nr = __section_nr(ms); > start_pfn = section_nr_to_pfn((unsigned long)scn_nr); > __remove_zone(zone, start_pfn); >@@ -1845,6 +1843,9 @@ void __ref __remove_memory(int nid, u64 start, u64 size) > memblock_free(start, size); > memblock_remove(start, size); > >+ /* remove memory block devices before removing memory */ >+ remove_memory_block_devices(start, size); >+ > arch_remove_memory(nid, start, size, NULL); > __release_memory_resource(start, size); > >-- >2.20.1 -- Wei Yang Help you, Help me

Re: [PATCH v3 08/11] mm/memory_hotplug: Drop MHP_MEMBLOCK_API

2019-06-04 Thread Wei Yang
On Mon, May 27, 2019 at 01:11:49PM +0200, David Hildenbrand wrote: >No longer needed, the callers of arch_add_memory() can handle this >manually. > >Cc: Andrew Morton >Cc: David Hildenbrand >Cc: Michal Hocko >Cc: Oscar Salvador >Cc: Pavel Tatashin >Cc: Wei Yang

Re: [PATCH v3 07/11] mm/memory_hotplug: Create memory block devices after arch_add_memory()

2019-06-04 Thread Wei Yang
looks good to me besides two tiny comments. > >Cc: Greg Kroah-Hartman >Cc: "Rafael J. Wysocki" >Cc: David Hildenbrand >Cc: "mike.tra...@hpe.com" >Cc: Andrew Morton >Cc: Ingo Molnar >Cc: Andrew Banman >Cc: Oscar Salvador >Cc: Michal Hocko &g

Re: [PATCH v3 06/11] mm/memory_hotplug: Allow arch_remove_pages() without CONFIG_MEMORY_HOTREMOVE

2019-06-04 Thread Wei Yang
On Tue, Jun 04, 2019 at 08:59:43AM +0200, David Hildenbrand wrote: >On 04.06.19 00:15, Wei Yang wrote: >> Allow arch_remove_pages() or arch_remove_memory()? > >Looks like I merged __remove_pages() and arch_remove_memory(). > >@Andrew, can you fix this up to > &g

Re: [PATCH v3 06/11] mm/memory_hotplug: Allow arch_remove_pages() without CONFIG_MEMORY_HOTREMOVE

2019-06-03 Thread Wei Yang
t >Cc: David Hildenbrand >Cc: Oscar Salvador >Cc: "Kirill A. Shutemov" >Cc: Alex Deucher >Cc: "David S. Miller" >Cc: Mark Brown >Cc: Chris Wilson >Cc: Christophe Leroy >Cc: Nicholas Piggin >Cc: Vasily Gorbik >Cc: Rob Herring >Cc

Re: [PATCH v3 05/11] drivers/base/memory: Pass a block_id to init_memory_block()

2019-06-03 Thread Wei Yang
ret = 0; > struct memory_block *mem; > >@@ -717,7 +716,7 @@ int hotplug_memory_register(int nid, struct mem_section >*section) > mem->section_count++; > put_device(&mem->dev); > } else { >- ret = init_memory_block(&mem, section, MEM_OFFLINE); >+ ret = init_memory_block(&mem, block_id, MEM_OFFLINE); > if (ret) > goto out; > mem->section_count++; >-- >2.20.1 -- Wei Yang Help you, Help me

Re: [PATCH v3 00/11] mm/memory_hotplug: Factor out memory block devicehandling

2019-06-03 Thread Wei Yang
| 2 - > arch/x86/mm/init_32.c | 2 - > arch/x86/mm/init_64.c | 2 - > drivers/base/memory.c | 134 +++-- > drivers/base/node.c| 27 +++ > include/linux/memory.h | 6 +- > include/linux/memory_hotplug.h | 12 +-- > include/linux/node.h | 7 +- > mm/memory_hotplug.c| 44 +-- > mm/sparse.c| 10 +-- > 14 files changed, 140 insertions(+), 145 deletions(-) > >-- >2.20.1 -- Wei Yang Help you, Help me

Re: [PATCH v3 04/11] arm64/mm: Add temporary arch_remove_memory() implementation

2019-06-03 Thread Wei Yang
. >+ */ >+ zone = page_zone(pfn_to_page(start_pfn)); Compared with arch_remove_memory in x86. If altmap is not NULL, zone will be retrieved from page related to altmap. Not sure why this is not the same? >+ __remove_pages(zone, start_pfn, nr_pages, altmap); >+} >+#endif > #endif >-- >2.20.1 -- Wei Yang Help you, Help me

Re: [PATCH v2 4/8] mm/memory_hotplug: Create memory block devices after arch_add_memory()

2019-05-09 Thread Wei Yang
On Thu, May 09, 2019 at 04:58:56PM +0200, David Hildenbrand wrote: >On 09.05.19 16:31, Wei Yang wrote: >> On Tue, May 07, 2019 at 08:38:00PM +0200, David Hildenbrand wrote: >>> Only memory to be added to the buddy and to be onlined/offlined by >>> user space using memo

Re: [PATCH v2 4/8] mm/memory_hotplug: Create memory block devices after arch_add_memory()

2019-05-09 Thread Wei Yang
efore arch_add_memory() succeeded. > >Cc: Greg Kroah-Hartman >Cc: "Rafael J. Wysocki" >Cc: David Hildenbrand >Cc: "mike.tra...@hpe.com" >Cc: Andrew Morton >Cc: Ingo Molnar >Cc: Andrew Banman >Cc: Oscar Salvador >Cc: Michal Hocko >Cc: Pavel

Re: [PATCH v2 4/8] mm/memory_hotplug: Create memory block devices after arch_add_memory()

2019-05-09 Thread Wei Yang
efore arch_add_memory() succeeded. > >Cc: Greg Kroah-Hartman >Cc: "Rafael J. Wysocki" >Cc: David Hildenbrand >Cc: "mike.tra...@hpe.com" >Cc: Andrew Morton >Cc: Ingo Molnar >Cc: Andrew Banman >Cc: Oscar Salvador >Cc: Michal Hocko >Cc: Pavel

Re: [PATCH v2 4/8] mm/memory_hotplug: Create memory block devices after arch_add_memory()

2019-05-09 Thread Wei Yang
efore arch_add_memory() succeeded. > >Cc: Greg Kroah-Hartman >Cc: "Rafael J. Wysocki" >Cc: David Hildenbrand >Cc: "mike.tra...@hpe.com" >Cc: Andrew Morton >Cc: Ingo Molnar >Cc: Andrew Banman >Cc: Oscar Salvador >Cc: Michal Hocko >Cc: Pavel

Re: [PATCH v2 1/8] mm/memory_hotplug: Simplify and fix check_hotplug_memory_range()

2019-05-09 Thread Wei Yang
hal Hocko >Cc: David Hildenbrand >Cc: Pavel Tatashin >Cc: Qian Cai >Cc: Wei Yang >Cc: Arun KS >Cc: Mathieu Malaterre >Signed-off-by: David Hildenbrand Reviewed-by: Wei Yang -- Wei Yang Help you, Help me

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

2018-12-03 Thread Wei Yang
e to keep it in here. > Yes, this make sense to me now. >(and I think at least for now it makes sense to not squash patch 1 and >2, to easier discuss the new user interface/concept introduced in this >patch). > >Thanks! > >-- > >Thanks, > >David / dhildenb -- Wei Yang Help you, Help me

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

2018-12-01 Thread Wei Yang
block types. Turns out abstracting too much was > rather confusing and not helpful. Properly document them. > >Notes: >- I wanted to convert the enum of types into a named enum but this > provoked all kinds of different errors. For now, I am doing it just like > the other types (e.g. online_type) we are using in that context. >- The "removable" property should never have been named like that. It > should have been "offlinable". Can we still rename that? E.g. boot memory > is sometimes marked as removable ... > This make sense to me. Remove usually describe physical hotplug phase, if I am correct. -- Wei Yang Help you, Help me

Re: [PATCH RFCv2 2/4] mm/memory_hotplug: Replace "bool want_memblock" by "int type"

2018-11-30 Thread Wei Yang
t;Cc: Michal Hocko >Cc: Dan Williams >Cc: "Kirill A. Shutemov" >Cc: Oscar Salvador >Cc: Nicholas Piggin >Cc: Stephen Rothwell >Cc: Christophe Leroy >Cc: "Jonathan Neusch??fer" >Cc: Mauricio Faria de Oliveira >Cc: Vasily Gorbik >Cc: Arun KS

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

2018-11-30 Thread Wei Yang
: >+ * The type of memory block was not further specified when adding the >+ * memory block. >+ * >+ * MEMORY_BLOCK_BOOT: >+ * This memory block was added during boot by the basic system. No >+ * specific device driver takes care of this memory block. This memory >+ * block type is onlined automatically by the kernel during boot and might >+ * later be managed by a different device driver, in which case the type >+ * might change. >+ */ >+enum { >+ MEMORY_BLOCK_NONE = 0, >+ MEMORY_BLOCK_UNSPECIFIED, >+ MEMORY_BLOCK_BOOT, >+}; >+ > /* These states are exposed to userspace as text strings in sysfs */ > #define MEM_ONLINE (1<<0) /* exposed to userspace */ > #define MEM_GOING_OFFLINE (1<<1) /* exposed to userspace */ >-- >2.17.2 -- Wei Yang Help you, Help me

Re: [PATCH] Extract initrd free logic from arch-specific code.

2018-03-28 Thread Wei Yang
AVE_ARCH_SECCOMP_FILTER for an example.) > One question about this change. The original code would "select" HAVE_ARCH_FREE_INITRD_MEM on those arch. After this change, we need to manually "select" this? >-Kees > >-- >Kees Cook >Pixel Security -- Wei Yang Help you, Help me

Re: [PATCH] powerpc/iommu: use iommu_num_pages() to calculate the number of iommu page

2015-11-11 Thread Wei Yang
Someone willing to take a look? On Fri, Oct 02, 2015 at 06:51:59AM +0800, Wei Yang wrote: >On Thu, Oct 01, 2015 at 02:15:45PM +1000, Michael Ellerman wrote: >>On Thu, 2015-10-01 at 07:50 +0800, Wei Yang wrote: >>> Hmm... some comments on this one? like it or not? >> >&g

Re: [PATCH V13 0/9] VF EEH on Power8

2015-11-08 Thread Wei Yang
On Mon, Nov 09, 2015 at 10:53:17AM +1100, Alexey Kardashevskiy wrote: >On 11/08/2015 10:30 AM, Wei Yang wrote: >>This patchset enables EEH on SRIOV VFs. The general idea is to create proper >>VF edev and VF PE and handle them properly. >> >>Different from the Bus PE

[PATCH V13 9/9] powerpc/eeh: Support error recovery for VF PE

2015-11-07 Thread Wei Yang
n helps to locate the VF's PCI device instance when doing hotplug during EEH recovery if necessary. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/eeh.h| 2 + arch/powerpc/include/asm/pci-bridge.h | 1 + arch/powerpc/kernel/eeh.c | 8 +++ arch/powerpc/k

[PATCH V13 8/9] powerpc/powernv: Support PCI config restore for VFs

2015-11-07 Thread Wei Yang
e on VF by restore MPS, disable completion timeout, enable SERR, etc. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/pci-bridge.h| 1 + arch/powerpc/platforms/powernv/eeh-powernv.c | 70 +++- arch/powerpc/platforms/powernv/pci.c | 18 +++ 3 fil

[PATCH V13 7/9] powerpc/powernv: Support EEH reset for VF PE

2015-11-07 Thread Wei Yang
PEs for VFs don't have primary bus. So they have to have their own reset backend, which is used during EEH recovery. The patch implements the reset backend for VF's PE by issuing FLR or AF FLR to the VFs, which are contained in the PE. Signed-off-by: Wei Yang --- arch/powerpc/include

[PATCH V13 6/9] powerpc/eeh: Create PE for VFs

2015-11-07 Thread Wei Yang
The patch creates PEs for VFs in the weak function pcibios_bus_add_device(). Those PEs for VFs are identified with newly introduced flag EEH_PE_VF so that we handle them differently during EEH recovery. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/eeh.h | 1 + arch

[PATCH V13 0/9] VF EEH on Power8

2015-11-07 Thread Wei Yang
add_device() both after pci_dev is well initialized * do FLR to reset a VF PE * imitate the restore function in FW for VF * remove the reverse order patch, since it is still under discussion Wei Yang (9): PCI/IOV: Rename and export virtfn_add/virtfn_remove PCI: Add pcibios_bus_add_de

[PATCH V13 5/9] powerpc/powernv: EEH device for VF

2015-11-07 Thread Wei Yang
same life cycle. Also, VF's EEH device is identified by (struct eeh_dev::physfn). Signed-off-by: Wei Yang --- arch/powerpc/include/asm/eeh.h | 1 + arch/powerpc/kernel/pci_dn.c | 13 + 2 files changed, 14 insertions(+) diff --git a/arch/powerpc/include/asm/eeh.h b/arch/power

[PATCH V13 4/9] powerpc/eeh: Cache only BARs, not windows or IOV BARs

2015-11-07 Thread Wei Yang
check for a PCI bridge as we limit __eeh_addr_cache_insert_dev() to 7 BARs and this effectively excludes PCI bridges from being cached. Signed-off-by: Wei Yang --- arch/powerpc/kernel/eeh_cache.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/k

[PATCH V13 3/9] powerpc/pci: Remove VFs prior to PF

2015-11-07 Thread Wei Yang
to PowerPC PCI hotplug path. Signed-off-by: Wei Yang --- arch/powerpc/kernel/pci-hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c index 7f9ed0c..59c4361 100644 --- a/arch/powerpc/kernel/pci-hotplug.c

[PATCH V13 1/9] PCI/IOV: Rename and export virtfn_add/virtfn_remove

2015-11-07 Thread Wei Yang
hotplug during EEH recovery. Signed-off-by: Wei Yang Acked-by: Bjorn Helgaas --- drivers/pci/iov.c | 10 +- include/linux/pci.h | 8 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index ee0ebff..cc941dd 100644 --- a/dr

[PATCH V13 2/9] PCI: Add pcibios_bus_add_device() weak function

2015-11-07 Thread Wei Yang
Add a weak function pcibios_bus_add_device() for arch dependent code could do proper setup. For example, powerpc could setup EEH related resources. Signed-off-by: Wei Yang Acked-by: Bjorn Helgaas --- drivers/pci/bus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/bus.c b

Re: [PATCH V12 0/9] VF EEH on Power8

2015-11-03 Thread Wei Yang
On Wed, Nov 04, 2015 at 04:05:37PM +1100, Alexey Kardashevskiy wrote: >On 11/04/2015 02:28 PM, Wei Yang wrote: >>This patchset enables EEH on SRIOV VFs. The general idea is to create proper >>VF edev and VF PE and handle them properly. >> >>Different from the Bus PE

Re: [PATCH V12 9/9] powerpc/eeh: Support error recovery for VF PE

2015-11-03 Thread Wei Yang
On Wed, Nov 04, 2015 at 04:01:50PM +1100, Alexey Kardashevskiy wrote: >On 11/04/2015 02:28 PM, Wei Yang wrote: >>PFs are enumerated on PCI bus, while VFs are created by PF's driver. >> >>In EEH recovery, it has two cases: >>1. Device and driver is EEH aware, error

[PATCH V12 4/9] powerpc/eeh: Cache only BARs, not windows or IOV BARs

2015-11-03 Thread Wei Yang
check for a PCI bridge as we limit __eeh_addr_cache_insert_dev() to 7 BARs and this effectively excludes PCI bridges from being cached. Signed-off-by: Wei Yang --- arch/powerpc/kernel/eeh_cache.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/k

[PATCH V12 9/9] powerpc/eeh: Support error recovery for VF PE

2015-11-03 Thread Wei Yang
n helps to locate the VF's PCI device instance when doing hotplug during EEH recovery if necessary. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/eeh.h| 7 ++ arch/powerpc/include/asm/pci-bridge.h | 1 + arch/powerpc/kernel/eeh.c | 8 +++ arch/powerpc/k

[PATCH V12 8/9] powerpc/powernv: Support PCI config restore for VFs

2015-11-03 Thread Wei Yang
e on VF by restore MPS, disable completion timeout, enable SERR, etc. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/pci-bridge.h| 1 + arch/powerpc/platforms/powernv/eeh-powernv.c | 70 +++- arch/powerpc/platforms/powernv/pci.c | 18 +++ 3 fil

[PATCH V12 6/9] powerpc/eeh: Create PE for VFs

2015-11-03 Thread Wei Yang
The patch creates PEs for VFs in the weak function pcibios_bus_add_device(). Those PEs for VFs are identified with newly introduced flag EEH_PE_VF so that we handle them differently during EEH recovery. Signed-off-by: Wei Yang --- arch/powerpc/include/asm/eeh.h | 1 + arch

[PATCH V12 7/9] powerpc/powernv: Support EEH reset for VF PE

2015-11-03 Thread Wei Yang
PEs for VFs don't have primary bus. So they have to have their own reset backend, which is used during EEH recovery. The patch implements the reset backend for VF's PE by issuing FLR or AF FLR to the VFs, which are contained in the PE. Signed-off-by: Wei Yang --- arch/powerpc/include

[PATCH V12 5/9] powerpc/powernv: EEH device for VF

2015-11-03 Thread Wei Yang
same life cycle. Also, VF's EEH device is identified by (struct eeh_dev::physfn). Signed-off-by: Wei Yang --- arch/powerpc/include/asm/eeh.h | 1 + arch/powerpc/kernel/pci_dn.c | 13 + 2 files changed, 14 insertions(+) diff --git a/arch/powerpc/include/asm/eeh.h b/arch/power

[PATCH V12 2/9] PCI: Add pcibios_bus_add_device() weak function

2015-11-03 Thread Wei Yang
Add a weak function pcibios_bus_add_device() for arch dependent code could do proper setup. For example, powerpc could setup EEH related resources. Signed-off-by: Wei Yang Acked-by: Bjorn Helgaas --- drivers/pci/bus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/bus.c b

[PATCH V12 3/9] powerpc/pci: Remove VFs prior to PF

2015-11-03 Thread Wei Yang
to PowerPC PCI hotplug path. Signed-off-by: Wei Yang --- arch/powerpc/kernel/pci-hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c index 7f9ed0c..59c4361 100644 --- a/arch/powerpc/kernel/pci-hotplug.c

[PATCH V12 1/9] PCI/IOV: Rename and export virtfn_add/virtfn_remove

2015-11-03 Thread Wei Yang
hotplug during EEH recovery. Signed-off-by: Wei Yang Acked-by: Bjorn Helgaas --- drivers/pci/iov.c | 10 +- include/linux/pci.h | 8 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index ee0ebff..cc941dd 100644 --- a/dr

[PATCH V12 0/9] VF EEH on Power8

2015-11-03 Thread Wei Yang
_dev is well initialized * do FLR to reset a VF PE * imitate the restore function in FW for VF * remove the reverse order patch, since it is still under discussion Wei Yang (9): PCI/IOV: Rename and export virtfn_add/virtfn_remove PCI: Add pcibios_bus_add_device() weak function

Re: [PATCH V10 08/12] powerpc/powernv: Support EEH reset for VF PE

2015-11-02 Thread Wei Yang
On Fri, Oct 30, 2015 at 07:05:05PM +1100, Alexey Kardashevskiy wrote: >On 10/30/2015 06:18 PM, Wei Yang wrote: >>On Fri, Oct 30, 2015 at 03:11:20PM +1100, Alexey Kardashevskiy wrote: >>>On 10/26/2015 02:15 PM, Wei Yang wrote: >>>>PEs for VFs don't have primary

Re: [PATCH V10 10/12] powerpc/eeh: Support error recovery for VF PE

2015-11-02 Thread Wei Yang
On Mon, Nov 02, 2015 at 10:40:36AM +1100, Alexey Kardashevskiy wrote: >On 11/01/2015 12:53 PM, Wei Yang wrote: >>On Fri, Oct 30, 2015 at 04:20:48PM +1100, Alexey Kardashevskiy wrote: >>>On 10/26/2015 02:16 PM, Wei Yang wrote: >>>>Different from PCI bus dependent P

Re: [PATCH V10 10/12] powerpc/eeh: Support error recovery for VF PE

2015-10-31 Thread Wei Yang
On Fri, Oct 30, 2015 at 04:20:48PM +1100, Alexey Kardashevskiy wrote: >On 10/26/2015 02:16 PM, Wei Yang wrote: >>Different from PCI bus dependent PE, PE for VFs doesn't have the > >s/Different from/Unlike/ > Will change in next version. > >>primary bus, on whic

Re: [PATCH V10 09/12] powerpc/powernv: Support PCI config restore for VFs

2015-10-30 Thread Wei Yang
On Fri, Oct 30, 2015 at 03:56:12PM +1100, Alexey Kardashevskiy wrote: >On 10/26/2015 02:15 PM, Wei Yang wrote: >>After PE reset, OPAL API opal_pci_reinit() is called on all devices >>contained in the PE to reinitialize them. However, VFs can't be seen >>from skiboot firm

Re: [PATCH V10 06/12] powerpc/powernv: EEH device for VF

2015-10-30 Thread Wei Yang
On Fri, Oct 30, 2015 at 06:36:01PM +1100, Alexey Kardashevskiy wrote: >On 10/30/2015 05:52 PM, Wei Yang wrote: >>On Fri, Oct 30, 2015 at 02:33:49PM +1100, Alexey Kardashevskiy wrote: >>>On 10/26/2015 02:15 PM, Wei Yang wrote: >>>>VFs and their corresponding pc

Re: [PATCH V10 12/12] powerpc/eeh: Handle hot removed VF when PF is EEH aware

2015-10-30 Thread Wei Yang
On Fri, Oct 30, 2015 at 04:35:54PM +1100, Alexey Kardashevskiy wrote: >On 10/26/2015 02:16 PM, Wei Yang wrote: >>When PF is EEH aware while VFs are not, VFs will be removed during EEH >>recovery. This is not supported in current code, while will leads to the VF >>lost. >&

Re: [PATCH V10 11/12] powerpc/eeh: Don't block PCI config on resetting VF PE

2015-10-30 Thread Wei Yang
On Fri, Oct 30, 2015 at 04:42:07PM +1100, Alexey Kardashevskiy wrote: >On 10/26/2015 02:16 PM, Wei Yang wrote: >>From: Gavin Shan >> >>When passing through SRIOV VF from host to guest via VFIO PCI >>infrastructure, the VF is resetted by EEH specific backend >>(pc

Re: [PATCH V10 08/12] powerpc/powernv: Support EEH reset for VF PE

2015-10-30 Thread Wei Yang
On Fri, Oct 30, 2015 at 03:11:20PM +1100, Alexey Kardashevskiy wrote: >On 10/26/2015 02:15 PM, Wei Yang wrote: >>PEs for VFs don't have primary bus. So they have to have their own reset >>backend, which is used during EEH recovery. The patch implements the reset >>back

Re: [PATCH V10 07/12] powerpc/eeh: Create PE for VFs

2015-10-30 Thread Wei Yang
On Fri, Oct 30, 2015 at 02:46:35PM +1100, Alexey Kardashevskiy wrote: >On 10/26/2015 02:15 PM, Wei Yang wrote: >>Current EEH recovery code works with the assumption: the PE has primary >>bus. Unfortunately, that's not true for VF PEs, which generally contains >>one or

Re: [PATCH V10 06/12] powerpc/powernv: EEH device for VF

2015-10-29 Thread Wei Yang
On Fri, Oct 30, 2015 at 02:33:49PM +1100, Alexey Kardashevskiy wrote: >On 10/26/2015 02:15 PM, Wei Yang wrote: >>VFs and their corresponding pci_dn instances are created and released >>dynamically as their PF's SRIOV capability is enabled and disabled. >>The patch create

Re: [PATCH V10 05/12] powerpc/eeh: Cache only BARs, not windows or IOV BARs

2015-10-29 Thread Wei Yang
On Fri, Oct 30, 2015 at 02:22:43PM +1100, Alexey Kardashevskiy wrote: >On 10/26/2015 02:15 PM, Wei Yang wrote: >>EEH address cache, which helps to locate the PCI device according to >>the given (physical) MMIO address, didn't cover PCI bridges. Also, it >>shouldn&#x

Re: [PATCH V10 04/12] powerpc/pci: Remove VFs prior to PF

2015-10-29 Thread Wei Yang
On Fri, Oct 30, 2015 at 02:04:12PM +1100, Alexey Kardashevskiy wrote: >On 10/26/2015 02:15 PM, Wei Yang wrote: >>As commit ac205b7bb72f ("PCI: make sriov work with hotplug remove") indicates, >>VFs, which might be hooked to same PCI bus as their PF should be removed >

Re: [PATCH V10 03/12] powerpc/pci: Cache VF index in pci_dn

2015-10-29 Thread Wei Yang
On Fri, Oct 30, 2015 at 01:05:43PM +1100, Alexey Kardashevskiy wrote: >On 10/26/2015 02:15 PM, Wei Yang wrote: >>The patch caches the VF index in pci_dn, which can be used to calculate >>VF's bus, device and function number. Those information helps to locate >>the VF&

Re: [PATCH V10 05/12] powerpc/eeh: Cache only BARs, not windows or IOV BARs

2015-10-29 Thread Wei Yang
On Thu, Oct 29, 2015 at 02:29:19PM +1100, Daniel Axtens wrote: >Wei Yang writes: > >> EEH address cache, which helps to locate the PCI device according to >> the given (physical) MMIO address, didn't cover PCI bridges. Also, it >> shouldn't return PF with addr

Re: [PATCH V10 00/12] VF EEH on Power8

2015-10-27 Thread Wei Yang
On Tue, Oct 27, 2015 at 06:11:13PM -0500, Bjorn Helgaas wrote: >On Mon, Oct 26, 2015 at 11:15:50AM +0800, Wei Yang wrote: >> This patchset enables EEH on SRIOV VFs. The general idea is to create proper >> VF edev and VF PE and handle them properly. >> ... > >> Ga

Re: [PATCH V10 03/12] powerpc/pci: Cache VF index in pci_dn

2015-10-27 Thread Wei Yang
On Wed, Oct 28, 2015 at 09:04:34AM +1100, Daniel Axtens wrote: >Hi, > >> >> diff --git a/arch/powerpc/include/asm/pci-bridge.h >> b/arch/powerpc/include/asm/pci-bridge.h >> index b3a226b..3d7e537 100644 >> --- a/arch/powerpc/include/asm/pci-bridge.h >> +++ b/arch/powerpc/include/asm/pci-bridge.h >

Re: [PATCH V10 01/12] PCI/IOV: Rename and export virtfn_add/virtfn_remove

2015-10-27 Thread Wei Yang
On Tue, Oct 27, 2015 at 06:06:54PM -0500, Bjorn Helgaas wrote: >On Mon, Oct 26, 2015 at 11:15:51AM +0800, Wei Yang wrote: >> During EEH recovery, hotplug is applied to the devices which don't >> have drivers or their drivers don't support EEH. However, the hotplug, >&

[PATCH V10 12/12] powerpc/eeh: Handle hot removed VF when PF is EEH aware

2015-10-25 Thread Wei Yang
When PF is EEH aware while VFs are not, VFs will be removed during EEH recovery. This is not supported in current code, while will leads to the VF lost. This patch fixes this by adding VFs back. VFs should be added back after PF get recovered properly. Signed-off-by: Wei Yang Signed-off-by

[PATCH V10 11/12] powerpc/eeh: Don't block PCI config on resetting VF PE

2015-10-25 Thread Wei Yang
From: Gavin Shan When passing through SRIOV VF from host to guest via VFIO PCI infrastructure, the VF is resetted by EEH specific backend (pcibios_set_pcie_reset_state()). We can't block the PCI config, otherwise, the reset (FLR or AF FLR), to be completed by PCI config access to the VF, can't be

[PATCH V10 10/12] powerpc/eeh: Support error recovery for VF PE

2015-10-25 Thread Wei Yang
: changelog and code refactoring] Signed-off-by: Wei Yang Acked-by: Gavin Shan --- arch/powerpc/include/asm/eeh.h | 1 + arch/powerpc/kernel/eeh.c| 8 arch/powerpc/kernel/eeh_driver.c | 100 +++ arch/powerpc/kernel/eeh_pe.c | 3 +- 4 fi

[PATCH V10 09/12] powerpc/powernv: Support PCI config restore for VFs

2015-10-25 Thread Wei Yang
gelog and code refactoring] Signed-off-by: Wei Yang Acked-by: Gavin Shan --- arch/powerpc/include/asm/pci-bridge.h| 1 + arch/powerpc/platforms/powernv/eeh-powernv.c | 70 +++- arch/powerpc/platforms/powernv/pci.c | 18 +++ 3 files changed, 88 inser

[PATCH V10 08/12] powerpc/powernv: Support EEH reset for VF PE

2015-10-25 Thread Wei Yang
PEs for VFs don't have primary bus. So they have to have their own reset backend, which is used during EEH recovery. The patch implements the reset backend for VF's PE by issuing FLR or AF FLR to the VFs, which are contained in the PE. [gwshan: changelog and code refactoring] Signed-o

[PATCH V10 07/12] powerpc/eeh: Create PE for VFs

2015-10-25 Thread Wei Yang
ified with newly introduced flag EEH_PE_VF so that we handle them differently during EEH recovery. [gwshan: changelog and code refactoring] Signed-off-by: Wei Yang Acked-by: Gavin Shan --- arch/powerpc/include/asm/eeh.h | 1 + arch/powerpc/kernel/eeh_pe.c

[PATCH V10 06/12] powerpc/powernv: EEH device for VF

2015-10-25 Thread Wei Yang
same life cycle. Also, VF's EEH device is identified by (struct eeh_dev::physfn). [gwshan: changelog and removed CONFIG_PCI_IOV] Signed-off-by: Wei Yang Acked-by: Gavin Shan --- arch/powerpc/include/asm/eeh.h | 1 + arch/powerpc/kernel/pci_dn.c | 12 2 files changed, 13

[PATCH V10 04/12] powerpc/pci: Remove VFs prior to PF

2015-10-25 Thread Wei Yang
owerPC PCI hotplug path. [gwshan: changelog] Signed-off-by: Wei Yang Acked-by: Gavin Shan --- arch/powerpc/kernel/pci-hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c index 7f9ed0c..59c4361 100644

[PATCH V10 05/12] powerpc/eeh: Cache only BARs, not windows or IOV BARs

2015-10-25 Thread Wei Yang
e type check in eeh_addr_cache_insert_dev(), since bridge's window would not be cached. The patch restricts the address cache to cover first 7 BARs for the above purposes. [gwshan: changelog] Signed-off-by: Wei Yang Acked-by: Gavin Shan --- arch/powerpc/kernel/eeh_cache.c | 6 +- 1 file changed, 1 inser

[PATCH V10 03/12] powerpc/pci: Cache VF index in pci_dn

2015-10-25 Thread Wei Yang
The patch caches the VF index in pci_dn, which can be used to calculate VF's bus, device and function number. Those information helps to locate the VF's PCI device instance when doing hotplug during EEH recovery if necessary. Signed-off-by: Wei Yang Acked-by: Gavin Shan --- ar

[PATCH V10 02/12] PCI: Add pcibios_bus_add_device() weak function

2015-10-25 Thread Wei Yang
This patch adds a weak function pcibios_bus_add_device() for arch dependent code could do proper setup. For example, powerpc could setup EEH related resources. Signed-off-by: Wei Yang Acked-by: Bjorn Helgaas --- drivers/pci/bus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers

[PATCH V10 01/12] PCI/IOV: Rename and export virtfn_add/virtfn_remove

2015-10-25 Thread Wei Yang
can be used in PCI hotplug during EEH recovery. [gwshan: changelog] Signed-off-by: Wei Yang Reviewed-by: Gavin Shan Acked-by: Bjorn Helgaas --- drivers/pci/iov.c | 10 +- include/linux/pci.h | 8 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/pci/iov.

[PATCH V10 00/12] VF EEH on Power8

2015-10-25 Thread Wei Yang
PE * imitate the restore function in FW for VF * remove the reverse order patch, since it is still under discussion Gavin Shan (1): powerpc/eeh: Don't block PCI config on resetting VF PE Wei Yang (11): PCI/IOV: Rename and export virtfn_add/virtfn_remove PCI: Add pcibios_bus

[PATCH V7 5/6] powerpc/powernv: boundary the total VF BAR size instead of the individual one

2015-10-21 Thread Wei Yang
Each VF could have 6 BARs at most. When the total BAR size exceeds the gate, after expanding it will also exhaust the M64 Window. This patch limits the boundary by checking the total VF BAR size instead of the individual BAR. Signed-off-by: Wei Yang Reviewed-by: Gavin Shan Acked-by: Alexey

[PATCH V7 4/6] powerpc/powernv: replace the hard coded boundary with gate

2015-10-21 Thread Wei Yang
it. Signed-off-by: Wei Yang Reviewed-by: Gavin Shan Acked-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 28 +++- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platf

[PATCH V7 6/6] powerpc/powernv: allocate sparse PE# when using M64 BAR in Single PE mode

2015-10-21 Thread Wei Yang
When M64 BAR is set to Single PE mode, the PE# assigned to VF could be sparse. This patch restructures the code to allocate sparse PE# for VFs when M64 BAR is set to Single PE mode. Also it rename the offset to pe_num_map to reflect the content is the PE number. Signed-off-by: Wei Yang Reviewed

[PATCH V7 0/6] Redesign SR-IOV on PowerNV

2015-10-21 Thread Wei Yang
n M64 Single PE is used * when M64 Single PE is used, compare num_vfs with M64 BAR available number in system at first Wei Yang (6): powerpc/powernv: don't enable SRIOV when VF BAR has non 64bit-prefetchable BAR powerpc/powernv: simplify the calculation of iov resource alig

[PATCH V7 3/6] powerpc/powernv: use one M64 BAR in Single PE mode for one VF BAR

2015-10-21 Thread Wei Yang
olute isolation for VFs. Signed-off-by: Wei Yang Reviewed-by: Gavin Shan Acked-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/pci-bridge.h | 5 +- arch/powerpc/platforms/powernv/pci-ioda.c | 177 -- 2 files changed, 75 insertions(+), 107 deletions(-) diff

  1   2   3   4   5   6   7   >