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

Re: PCI pass-through problem for SN570 NVME SSD


  • To: "G.R." <firemeteor@xxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 4 Jul 2022 12:31:49 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • 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=JvYimHc7miBXWxY1r0oSigWxnHtEf6m2Gcy0rQtxueQ=; b=VsgRoszTq/SOS9ImYCl8m52alhqZEZ5SO07ZvOXVfIEN1FVE1tDLHUT0Zb6B5kBx7EBL3BruXW9CPLShzdm4cSF270M7CIXbqGKR0BTR5G4iktbHz2EkWWDaMigkbmyfAqveop4ExAheN4ic2Yt/qyBABDIDjDFUKTCiO/G1T2koDNkg8EXaAx69L4gW4KsqYQQ5HYKjECS6CxAbAaYi6c6sLPje7FK/KG48ADVbqOskt9xT62w/9m0BZ41adG+gEsfdVowndBO4v0u4ZKpnqqpCcP2ojPOIoDdnhkRWfisB9vHVTdeeYq6KwUQ5yX9tf/dyh86Z/Ys7b7/cbdpjyw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K1VrwaYgygqOngXtShkQVb+0wJVCMKbw+u3IK4WnHTiH934Q8gOhw1LUKuKhqUATV5nfB4nQ7vqONXvjXP9yLrZRZqimvOg2vIshp+DI5FmEFvd0qMu3DaGv9r5ZUMl0IYmwwTPGU6aynwtYbTcMR7761L/gVGKJcwmv+yBGGx75ndQJ5iIg76+SmwD5AXG7ZFgWYF9AnF1a3BeYxyorpqQ+p0xhSGmS5Kzeo0hJdX1t3WO6c6DM5iEp0xLZ0biSanrlaNUp1T8KKnHzL48e+LkaTFEQky5UZ8tmRF2zFfoD3qPKAxBl+1K7kXZNHANX9ixdqAVP8sFQFQQdgYL7EA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxx>
  • Delivery-date: Mon, 04 Jul 2022 10:32:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

(Note: please don't cross-post; removing xen-users@.)

On 04.07.2022 08:37, G.R. wrote:
> Update some findings with extra triage effort...
> Detailed log could be found in the attachments.
> 1. Confirm stock Debian 11.2 kernel (5.10) shares the same syndrome..
> 2. With loglvl=all, it reveals why the mapping failure happens, looks
> like it comes from some duplicated mapping..
> (XEN) memory_map:add: dom1 gfn=f3074 mfn=a2610 nr=2
> (XEN) memory_map:add: dom1 gfn=f3077 mfn=a2615 nr=1
> (XEN) memory_map:add: dom1 gfn=f3078 mfn=a2616 nr=1 <===========Here
> (XEN) ioport_map:add: dom1 gport=c140 mport=4060 nr=20
> (XEN) ioport_map:add: dom1 gport=c170 mport=4090 nr=8
> (XEN) ioport_map:add: dom1 gport=c178 mport=4080 nr=4
> (XEN) memory_map:add: dom1 gfn=f3070 mfn=a2500 nr=2
> (XEN) memory_map:add: dom1 gfn=f3073 mfn=a2503 nr=1
> (XEN) memory_map:add: dom1 gfn=f3078 mfn=a2504 nr=1 <===========Here
> (XEN) d1: GFN 0xf3078 (0xa2616,0,5,7) -> (0xa2504,0,5,7) not permitted
> (XEN) domain_crash called from p2m.c:1301
> (XEN) Domain 1 reported crashed by domain 0 on cpu#2:
> (XEN) memory_map:fail: dom1 gfn=f3078 mfn=a2504 nr=1 ret:-1
> (XEN) memory_map:remove: dom1 gfn=f3078 mfn=a2504 nr=1

Neither here nor in your initial mail I've spotted information
on the BARs the device has. The above makes me wonder whether it
has two BARs each covering less than 4k and both sharing a page.
Or wait - the hvmloader output actually has some useful data:

(d1) pci dev 05:0 bar 24 size 000000800: 0f3077000
...
(d1) pci dev 05:0 bar 14 size 000000100: 0f3077800

The sharing is apparently introduced in hvmloader, but might not
have been deemed a problem because it's generally advisable (for
security reasons) or even necessary (for functionality) for BARs
of devices to be passed through to all live in distinct (4k) pages.
However - while hvmloader has no knowledge of host addresses
occupied by the BARs (so it has no indication to place them in
separate pages), it should still not put any two BARs in the same
(guest) page. Even then, as the P2M mapping occurs at 4k
granularity, it would further need to know the host's offset-into-
page value to correctly calculate the guest address. IOW this will
in addition require the host to put all BARs at the beginning of
4k pages (which may well be the case already for you).

(d1) pci dev 06:0 bar 20 size 000000100: 0f3077904

would cause the same issue (afaict), unless the host BAR shared a
page with the earlier BAR of 05:0.

> 3. Recompiled kernel with DEBUG enabled for xen_pciback driver and
> play with xl pci-assignable-XXX with it
> 3.1 It's confirmed that the DPC / AER error log happens only when
> xen_pciback attempts to seize && release the device
> 3.1.1 It only happens on each of the first add / remove operations.
> 3.2 There is still a 'MSI-X preparation failed' message later-on, but
> otherwise it appears to be successful to add / remove the device after
> the 1st attempt.
> 3.3 Not necessarily related, but the DPC / AER log looks similar to
> this report [1]

The only thing I can say here is that quite likely pciback needs
work to become up-to-date again with advanced feature handling
elsewhere in the kernel.

Jan

> [1]: 
> https://patchwork.kernel.org/project/linux-pci/patch/20220127025418.1989642-1-kai.heng.feng@xxxxxxxxxxxxx/#24713767



 


Rackspace

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