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

Re: [PATCH 1/5] x86/vPCI: tolerate (un)masking a disabled MSI-X entry


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 28 Dec 2020 19:24:07 +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=UFXoTKwokUNFL67JtthriUpbVVuEHjE1CFWaQMsXsEM=; b=mF5m8Q7GkTd9Ah5l7Fi93A5zSfe324yKD1AUAz4WQPUx2QY2bfXHVZJkeuI+7cEJ2JNtej3kc85FM2Y6SetLvkxY51khpMMdhQbcYr/fJips3iOY1d0EoZj/r8dIwJigoU87vu8yKa1dW0BCvtvfPsnGqEwdkWK7UF9TtHk0qA+RdjF9Bp3mPRdQNhvw/QUUq/NvPXGFJ3jBjledTryj+iLZ4rPo2iRLYCMFxJhiN+z5KMn3MRvAYXQxEkEi4EsArtZToIv+1EuAhO2mS+iRp3ReuhMMSTUwnD86IATzvjuYM0mGwbmiHh7XuczC/CtiCcnZfIpc4udikWn6nzqm4Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jXHYvzvr2PZtJwSIdx4lqsBqTXur6Okn1LoT/HFokKd5DIWk2jqfDVBkSm/fjmLg+hkCjdG25T6O2+dnN3O86jxvtBM7XSTKiZRxBlXidNIfGvUIxZxJglDESu/V9M3Ve3r/m3UgE7EzKpJjhErGiQIjtKWTea81o5mhit17+7P60C6QdQVRIMXTngB9E3Xdqq4M+VD5Ae7s1/Qa9ewrtvvMgoncDIksRmpBrPwGSuvVDIqmotKcN/0bmBZmms1v0lSIY2cxo8oVReZhZTtACjFzYqF3R9Yq6ejPeDp+gMAyCKj8MmRHCCbmG8Y/raCJeeJ0bYwZdnYMDaS+6HSWjg==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Manuel Bouyer <bouyer@xxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 28 Dec 2020 18:24:26 +0000
  • Ironport-sdr: G0MHHDGztW8jcpVC85qqgKHT74YdiMdmaHUOTZQTNNlBFLrmaybYIwt7qNZWULfTqIY/qEN3aZ NDrPCskRkmIc1e38iO5KOuGGFcuxxS8dOSifEPrcuLb8xkmBtxLDhK3holL5LAThlFsUu2iE+a rLBXQq9eIvpAwlEc9XitOeDRcJA0Jn7nGgN2H3agzzYZ1MFxryPvJUGVUv3eC3l5CaGjrEn4lP 7pQ7OwvxF6CnqWr8ifm/mDwGv0COFomZnrzzvHf2L0nIyeRo1gLZTYnvkGW+wwkdUtZuca1/M7 kc0=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Dec 07, 2020 at 11:36:38AM +0100, Jan Beulich wrote:
> None of the four reasons causing vpci_msix_arch_mask_entry() to get
> called (there's just a single call site) are impossible or illegal prior
> to an entry actually having got set up:
> - the entry may remain masked (in this case, however, a prior masked ->
>   unmasked transition would already not have worked),
> - MSI-X may not be enabled,
> - the global mask bit may be set,
> - the entry may not otherwise have been updated.
> Hence the function asserting that the entry was previously set up was
> simply wrong. Since the caller tracks the masked state (and setting up
> of an entry would only be effected when that software bit is clear),
> it's okay to skip both masking and unmasking requests in this case.

On the original approach I just added this because I convinced myself
that scenario was impossible. I think we could also do:

diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index 64dd0a929c..509cf3962c 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -357,7 +357,11 @@ static int msix_write(struct vcpu *v, unsigned long addr, 
unsigned int len,
          * so that it picks the new state.
          */
         entry->masked = new_masked;
-        if ( !new_masked && msix->enabled && !msix->masked && entry->updated )
+
+        if ( !msix->enabled )
+            break;
+
+        if ( !new_masked && !msix->masked && entry->updated )
         {
             /*
              * If MSI-X is enabled, the function mask is not active, the entry
@@ -470,6 +474,7 @@ static int init_msix(struct pci_dev *pdev)
     for ( i = 0; i < pdev->vpci->msix->max_entries; i++)
     {
         pdev->vpci->msix->entries[i].masked = true;
+        pdev->vpci->msix->entries[i].updated = true;
         vpci_msix_arch_init_entry(&pdev->vpci->msix->entries[i]);
     }

In order to solve the issue.

As pointed out in another patch, regardless of what we end up doing
with the issue at hand we might have to consider setting updated to
true in init_msix in case we want to somehow support enabling an entry
that has it's address and data fields set to 0.

> 
> Fixes: d6281be9d0145 ('vpci/msix: add MSI-X handlers')
> Reported-by: Manuel Bouyer <bouyer@xxxxxxxxxxxxxxx>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Manuel, can we get confirmation that this fixes your issue?

Thanks, Roger.



 


Rackspace

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