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

Re: [PATCH 3/3] x86/vmsi: tolerate unsupported MSI address/data fields


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 26 Jan 2021 16:57:40 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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-SenderADCheck; bh=t1v4/9rh5l68gpX2yyVn3GN4c6XcngR7pts3CyqjpQo=; b=FUcMkXKaf2wNfWaKr6ExCxrBusyzumGq7cdmNrTYWZCiQQut+/L8MsMagvZ3ScyIOberqsEm3iDGjiuXJcdJUbB6VPWpCfqsVq7D22HLXfKktNVCT9t7s7z0Tl2qyfTgw005H105LYQb20lBODWm71JDcHQfz/UY2TqCrYLsaQd//+OBg+F5LG0RNWEJpDDPlgOtdPdmfwWV9o8ZDQtaDAN/08UZKiu3+FTzqETJda3AfqIZFJlUqbR774HVwToJgcpgn3vGzWZL0fEu9oDjM9FNZl/fS5rC0o2xneASl2F3+Ba0eExbQtlIT9rKdim4P0AxX6Zj7lSTDOJR+KF4Lw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m2zWA6nCNT/5XojVbEBk+RkzgX491mmgyplWHevvIYHwR0hSe0jg1i7wK08m3Cw2B3CGXECDPEJvZqBHaIg4AaujRH7FHRCBT0qU3xKg6Rf5lFKWT0q71jmxR5R2Twy7ZDla46aJwiRcsfwz9WRPPx/M1hbtZ31kLF34yJrUxOBkQ6MbhPvll/IhTfR1RGZSD5DDmzxvYhN4thjBjjUtFEgxweOq/+AN+JtjQOd+IA5CDMcHs+nes32e5yA7uS9voxiPFSwYjO88Ovk5QjAl8JKSY8wFaAMWkp/6cByW9m+6BSo5/6X5+iVMneitP4DkFiTx86eupJbTRduKJ6rlVA==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 26 Jan 2021 15:58:05 +0000
  • Ironport-sdr: tikwhTmK7hYLqwFKaM+y3LGR7sjnhC9Ttwtqgzakd8RbZ8iyJYIf5w/o4otDX5UmuvO6hmCOw3 kKjMUsd7gVQga/2Qo+xL///8+Ukm5KSsUfN5oz1BnsHyQ7zFOdRlHLYdacyfXWcj4TTj5U4Axz zgm1RqM3KIgUnPX8A6btd71qXoZoIMQ6IJNMJRjICsBw7yj+S0Esic7Lix+fX2RvZXHhhvWyKs 0/eZ9RpyJzFstDVQ79xkMaSQJGGL0dIInH7WozuIk1hGXiEeOC0aLEpfC2CgFBAnDp+7KoMA5d RrE=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Jan 26, 2021 at 04:17:59PM +0100, Jan Beulich wrote:
> On 26.01.2021 12:06, Roger Pau Monne wrote:
> > Plain MSI doesn't allow caching the MSI address and data fields while
> > the capability is enabled and not masked, hence we need to allow any
> > changes to those fields to update the binding of the interrupt. For
> > reference, the same doesn't apply to MSI-X that is allowed to cache
> > the data and address fields while the entry is unmasked, see section
> > 6.8.3.5 of the PCI Local Bus Specification 3.0.
> > 
> > Allowing such updates means that a guest can write an invalid address
> > (ie: all zeros) and then a valid one, so the PIRQs shouldn't be
> > unmapped when the interrupt cannot be bound to the guest, since
> > further updates to the address or data fields can result in the
> > binding succeeding.
> 
> IOW the breakage from the other patch was because rubbish was
> written first, and suitable data was written later on? I didn't
> think core PCI code in Linux would do such, which would make me
> suspect a driver having custom MSI handling code ...

So it seems that specific Linux driver will write 0s to the address
field at some point during initialization, but it also doesn't end up
using MSI interrupts anyway, so I assume it's somehow broken. FTR it's
the snd_hda_intel driver.

However it seems like Linux likes to zero all addresses fields on
shutdown for MSI (not MSI-X) with the capability enabled, and I do
see:

vmsi.c:688:d0v2 0000:00:1c.3: PIRQ 643: unsupported address 0
vmsi.c:688:d0v2 0000:00:1c.3: PIRQ 643: unsupported address 0
vmsi.c:688:d0v2 0000:00:1c.0: PIRQ 644: unsupported address 0
vmsi.c:688:d0v2 0000:00:1c.0: PIRQ 644: unsupported address 0
vmsi.c:688:d0v2 0000:00:14.0: PIRQ 641: unsupported address 0
vmsi.c:688:d0v2 0000:00:14.0: PIRQ 641: unsupported address 0
vmsi.c:688:d0v2 0000:00:14.0: PIRQ 641: unsupported address 0
vmsi.c:688:d0v2 0000:00:01.2: PIRQ 645: unsupported address 0
vmsi.c:688:d0v2 0000:00:01.2: PIRQ 645: unsupported address 0
vmsi.c:688:d0v2 0000:00:01.1: PIRQ 646: unsupported address 0
vmsi.c:688:d0v2 0000:00:01.1: PIRQ 646: unsupported address 0
vmsi.c:688:d0v2 0000:00:01.0: PIRQ 647: unsupported address 0
vmsi.c:688:d0v2 0000:00:01.0: PIRQ 647: unsupported address 0

When dom0 is shutting down. That's with the 5.4 kernel, maybe other
versions won't do it.

> > Modify the vPCI MSI arch helpers to track whether the interrupt is
> > bound, and make failures in vpci_msi_update not unmap the PIRQ, so
> > that further calls can attempt to bind the PIRQ again.
> > 
> > Note this requires some modifications to the MSI-X handlers, but there
> > shouldn't be any functional changes in that area.
> > 
> > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> 
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> Am I understanding correctly that this change is independent of
> the initial 2 patches (where I have reservations), and hence
> it could go in ahead of them (or all alone)?

Yes, it's fully independent.

Thanks, Roger.



 


Rackspace

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