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

Re: [PATCH 1/3] x86/msi: consistently handle BAR mapping failures in MSI-X setup


  • To: David Vrabel <dvrabel@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 11 Nov 2022 10:24:17 +0100
  • 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=CzH3s03D4qYTPtNr6CWCV/Oumo1cd+OBTpQQkCBljfM=; b=Jqgs74kTQMs3/WDNJpQDXIjOX6uazvDm2SznEEruhupMauQn1DJnKaS0y0h2ow/YnUUmOhFGN5fzQoxTslk2w/gYEmn5Prcd4aZUv3cRuagZ0TlVzpchDejtpZiGoNHoVeVS5R/WELWN5vwQzPeVo54VJvGdfDvr+qd7osmoGHmKXh5i42FU2IyceRBspy01F4vAVG0Pei2RaAmuy+FhH6Gr/4pBAcpN92Dea2QWi/SXcZH0mgmRU5i/j2riRymM0XkLFfnOJVwolkegQj4XsT9jXSHrz3q0oIilcNwyn24IiJ+B66SdpBDv7RkgMHBjy/kzdGWYtjE62HGcrnQv/w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h5WITQSkFKKCeKRQ7+J3/lgVqz4sifvmvSgia8tAgLRbenzGWgU9RVsJgMLsBDhoo7Ah0keLgF3h9G8kCb2ddniOONFJ81QLumo4dxO0kuX61BtpFPHAS71PPEiEBPV3xHYqZVGrVRBT5DCuWczn0ndeZajkrgCwp+tquQGRyig4J6sJdsdvOQKzccpyYiJ+5dNRTEPL+N17wJG1NHhpdYTxWG2VPvDmhVDfjDeo247WvWXlDi+EYhhaOhppDbFRR+kFjwI3NdaILKGtoF7QZtdaTIDHlQuTUCoUdttv3OrTlBJMkkuZWn//2zsbGzQM+/Qtit0ow4kuHQ2x8OASgA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, David Vrabel <dvrabel@xxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 11 Nov 2022 09:24:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 10.11.2022 17:59, David Vrabel wrote:
> When setting up an MSI-X vector in msix_capability_init() the error
> handling after a BAR mapping failure is different depending on whether
> the first page fails or a subsequent page. There's no reason to break
> working vectors so consistently use the later error handling
> behaviour.

"zap_on_error" can only be set when there were no working vectors yet
(msix->used_entries being zero), so I don't see what case this last
sentence describes. In fact it was the intention with "zap_on_error"
to leave previously set up vectors functional.

> The zap_on_error flag was added as part of XSA-337, beb54596cfda
> (x86/MSI-X: restrict reading of table/PBA bases from BARs), but
> appears to be unrelated to XSA-337 and is not useful because:
> 
> 1. table.first and pba.first are not used unless msix->used_vectors > 0.

This isn't true afaics. The condition around their setting up is involving
more than just ->used_vectors:

    if ( !msix->used_entries &&
         (!msi ||
          (is_hardware_domain(current->domain) &&
           (dev->domain == current->domain || dev->domain == dom_io))) )

Hence the associated "else if( !msix->table.first )" can also be taken
if msix->used_entries is zero. And in case of a failure we need to force
the error return there for DomU-s, which is achieved by clearing
msix->table.first on the error handling path you alter.

Furthermore I'd consider it bad practice to leave stale values on record.

> 2. Force disabling MSI-X in this error path is not necessary as the
>    per-vector mask is still still set.

I agree that we might be overly strict there, but to remove that
disabling you'd need to further prove that no other inconsistencies can
(later) result (this being on the safe side is where the connection to
the rest of the XSA-337 changes comes from, along with the desire to
not leave stale values around, as per above). Plus you'd want to justify
why this error path is different from others in the function where we
also disable MSI-X altogether (beyond the path you modify there's exactly
one error path where we don't, and I now wonder why I had done it like
that).

But then I may also be misunderstanding some of your intentions here.
The "consistently" in the title and the associated first sentence of the
description escape me for the moment: You're talking about things in
terms of pages, when the handling really is in terms of entries.

Jan



 


Rackspace

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