Re: Linux kernel: powerpc: KVM guest can trigger host crash on Power8

2021-10-30 Thread John Paul Adrian Glaubitz
Hi Michael!

On 10/28/21 08:39, Michael Ellerman wrote:
> That completed fine on my BE VM here.
> 
> I ran these in two tmux windows:
>   $ sbuild -d sid --arch=powerpc --no-arch-all gcc-11_11.2.0-10.dsc
>   $ sbuild -d sid --arch=ppc64 --no-arch-all gcc-11_11.2.0-10.dsc

Could you try gcc-10 instead? It's testsuite has crashed the host for me
with a patched kernel twice now.

$ dget -u https://deb.debian.org/debian/pool/main/g/gcc-10/gcc-10_10.3.0-12.dsc
$ sbuild -d sid --arch=powerpc --no-arch-all gcc-10_10.3.0-12.dsc
$ sbuild -d sid --arch=ppc64 --no-arch-all gcc-10_10.3.0-12.dsc

Thanks,
Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Re: bug: usb: gadget: FSL_UDC_CORE Corrupted request list leads to unrecoverable loop.

2021-10-30 Thread Joakim Tjernlund
On Fri, 2021-10-29 at 17:14 +, Eugene Bordenkircher wrote:
> Hello all,
> 
> We've discovered a situation where the FSL udc driver 
> (drivers/usb/gadget/udc/fsl_udc_core.c) will enter a loop iterating over the 
> request queue, but the queue has been corrupted at some point so it loops 
> infinitely.  I believe we have narrowed into the offending code, but we are 
> in need of assistance trying to find an appropriate fix for the problem.  The 
> identified code appears to be in all versions of the Linux kernel the driver 
> exists in.
> 
> The problem appears to be when handling a USB_REQ_GET_STATUS request.  The 
> driver gets this request and then calls the ch9getstatus() function.  In this 
> function, it starts a request by "borrowing" the per device status_req, 
> filling it in, and then queuing it with a call to list_add_tail() to add the 
> request to the endpoint queue.  Right before it exits the function however, 
> it's calling ep0_prime_status(), which is filling out that same status_req 
> structure and then queuing it with another call to list_add_tail() to add the 
> request to the endpoint queue.  This adds two instances of the exact same 
> LIST_HEAD to the endpoint queue, which breaks the list since the prev and 
> next pointers end up pointing to the wrong things.  This ends up causing a 
> hard loop the next time nuke() gets called, which happens on the next setup 
> IRQ.
> 
> I'm not sure what the appropriate fix to this problem is, mostly due to my 
> lack of expertise in USB and this driver stack.  The code has been this way 
> in the kernel for a very long time, which suggests that it has been working, 
> unless USB_REQ_GET_STATUS requests are never made.  This further suggests 
> that there is something else going on that I don't understand.  Deleting the 
> call to ep0_prime_status() and the following ep0stall() call appears, on the 
> surface, to get the device working again, but may have side effects that I'm 
> not seeing.
> 
> I'm hopeful someone in the community can help provide some information on 
> what I may be missing or help come up with a solution to the problem.  A big 
> thank you to anyone who would like to help out.
> 
> Eugene

Run into this to a while ago. Found the bug and a few more fixes.
This is against 4.19 so you may have to tweak them a bit.
Feel free to upstream them.

 Jocke 
From a7ed9cffbfc90371b570ebef698d96c39adbaf77 Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund 
Date: Mon, 11 May 2020 11:18:14 +0200
Subject: [PATCH 5/5] fsl_udc_core: Init max_pipes for reset_queues()

Signed-off-by: Joakim Tjernlund 
---
 drivers/usb/gadget/udc/fsl_udc_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index bd3825d9f1d2..92136dff8373 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -2441,6 +2441,7 @@ static int fsl_udc_probe(struct platform_device *pdev)
 	/* Get max device endpoints */
 	/* DEN is bidirectional ep number, max_ep doubles the number */
 	udc_controller->max_ep = (dccparams & DCCPARAMS_DEN_MASK) * 2;
