* [PATCH kernel 0/2] powerpc/powernv/npu: Fixes for next tree @ 2016-05-12 5:47 Alexey Kardashevskiy 2016-05-12 5:47 ` [PATCH kernel 1/2] powerpc/powernv: Fix insufficient memory allocation Alexey Kardashevskiy 2016-05-12 5:47 ` [PATCH kernel 2/2] powerpc/powernv/npu: Add PE to PHB's list Alexey Kardashevskiy 0 siblings, 2 replies; 9+ messages in thread From: Alexey Kardashevskiy @ 2016-05-12 5:47 UTC (permalink / raw) To: linuxppc-dev Cc: Alexey Kardashevskiy, Alistair Popple, Gavin Shan, Michael Ellerman, Paul Mackerras git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git "next" branch sha1 e682e4c needs 3 fixes to get NVLink passthrough working (in fact 4 but the last one is goind via VFIO tree), two of them are in this patchset; also: 35a3a27 "powerpc/powernv: Exclude root bus in pnv_pci_reset_secondary_bus()" needs to be reverted (otherwise it produces EEH during GPU FLR reset, i.e. each time when the guest starts and stops). Please comment. Thanks. Alexey Kardashevskiy (2): powerpc/powernv: Fix insufficient memory allocation powerpc/powernv/npu: Add PE to PHB's list arch/powerpc/platforms/powernv/pci-ioda.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.5.0.rc3 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH kernel 1/2] powerpc/powernv: Fix insufficient memory allocation 2016-05-12 5:47 [PATCH kernel 0/2] powerpc/powernv/npu: Fixes for next tree Alexey Kardashevskiy @ 2016-05-12 5:47 ` Alexey Kardashevskiy 2016-05-12 6:09 ` Gavin Shan 2016-05-12 11:32 ` [kernel,1/2] " Michael Ellerman 2016-05-12 5:47 ` [PATCH kernel 2/2] powerpc/powernv/npu: Add PE to PHB's list Alexey Kardashevskiy 1 sibling, 2 replies; 9+ messages in thread From: Alexey Kardashevskiy @ 2016-05-12 5:47 UTC (permalink / raw) To: linuxppc-dev Cc: Alexey Kardashevskiy, Alistair Popple, Gavin Shan, Michael Ellerman, Paul Mackerras The pnv_pci_init_ioda_phb() helper allocates a blob to store auxilary data such PE and M32/M64 segment allocation maps; this single blob has few partitions, size of each is derived from the PE number - phb->ioda.total_pe_num. It was assumed that the minimum PE number is 8, however it is 4 for NPU so the pe_alloc part was missing in the allocated blob. It was invisible till recently as we were not tracking used M64 segments and NPUs do not use M32 segments so the phb->ioda.m32_segmap (which was pointing to the same address as phb->ioda.pe_alloc) has never been written to leaving the pe_alloc memory intact. After 401203ac2d "powerpc/powernv: Track M64 segment consumption" the pe_alloc gets corrupted and PE allocation cannot work. This fixes the issue by enforcing the minimum PE number to 8. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- arch/powerpc/platforms/powernv/pci-ioda.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 6cda2a8..d0d32c2 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -3507,7 +3507,8 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, PNV_IODA1_DMA32_SEGSIZE; /* Allocate aux data & arrays. We don't have IO ports on PHB3 */ - size = _ALIGN_UP(phb->ioda.total_pe_num / 8, sizeof(unsigned long)); + size = _ALIGN_UP(max_t(unsigned, phb->ioda.total_pe_num, 8) / 8, + sizeof(unsigned long)); m64map_off = size; size += phb->ioda.total_pe_num * sizeof(phb->ioda.m64_segmap[0]); m32map_off = size; -- 2.5.0.rc3 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH kernel 1/2] powerpc/powernv: Fix insufficient memory allocation 2016-05-12 5:47 ` [PATCH kernel 1/2] powerpc/powernv: Fix insufficient memory allocation Alexey Kardashevskiy @ 2016-05-12 6:09 ` Gavin Shan 2016-05-12 6:39 ` Alexey Kardashevskiy 2016-05-12 11:32 ` [kernel,1/2] " Michael Ellerman 1 sibling, 1 reply; 9+ messages in thread From: Gavin Shan @ 2016-05-12 6:09 UTC (permalink / raw) To: Alexey Kardashevskiy Cc: linuxppc-dev, Alistair Popple, Gavin Shan, Michael Ellerman, Paul Mackerras On Thu, May 12, 2016 at 03:47:09PM +1000, Alexey Kardashevskiy wrote: >The pnv_pci_init_ioda_phb() helper allocates a blob to store auxilary >data such PE and M32/M64 segment allocation maps; this single blob has few >partitions, size of each is derived from the PE number - >phb->ioda.total_pe_num. > >It was assumed that the minimum PE number is 8, however it is 4 for NPU >so the pe_alloc part was missing in the allocated blob. >It was invisible till recently as we were not tracking used M64 segments >and NPUs do not use M32 segments so the phb->ioda.m32_segmap >(which was pointing to the same address as phb->ioda.pe_alloc) >has never been written to leaving the pe_alloc memory intact. > >After 401203ac2d "powerpc/powernv: Track M64 segment consumption" >the pe_alloc gets corrupted and PE allocation cannot work. >This fixes the issue by enforcing the minimum PE number to 8. > As I said offline yesterday, the issue exists from day-1 when NPU PHB is supported. I don't think it's related to 401203ac2d. Without the logic tracking M64 segments, the PE# bitmap still can be corrupted when writting to M32 segment map. It's confusing to mention a unrelated commit in the changelog. Since the issue exists from day-1 when NPU PHB is supported, is a stable tag needed? >Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> With above parts fixed: Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com> >--- > arch/powerpc/platforms/powernv/pci-ioda.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c >index 6cda2a8..d0d32c2 100644 >--- a/arch/powerpc/platforms/powernv/pci-ioda.c >+++ b/arch/powerpc/platforms/powernv/pci-ioda.c >@@ -3507,7 +3507,8 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, > PNV_IODA1_DMA32_SEGSIZE; > > /* Allocate aux data & arrays. We don't have IO ports on PHB3 */ >- size = _ALIGN_UP(phb->ioda.total_pe_num / 8, sizeof(unsigned long)); >+ size = _ALIGN_UP(max_t(unsigned, phb->ioda.total_pe_num, 8) / 8, >+ sizeof(unsigned long)); > m64map_off = size; > size += phb->ioda.total_pe_num * sizeof(phb->ioda.m64_segmap[0]); > m32map_off = size; >-- >2.5.0.rc3 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH kernel 1/2] powerpc/powernv: Fix insufficient memory allocation 2016-05-12 6:09 ` Gavin Shan @ 2016-05-12 6:39 ` Alexey Kardashevskiy 2016-05-12 6:59 ` Gavin Shan 0 siblings, 1 reply; 9+ messages in thread From: Alexey Kardashevskiy @ 2016-05-12 6:39 UTC (permalink / raw) To: Gavin Shan Cc: linuxppc-dev, Alistair Popple, Michael Ellerman, Paul Mackerras On 05/12/2016 04:09 PM, Gavin Shan wrote: > On Thu, May 12, 2016 at 03:47:09PM +1000, Alexey Kardashevskiy wrote: >> The pnv_pci_init_ioda_phb() helper allocates a blob to store auxilary >> data such PE and M32/M64 segment allocation maps; this single blob has few >> partitions, size of each is derived from the PE number - >> phb->ioda.total_pe_num. >> >> It was assumed that the minimum PE number is 8, however it is 4 for NPU >> so the pe_alloc part was missing in the allocated blob. >> It was invisible till recently as we were not tracking used M64 segments >> and NPUs do not use M32 segments so the phb->ioda.m32_segmap >> (which was pointing to the same address as phb->ioda.pe_alloc) >> has never been written to leaving the pe_alloc memory intact. >> >> After 401203ac2d "powerpc/powernv: Track M64 segment consumption" >> the pe_alloc gets corrupted and PE allocation cannot work. >> This fixes the issue by enforcing the minimum PE number to 8. >> > > As I said offline yesterday, the issue exists from day-1 when NPU PHB > is supported. I don't think it's related to 401203ac2d. Without the logic > tracking M64 segments, the PE# bitmap still can be corrupted when writting > to M32 segment map. It's confusing to mention a unrelated commit in the > changelog. The bug exists from day 1. The actual corruption started happening from 401203ac2d, it could be happening before but it was not. > > Since the issue exists from day-1 when NPU PHB is supported, is a stable > tag needed? > >> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> > > With above parts fixed: > > Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com> > >> --- >> arch/powerpc/platforms/powernv/pci-ioda.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c >> index 6cda2a8..d0d32c2 100644 >> --- a/arch/powerpc/platforms/powernv/pci-ioda.c >> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c >> @@ -3507,7 +3507,8 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, >> PNV_IODA1_DMA32_SEGSIZE; >> >> /* Allocate aux data & arrays. We don't have IO ports on PHB3 */ >> - size = _ALIGN_UP(phb->ioda.total_pe_num / 8, sizeof(unsigned long)); >> + size = _ALIGN_UP(max_t(unsigned, phb->ioda.total_pe_num, 8) / 8, >> + sizeof(unsigned long)); >> m64map_off = size; >> size += phb->ioda.total_pe_num * sizeof(phb->ioda.m64_segmap[0]); >> m32map_off = size; >> -- >> 2.5.0.rc3 >> > -- Alexey ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH kernel 1/2] powerpc/powernv: Fix insufficient memory allocation 2016-05-12 6:39 ` Alexey Kardashevskiy @ 2016-05-12 6:59 ` Gavin Shan 0 siblings, 0 replies; 9+ messages in thread From: Gavin Shan @ 2016-05-12 6:59 UTC (permalink / raw) To: Alexey Kardashevskiy Cc: Gavin Shan, linuxppc-dev, Alistair Popple, Michael Ellerman, Paul Mackerras On Thu, May 12, 2016 at 04:39:57PM +1000, Alexey Kardashevskiy wrote: >On 05/12/2016 04:09 PM, Gavin Shan wrote: >>On Thu, May 12, 2016 at 03:47:09PM +1000, Alexey Kardashevskiy wrote: >>>The pnv_pci_init_ioda_phb() helper allocates a blob to store auxilary >>>data such PE and M32/M64 segment allocation maps; this single blob has few >>>partitions, size of each is derived from the PE number - >>>phb->ioda.total_pe_num. >>> >>>It was assumed that the minimum PE number is 8, however it is 4 for NPU >>>so the pe_alloc part was missing in the allocated blob. >>>It was invisible till recently as we were not tracking used M64 segments >>>and NPUs do not use M32 segments so the phb->ioda.m32_segmap >>>(which was pointing to the same address as phb->ioda.pe_alloc) >>>has never been written to leaving the pe_alloc memory intact. >>> >>>After 401203ac2d "powerpc/powernv: Track M64 segment consumption" >>>the pe_alloc gets corrupted and PE allocation cannot work. >>>This fixes the issue by enforcing the minimum PE number to 8. >>> >> >>As I said offline yesterday, the issue exists from day-1 when NPU PHB >>is supported. I don't think it's related to 401203ac2d. Without the logic >>tracking M64 segments, the PE# bitmap still can be corrupted when writting >>to M32 segment map. It's confusing to mention a unrelated commit in the >>changelog. > > >The bug exists from day 1. The actual corruption started happening from >401203ac2d, it could be happening before but it was not. > well, Are you sure it starts from 401203ac2d? I would believe it starts from commit 3fa23ff ("powerpc/powernv: Fix initial IO and M32 segmap"). Please fix the commit log. >> >>Since the issue exists from day-1 when NPU PHB is supported, is a stable >>tag needed? >> >>>Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> >> >>With above parts fixed: >> >>Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com> >> >>>--- >>>arch/powerpc/platforms/powernv/pci-ioda.c | 3 ++- >>>1 file changed, 2 insertions(+), 1 deletion(-) >>> >>>diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c >>>index 6cda2a8..d0d32c2 100644 >>>--- a/arch/powerpc/platforms/powernv/pci-ioda.c >>>+++ b/arch/powerpc/platforms/powernv/pci-ioda.c >>>@@ -3507,7 +3507,8 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, >>> PNV_IODA1_DMA32_SEGSIZE; >>> >>> /* Allocate aux data & arrays. We don't have IO ports on PHB3 */ >>>- size = _ALIGN_UP(phb->ioda.total_pe_num / 8, sizeof(unsigned long)); >>>+ size = _ALIGN_UP(max_t(unsigned, phb->ioda.total_pe_num, 8) / 8, >>>+ sizeof(unsigned long)); >>> m64map_off = size; >>> size += phb->ioda.total_pe_num * sizeof(phb->ioda.m64_segmap[0]); >>> m32map_off = size; >>>-- >>>2.5.0.rc3 >>> >> > > >-- >Alexey > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [kernel,1/2] powerpc/powernv: Fix insufficient memory allocation 2016-05-12 5:47 ` [PATCH kernel 1/2] powerpc/powernv: Fix insufficient memory allocation Alexey Kardashevskiy 2016-05-12 6:09 ` Gavin Shan @ 2016-05-12 11:32 ` Michael Ellerman 1 sibling, 0 replies; 9+ messages in thread From: Michael Ellerman @ 2016-05-12 11:32 UTC (permalink / raw) To: Alexey Kardashevskiy, linuxppc-dev Cc: Alexey Kardashevskiy, Alistair Popple, Paul Mackerras, Gavin Shan On Thu, 2016-12-05 at 05:47:09 UTC, Alexey Kardashevskiy wrote: > The pnv_pci_init_ioda_phb() helper allocates a blob to store auxilary > data such PE and M32/M64 segment allocation maps; this single blob has few > partitions, size of each is derived from the PE number - > phb->ioda.total_pe_num. > > It was assumed that the minimum PE number is 8, however it is 4 for NPU > so the pe_alloc part was missing in the allocated blob. > It was invisible till recently as we were not tracking used M64 segments > and NPUs do not use M32 segments so the phb->ioda.m32_segmap > (which was pointing to the same address as phb->ioda.pe_alloc) > has never been written to leaving the pe_alloc memory intact. > > After 401203ac2d "powerpc/powernv: Track M64 segment consumption" > the pe_alloc gets corrupted and PE allocation cannot work. > This fixes the issue by enforcing the minimum PE number to 8. > > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> > Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/92a86756904b127a3450262b33 cheers ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH kernel 2/2] powerpc/powernv/npu: Add PE to PHB's list 2016-05-12 5:47 [PATCH kernel 0/2] powerpc/powernv/npu: Fixes for next tree Alexey Kardashevskiy 2016-05-12 5:47 ` [PATCH kernel 1/2] powerpc/powernv: Fix insufficient memory allocation Alexey Kardashevskiy @ 2016-05-12 5:47 ` Alexey Kardashevskiy 2016-05-12 6:15 ` Gavin Shan 2016-05-12 11:32 ` [kernel,2/2] " Michael Ellerman 1 sibling, 2 replies; 9+ messages in thread From: Alexey Kardashevskiy @ 2016-05-12 5:47 UTC (permalink / raw) To: linuxppc-dev Cc: Alexey Kardashevskiy, Alistair Popple, Gavin Shan, Michael Ellerman, Paul Mackerras Before 3e68dc57 "powerpc/powernv: Remove DMA32 PE list", NPU PEs were linked to the NPU PHB via phb->ioda.pe_dma_list; after that fix, the phb->ioda.pe_list is used. During the pe_dma_list removal, list_add_tail(&phb->ioda.pe_dma_list) was removed, however no list_add() was added so does this patch. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- arch/powerpc/platforms/powernv/pci-ioda.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index d0d32c2..4f9e73a 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -1009,6 +1009,9 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev) return NULL; } + /* Put PE to the list */ + list_add_tail(&pe->list, &phb->ioda.pe_list); + return pe; } -- 2.5.0.rc3 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH kernel 2/2] powerpc/powernv/npu: Add PE to PHB's list 2016-05-12 5:47 ` [PATCH kernel 2/2] powerpc/powernv/npu: Add PE to PHB's list Alexey Kardashevskiy @ 2016-05-12 6:15 ` Gavin Shan 2016-05-12 11:32 ` [kernel,2/2] " Michael Ellerman 1 sibling, 0 replies; 9+ messages in thread From: Gavin Shan @ 2016-05-12 6:15 UTC (permalink / raw) To: Alexey Kardashevskiy Cc: linuxppc-dev, Alistair Popple, Gavin Shan, Michael Ellerman, Paul Mackerras On Thu, May 12, 2016 at 03:47:10PM +1000, Alexey Kardashevskiy wrote: >Before 3e68dc57 "powerpc/powernv: Remove DMA32 PE list", NPU PEs >were linked to the NPU PHB via phb->ioda.pe_dma_list; after that fix, >the phb->ioda.pe_list is used. > >During the pe_dma_list removal, list_add_tail(&phb->ioda.pe_dma_list) >was removed, however no list_add() was added so does this patch. > >Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com> >--- > arch/powerpc/platforms/powernv/pci-ioda.c | 3 +++ > 1 file changed, 3 insertions(+) > >diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c >index d0d32c2..4f9e73a 100644 >--- a/arch/powerpc/platforms/powernv/pci-ioda.c >+++ b/arch/powerpc/platforms/powernv/pci-ioda.c >@@ -1009,6 +1009,9 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev) > return NULL; > } > >+ /* Put PE to the list */ >+ list_add_tail(&pe->list, &phb->ioda.pe_list); >+ > return pe; > } > >-- >2.5.0.rc3 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [kernel,2/2] powerpc/powernv/npu: Add PE to PHB's list 2016-05-12 5:47 ` [PATCH kernel 2/2] powerpc/powernv/npu: Add PE to PHB's list Alexey Kardashevskiy 2016-05-12 6:15 ` Gavin Shan @ 2016-05-12 11:32 ` Michael Ellerman 1 sibling, 0 replies; 9+ messages in thread From: Michael Ellerman @ 2016-05-12 11:32 UTC (permalink / raw) To: Alexey Kardashevskiy, linuxppc-dev Cc: Alexey Kardashevskiy, Alistair Popple, Paul Mackerras, Gavin Shan On Thu, 2016-12-05 at 05:47:10 UTC, Alexey Kardashevskiy wrote: > Before 3e68dc57 "powerpc/powernv: Remove DMA32 PE list", NPU PEs > were linked to the NPU PHB via phb->ioda.pe_dma_list; after that fix, > the phb->ioda.pe_list is used. > > During the pe_dma_list removal, list_add_tail(&phb->ioda.pe_dma_list) > was removed, however no list_add() was added so does this patch. > > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> > Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/1d4e89cf0a4e819fbde428e9e5 cheers ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-05-12 11:32 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-05-12 5:47 [PATCH kernel 0/2] powerpc/powernv/npu: Fixes for next tree Alexey Kardashevskiy 2016-05-12 5:47 ` [PATCH kernel 1/2] powerpc/powernv: Fix insufficient memory allocation Alexey Kardashevskiy 2016-05-12 6:09 ` Gavin Shan 2016-05-12 6:39 ` Alexey Kardashevskiy 2016-05-12 6:59 ` Gavin Shan 2016-05-12 11:32 ` [kernel,1/2] " Michael Ellerman 2016-05-12 5:47 ` [PATCH kernel 2/2] powerpc/powernv/npu: Add PE to PHB's list Alexey Kardashevskiy 2016-05-12 6:15 ` Gavin Shan 2016-05-12 11:32 ` [kernel,2/2] " Michael Ellerman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).