[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Xen Arm vpl011 UART will cause segmentation fault in Linux guest


  • To: Michal Orzel <michal.orzel@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jiamei Xie <Jiamei.Xie@xxxxxxx>
  • Date: Wed, 9 Nov 2022 08:25:02 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FBZKwRlsIv8VcIZGXvt5p4gypDcXXucJmvXtwmN67hs=; b=ambyAMYACh7HBlhwEnaVugTYU4WgOEc/ov06ycI3HDaH1aRBFqgl53MUPgud+2q/8lB3nIgeCuQFL/q5BxfChyX4frs0VfieuneqMFHvFX3rEblmFcIfWl5mhXegWrqDR4IBcFOgrqE1E1PgAhWbZh7+jHimljTkQQYy0UGu0qmQnRUf9ZbjNQBY62exNSIxx4Lrg3kUhZ0OK9ckman2CSD7hw6txpiLi80yI5/NhyhEXRs5Anmhw/eU6fbGMP9W6sYftZkHhrubZvEr2ne4rMLSufjD1YusD0QSlPj/8x9IViZKwSpohxaCF+Rxyu+izayI9OsOJSNX9IAbHei+YQ==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FBZKwRlsIv8VcIZGXvt5p4gypDcXXucJmvXtwmN67hs=; b=KgVoqM+/HMUXDUo+zgzNY2sZ8qFKvwF7vfjHKIDLRM+68eDfSv+Co12Cu8vEtaZCX98DN1gIRKkQpNODYaLi+Y8QFUCNSMNJQA1xkUnLb6qboa2+PlP3z48JMpF3wUCIEXxdq/Lqab22fg36lQH1jI+StPBo55NyZJ4I17pDXM/YxxhdcgSvj3y/MhisNVbqwyRcPB2A9NaFK+F/MLIgxXjKelnopi9DchqCzhgKmziWyZCcXkDz6nLvp1QRfm/UQ21Bg/MdxkaxUqQHhOGk5KF9BqYZKRZrptm5gxS+ZhL5SUKyel33i72yGUiNgkirgnmRv1mrXTo3DdtMfNeKKQ==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=mQ+bMpUWwr9g4Ii8E8QP8hnB2etDho+gsiwTVQZoRTarXufo9BvrAfXF0n9eEuE+V4DfqLBdwpPLdb6+dZY11xqxNZpihXUXlF5Au2s/TqI+0ZJAoD3lQIbS3ilGGbieKeO1kUMyvZ4pwggrf08wk0Cv4RaDFE2Zx/cci4i3RRTfH7mm2SnDlllQTWv1DQI++V7iGr6OdWatZssr7jca0GFWn21MoQzXVrgUO2Pcczjelfdszsiw0TBwE4xg/iqKS6q3DpRqVzOTfBexzTC368VSGH4BWi3R14zKfGlqRs6Si8EIWswfhrH+GfPeNdDALvUMnh7JMyuUOvCnexBPzg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RHdCQNqwnYsX6c6v5t11vUhk8kt5AcrwdPy65dJ8ziNPsShg6MHsX33qS4WUDpHCeMm005n2E0HrOQ04LgtNaX4+CEb6MPgdcZ9Iqqmc0vAHV4LX9e5UZ3cF2iEK4RebeAksCJuqZdXajDJgov4J0PWqp15Y6zBQPMPBZc5FfGahv+2tUHmvjScmwfyWzMZHBDlBhH1LMcACKhlhIPmznBLjJSavqeRMldMVpRwMECRRsxcFp8XC+RnEWYpN9vUhC3GzIfGITb8N99A8ajbjsI9VjyrDg8jcPhWYfbg17+yJ8mgbXhbzubn7ayRlJAmnzF7nxJVPTVMaSjD6Jy3YHg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Wei Chen <Wei.Chen@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>
  • Delivery-date: Wed, 09 Nov 2022 08:25:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: Adj0C3U97KqJOGXWTaWwFEv08mPlLwAAvb+AAAFgduA=
  • Thread-topic: Xen Arm vpl011 UART will cause segmentation fault in Linux guest

Hi Michal,

Below log can be got when stating the linux guest. It says 9c09 is sbsa. And 
9c09 is also output
 in bootlogd error message: 
Serial: AMBA PL011 UART driver
9c0b0000.uart: ttyAMA0 at MMIO 0x9c0b0000 (irq = 12, base_baud = 0) is a PL011 
rev2
printk: console [ttyAMA0] enabled
9c090000.sbsa-uart: ttyAMA1 at MMIO 0x9c090000 (irq = 15, base_baud = 0) is a 
SBSA

Best wishes
Jiamei Xie



> -----Original Message-----
> From: Michal Orzel <michal.orzel@xxxxxxx>
> Sent: Wednesday, November 9, 2022 3:40 PM
> To: Jiamei Xie <Jiamei.Xie@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Wei Chen <Wei.Chen@xxxxxxx>; Bertrand Marquis
> <Bertrand.Marquis@xxxxxxx>; julien@xxxxxxx; sstabellini@xxxxxxxxxx
> Subject: Re: Xen Arm vpl011 UART will cause segmentation fault in Linux
> guest
> 
> Hi Jiamei,
> 
> On 09/11/2022 08:20, Jiamei Xie wrote:
> >
> >
> > Hi all,
> >
> > When the guest kernel enables DMA engine with
> "CONFIG_DMA_ENGINE=y", Linux AMBA PL011 driver will access PL011
> DMACR register. But this register have not been supported by vpl011 of Xen.
> Xen will inject a data abort into guest, this will cause segmentation fault of
> guest with the below message:
> I am quite confused.
> VPL011 implements SBSA UART which only implements some subset of PL011
> operations (SBSA UART is not PL011).
> According to spec (SBSA ver. 6.0), the SBSA_UART does not support DMA
> features so Xen code is fine.
> When Xen exposes vpl011 device to a guest, this device has "arm,sbsa-uart"
> compatible and not "uart-pl011".
> Linux driver "amba-pl011.c" should see this compatible and assign proper
> operations (sbsa_uart_pops instead of amba_pl011_pops) that do not enable
> DMA.
> Maybe the issue is with your configuration?
> 
> ~Michal
> 
> > Unhandled fault at 0xffffffc00944d048
> > Mem abort info:
> > ESR = 0x96000000
> > EC = 0x25: DABT (current EL), IL = 32 bits
> > SET = 0, FnV = 0
> > EA = 0, S1PTW = 0
> > FSC = 0x00: ttbr address size fault
> > Data abort info:
> > ISV = 0, ISS = 0x00000000
> > CM = 0, WnR = 0
> > swapper pgtable: 4k pages, 39-bit VAs, pgdp=0000000020e2e000
> > [ffffffc00944d048] pgd=100000003ffff803, p4d=100000003ffff803,
> pud=100000003ffff803, pmd=100000003fffa803, pte=006800009c090f13
> > Internal error: ttbr address size fault: 96000000 [#1] PREEMPT SMP
> > Modules linked in:
> > CPU: 0 PID: 132 Comm: bootlogd Not tainted 5.15.44-yocto-standard #1
> > pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> > pc : pl011_stop_rx+0x70/0x80
> > lr : uart_tty_port_shutdown+0x44/0x110
> > sp : ffffffc00999bba0
> > x29: ffffffc00999bba0 x28: ffffff80234ac380 x27: ffffff8022f5d000
> > x26: 0000000000000000 x25: 0000000045585401 x24: 0000000000000000
> > x23: ffffff8021ba4660 x22: 0000000000000001 x21: ffffff8021a0e2a0
> > x20: ffffff802198f880 x19: ffffff8021a0e1a0 x18: 0000000000000000
> > x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
> > x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
> > x11: 0000000000000000 x10: 0000000000000000 x9 : ffffffc00871ba14
> > x8 : ffffffc0099de260 x7 : ffffff8021a0e318 x6 : 0000000000000003
> > x5 : ffffffc009315f20 x4 : ffffffc00944d038 x3 : 0000000000000000
> > x2 : ffffffc00944d048 x1 : 0000000000000000 x0 : 0000000000000048
> > Call trace:
> > pl011_stop_rx+0x70/0x80
> > tty_port_shutdown+0x7c/0xb4
> > tty_port_close+0x60/0xcc
> > uart_close+0x34/0x8c
> > tty_release+0x144/0x4c0
> > __fput+0x78/0x220
> > ____fput+0x1c/0x30
> > task_work_run+0x88/0xc0
> > do_notify_resume+0x8d0/0x123c
> > el0_svc+0xa8/0xc0
> > el0t_64_sync_handler+0xa4/0x130
> > el0t_64_sync+0x1a0/0x1a4
> > Code: b9000083 b901f001 794038a0 8b000042 (b9000041)
> > ---[ end trace 83dd93df15c3216f ]---
> > note: bootlogd[132] exited with preempt_count 1
> > /etc/rcS.d/S07bootlogd: line 47: 132 Segmentation fault start-stop-
> daemon
> > In Xen, vpl011_mmio_write doesn't handle DMACR . And kernel doesn't
> check if pl011_write executes sucessfully in pl011_dma_rx_stop . So such
> segmentation fault occurs.
> > static inline void pl011_dma_rx_stop(struct uart_amba_port *uap)
> > {
> >         /* FIXME.  Just disable the DMA enable */
> >         uap->dmacr &= ~UART011_RXDMAE;
> >         pl011_write(uap->dmacr, uap, REG_DMACR);
> > }
> >
> > I think we should prevent such segmentation fault. We have checked the
> PL011 spec, it seems there is not any register bit can indicate DMA support
> status of PL011. We might have two options:
> > 1. Option#1 is to add DMA support for vpl011, but this is not trivial.
> > 2. Option#2 is to ignore the write to DMACR, and return 0 for DMACR read
> in vpl011. But this option need co-work with kernel, because current Linux
> PL011 driver assume the write operation will never be failed, and will not
> fallback to no-DMA mode, when Xen return 0 for DMA enabled bit in DMACR.
> >
> > How do you think about it?  Any suggestion about it is welcome. Thanks.
> >
> > Best wishes
> > Jiamei Xie
> >

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.