+	udc_controller->max_pipes = udc_controller->max_ep;
 
 	udc_controller->irq = platform_get_irq(pdev, 0);
 	if (!udc_controller->irq) {
-- 
2.32.0

From b98fa0dd384f17fee0c1283b91f855b97d1976f4 Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund 
Date: Mon, 11 May 2020 10:38:07 +0200
Subject: [PATCH 4/5] fsl_udc_stop: Use list_for_each_entry_safe() when
 deleting

Signed-off-by: Joakim Tjernlund 
---
 drivers/usb/gadget/udc/fsl_udc_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index 4f835332af45..bd3825d9f1d2 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -1984,7 +1984,7 @@ static int fsl_udc_start(struct usb_gadget *g,
 /* Disconnect from gadget driver */
 static int fsl_udc_stop(struct usb_gadget *g)
 {
-	struct fsl_ep *loop_ep;
+	struct fsl_ep *loop_ep, *tmp_loop;
 	unsigned long flags;
 
 	if (!IS_ERR_OR_NULL(udc_controller->transceiver))
@@ -2002,8 +2002,8 @@ static int fsl_udc_stop(struct usb_gadget *g)
 	spin_lock_irqsave(_controller->lock, flags);
 	udc_controller->gadget.speed = USB_SPEED_UNKNOWN;
 	nuke(_controller->eps[0], -ESHUTDOWN);
-	list_for_each_entry(loop_ep, _controller->gadget.ep_list,
-			ep.ep_list)
+	list_for_each_entry_safe(loop_ep, tmp_loop, _controller->gadget.ep_list,
+ ep.ep_list)
 		nuke(loop_ep, -ESHUTDOWN);
 	spin_unlock_irqrestore(_controller->lock, flags);
 
-- 
2.32.0

From a90a89d06bd008f606404ec613b4f2343b9dda1a Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund 
Date: Thu, 7 May 2020 22:35:14 +0200
Subject: [PATCH 3/5] fsl_ep_dequeue

Signed-off-by: Joakim Tjernlund 
---
 drivers/usb/gadget/udc/fsl_udc_core.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c 

Re: (subset) [PATCH 00/13] block: add_disk() error handling stragglers

2021-10-30 Thread Jens Axboe
On Fri, 15 Oct 2021 16:52:06 -0700, Luis Chamberlain wrote:
> This patch set consists of al the straggler drivers for which we have
> have no patch reviews done for yet. I'd like to ask for folks to please
> consider chiming in, specially if you're the maintainer for the driver.
> Additionally if you can specify if you'll take the patch in yourself or
> if you want Jens to take it, that'd be great too.
> 
> Luis Chamberlain (13):
>   block/brd: add error handling support for add_disk()
>   nvme-multipath: add error handling support for add_disk()
>   nvdimm/btt: do not call del_gendisk() if not needed
>   nvdimm/btt: use goto error labels on btt_blk_init()
>   nvdimm/btt: add error handling support for add_disk()
>   nvdimm/blk: avoid calling del_gendisk() on early failures
>   nvdimm/blk: add error handling support for add_disk()
>   zram: add error handling support for add_disk()
>   z2ram: add error handling support for add_disk()
>   ps3disk: add error handling support for add_disk()
>   ps3vram: add error handling support for add_disk()
>   block/sunvdc: add error handling support for add_disk()
>   mtd/ubi/block: add error handling support for add_disk()
> 
> [...]

Applied, thanks!

[01/13] block/brd: add error handling support for add_disk()
commit: e1528830bd4ebf435d91c154e309e6e028336210

Best regards,
-- 
Jens Axboe




[powerpc:next-test 31/71] arch/powerpc/mm/nohash/fsl_book3e.c:126:40: error: '_PAGE_BAP_SX' undeclared

2021-10-30 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git 
next-test
head:   81291383ffde08b23bce75e7d6b2575ce9d3475c
commit: 01116e6e98b08ab0641fa516ddafb1b1b2088e64 [31/71] powerpc/fsl_booke: 
Take exec flag into account when setting TLBCAMs
config: powerpc-ge_imp3a_defconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id=01116e6e98b08ab0641fa516ddafb1b1b2088e64
git remote add powerpc 
https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git
git fetch --no-tags powerpc next-test
git checkout 01116e6e98b08ab0641fa516ddafb1b1b2088e64
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross 
O=build_dir ARCH=powerpc SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

Note: the powerpc/next-test HEAD 81291383ffde08b23bce75e7d6b2575ce9d3475c 
builds fine.
  It only hurts bisectability.

All errors (new ones prefixed by >>):

   arch/powerpc/mm/nohash/fsl_book3e.c:63:15: error: no previous prototype for 
'tlbcam_sz' [-Werror=missing-prototypes]
  63 | unsigned long tlbcam_sz(int idx)
 |   ^
   arch/powerpc/mm/nohash/fsl_book3e.c: In function 'settlbcam':
>> arch/powerpc/mm/nohash/fsl_book3e.c:126:40: error: '_PAGE_BAP_SX' undeclared 
>> (first use in this function)
 126 | TLBCAM[index].MAS3 |= (flags & _PAGE_BAP_SX) ? MAS3_SX : 0;
 |^~~~
   arch/powerpc/mm/nohash/fsl_book3e.c:126:40: note: each undeclared identifier 
is reported only once for each function it appears in
   cc1: all warnings being treated as errors


vim +/_PAGE_BAP_SX +126 arch/powerpc/mm/nohash/fsl_book3e.c

62  
  > 63  unsigned long tlbcam_sz(int idx)
64  {
65  return tlbcam_addrs[idx].limit - tlbcam_addrs[idx].start + 1;
66  }
67  
68  #ifdef CONFIG_FSL_BOOKE
69  /*
70   * Return PA for this VA if it is mapped by a CAM, or 0
71   */
72  phys_addr_t v_block_mapped(unsigned long va)
73  {
74  int b;
75  for (b = 0; b < tlbcam_index; ++b)
76  if (va >= tlbcam_addrs[b].start && va < 
tlbcam_addrs[b].limit)
77  return tlbcam_addrs[b].phys + (va - 
tlbcam_addrs[b].start);
78  return 0;
79  }
80  
81  /*
82   * Return VA for a given PA or 0 if not mapped
83   */
84  unsigned long p_block_mapped(phys_addr_t pa)
85  {
86  int b;
87  for (b = 0; b < tlbcam_index; ++b)
88  if (pa >= tlbcam_addrs[b].phys
89  && pa < 
(tlbcam_addrs[b].limit-tlbcam_addrs[b].start)
90+tlbcam_addrs[b].phys)
91  return 
tlbcam_addrs[b].start+(pa-tlbcam_addrs[b].phys);
92  return 0;
93  }
94  #endif
95  
96  /*
97   * Set up a variable-size TLB entry (tlbcam). The parameters are not 
checked;
98   * in particular size must be a power of 4 between 4k and the max 
supported by
99   * an implementation; max may further be limited by what can be 
represented in
   100   * an unsigned long (for example, 32-bit implementations cannot support 
a 4GB
   101   * size).
   102   */
   103  static void settlbcam(int index, unsigned long virt, phys_addr_t phys,
   104  unsigned long size, unsigned long flags, unsigned int 
pid)
   105  {
   106  unsigned int tsize;
   107  
   108  tsize = __ilog2(size) - 10;
   109  
   110  #if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC)
   111  if ((flags & _PAGE_NO_CACHE) == 0)
   112  flags |= _PAGE_COHERENT;
   113  #endif
   114  
   115  TLBCAM[index].MAS0 = MAS0_TLBSEL(1) | MAS0_ESEL(index) | 
MAS0_NV(index+1);
   116  TLBCAM[index].MAS1 = MAS1_VALID | MAS1_IPROT | 
MAS1_TSIZE(tsize) | MAS1_TID(pid);
   117  TLBCAM[index].MAS2 = virt & PAGE_MASK;
   118  
   119  TLBCAM[index].MAS2 |= (flags & _PAGE_WRITETHRU) ? MAS2_W : 0;
   120  TLBCAM[index].MAS2 |= (flags & _PAGE_NO_CACHE) ? MAS2_I : 0;
   121  TLBCAM[index].MAS2 |= (flags & _PAGE_COHERENT) ? MAS2_M : 0;
   122  TLBCAM[index].MAS2 |= (flags & _PAGE_GUARDED) ? MAS2_G : 0;
   123  TLBCAM[index].MAS2 |= (flags & _PAGE_ENDIAN) ? MAS2_E : 0;
   124  
   125  TLBCAM[index].MAS3 = (phys & MAS3_RPN) | MAS3_SR;
 > 126  TLBCAM[index].MAS3 |= (flags & _PAGE_BAP_SX) ? MAS3_SX : 0;
   127  TLBCAM[index].MAS3 |= (flags & _PAGE_RW) ? MAS3_SW : 0;

Re: (subset) [PATCH 00/13] block: add_disk() error handling stragglers

2021-10-30 Thread Jens Axboe
On Fri, 15 Oct 2021 16:52:06 -0700, Luis Chamberlain wrote:
> This patch set consists of al the straggler drivers for which we have
> have no patch reviews done for yet. I'd like to ask for folks to please
> consider chiming in, specially if you're the maintainer for the driver.
> Additionally if you can specify if you'll take the patch in yourself or
> if you want Jens to take it, that'd be great too.
> 
> Luis Chamberlain (13):
>   block/brd: add error handling support for add_disk()
>   nvme-multipath: add error handling support for add_disk()
>   nvdimm/btt: do not call del_gendisk() if not needed
>   nvdimm/btt: use goto error labels on btt_blk_init()
>   nvdimm/btt: add error handling support for add_disk()
>   nvdimm/blk: avoid calling del_gendisk() on early failures
>   nvdimm/blk: add error handling support for add_disk()
>   zram: add error handling support for add_disk()
>   z2ram: add error handling support for add_disk()
>   ps3disk: add error handling support for add_disk()
>   ps3vram: add error handling support for add_disk()
>   block/sunvdc: add error handling support for add_disk()
>   mtd/ubi/block: add error handling support for add_disk()
> 
> [...]

Applied, thanks!

[08/13] zram: add error handling support for add_disk()
commit: 5e2e1cc4131cf4d21629c94331f2351b7dc8b87c
[10/13] ps3disk: add error handling support for add_disk()
commit: ff4cbe0fcf5d749f76040f782f0618656cd23e33
[11/13] ps3vram: add error handling support for add_disk()
commit: 3c30883acab1d20ecbd3c48dc12b147b51548742

Best regards,
-- 
Jens Axboe




Re: [PATCH v1 1/1] soc: fsl: Replace kernel.h with the necessary inclusions

2021-10-30 Thread Andy Shevchenko
On Saturday, October 30, 2021, Christophe Leroy 
wrote:

>
> Le 29/10/2021 à 22:31, Andy Shevchenko a écrit :
>
>> On Fri, Oct 29, 2021 at 10:04 PM LEROY Christophe
>>  wrote:
>>
>>>
>>>
>>>
>>> Le 29/10/2021 à 17:55, Andy Shevchenko a écrit :
>>>
 On Wed, Oct 27, 2021 at 06:33:54PM +0300, Andy Shevchenko wrote:

> When kernel.h is used in the headers it adds a lot into dependency
> hell,
> especially when there are circular dependencies are involved.
>
> Replace kernel.h inclusion with the list of what is really being used.
>

 Seems nobody from PPC took this patch.
 Any idea who can take it?


>>> You have to check in MAINTAINERS file in the root directory of kernel
>>> sources: https://github.com/linuxppc/linux/blob/master/MAINTAINERS
>>>
>>
>> Actually for these files get_maintainer.pl showed nothing.
>> I have chosen PPC maintainers manually.
>>
>> That's Michael who takes them. But you have to allow him enough time for
>>> it.
>>>
>>
>> Thanks!
>>
>> I wrote that message because I have got a notification from checkpatch
>> that it should go somewhere else.
>>
>>
> That means that Michael considered it is not for him.
>
> And I think the reason is that in MAINTAINERS you have:
>
> FREESCALE QUICC ENGINE LIBRARY
> M:  Qiang Zhao 
> L:  linuxppc-dev@lists.ozlabs.org
> S:  Maintained
> F:  drivers/soc/fsl/qe/
> F:  include/soc/fsl/*qe*.h
> F:  include/soc/fsl/*ucc*.h
>
>
> FREESCALE SOC DRIVERS
> M:  Li Yang 
> L:  linuxppc-dev@lists.ozlabs.org
> L:  linux-arm-ker...@lists.infradead.org (moderated for
> non-subscribers)
> S:  Maintained
> F:  Documentation/devicetree/bindings/misc/fsl,dpaa2-console.yaml
> F:  Documentation/devicetree/bindings/soc/fsl/
> F:  drivers/soc/fsl/
> F:  include/linux/fsl/
>
>
Thanks! Now I should understand why get_maintainer hadn’t showed above for
me.



> Sorry I overlooked your patch.


NP


>
> Christophe
>


-- 
With Best Regards,
Andy Shevchenko