From: Sander Eikelenboom Subject: Re: [PATCH for-4.5] call xc_domain_irq_permission before xc_domain_irq_permission Date: Fri, 23 Jan 2015 13:59:08 +0100 Message-ID: <16904023.20150123135908@eikelenboom.it> References: <4610426124.20141126210436@eikelenboom.it> <20141128164935.GA17910@zion.uk.xensource.com> <20141128170116.GB17910@zion.uk.xensource.com> <1868834068.20141128184004@eikelenboom.it> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: Ian Jackson , xen-devel@lists.xensource.com, Wei Liu , Ian Campbell List-Id: xen-devel@lists.xenproject.org Friday, January 23, 2015, 1:42:04 PM, you wrote: > On Mon, 1 Dec 2014, Stefano Stabellini wrote: >> xc_physdev_unmap_pirq might revoke the permission to map the irq from >> the domain causing the following xc_domain_irq_permission call to fail >> and return error (domain_pirq_to_irq returns 0). >> >> Call xc_domain_irq_permission first to prevent this from happening >> (xc_physdev_unmap_pirq calls irq_deny_access, that doesn't fail if the >> permission is already removed). >> >> This is a simple bug fix and I think should go in 4.5. >> >> Signed-off-by: Stefano Stabellini > This patch didn't actually make it into 4.5, but I think it should have. > We could at least apply to master now. Didn't Jan issue a patch for that in: http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=6fb3a07bc0ad656b5f76eb9fc961bcd1d3cace58 -- Sander >> diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c >> index 316643c..904d255 100644 >> --- a/tools/libxl/libxl_pci.c >> +++ b/tools/libxl/libxl_pci.c >> @@ -1288,14 +1290,14 @@ skip1: >> goto out; >> } >> if ((fscanf(f, "%u", &irq) == 1) && irq) { >> - rc = xc_physdev_unmap_pirq(ctx->xch, domid, irq); >> - if (rc < 0) { >> - LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_physdev_unmap_pirq irq=%d", irq); >> - } >> rc = xc_domain_irq_permission(ctx->xch, domid, irq, 0); >> if (rc < 0) { >> LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_domain_irq_permission irq=%d", irq); >> } >> + rc = xc_physdev_unmap_pirq(ctx->xch, domid, irq); >> + if (rc < 0) { >> + LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_physdev_unmap_pirq irq=%d", irq); >> + } >> } >> fclose(f); >> } >>