From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BFE0C433DF for ; Mon, 15 Jun 2020 16:05:14 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 495A12078A for ; Mon, 15 Jun 2020 16:05:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YH8MbmfZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 495A12078A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jkrbZ-0003sn-RP; Mon, 15 Jun 2020 16:05:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jkrbZ-0003si-3H for xen-devel@lists.xenproject.org; Mon, 15 Jun 2020 16:05:01 +0000 X-Inumbo-ID: f6ebf056-af21-11ea-b7bb-bc764e2007e4 Received: from mail-ed1-x542.google.com (unknown [2a00:1450:4864:20::542]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f6ebf056-af21-11ea-b7bb-bc764e2007e4; Mon, 15 Jun 2020 16:05:00 +0000 (UTC) Received: by mail-ed1-x542.google.com with SMTP id t21so11914879edr.12 for ; Mon, 15 Jun 2020 09:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-transfer-encoding:content-language :thread-index; bh=r8Uw0NEWGA4mNyeaEWdZRA2DF+M+XYvNd7arhcyLIPg=; b=YH8MbmfZT5l1CxsHbFPjVFNxFFmzH8bLHGSJlFNR/lb273PQi0wsklznSZ+8l/hpFb a3L3x80UvWgodBeUxyRAXXGZZSUH5scVA+XCHYn+b6H8eOgWfv9Stk3SifqFeyJZjZ8+ oIpzOXxbTPSGmWx3aSOp3CRIC+Ma2wlzlqmo3XUVmjSRrdIhK77bxiRgQXlqIg+6hb5y MlrpYTX6rBdauqvOZTnvlW5EJdzNyVvvxvYCDef0Guqhn9V8IG3kYvaHvfnsGvjFluY0 2Iy5DRXiiCXJIHZEBGgM1GfinItXpCEDQftdAjc3PZ6spWI8dTTuv/1g3XF047LgQC7j /oSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:to:cc:references:in-reply-to :subject:date:message-id:mime-version:content-transfer-encoding :content-language:thread-index; bh=r8Uw0NEWGA4mNyeaEWdZRA2DF+M+XYvNd7arhcyLIPg=; b=mfiUnhfhPApXTXsiwI4iWVz0MOHGV8h5qf5x5b2VOp484P28LH4Mc2RBA+25pswcXg aFEs41wnoN9cJm1cZnyvZ89Cnp71On23hiXYlBP5RdrE4jqi495Mn+OClpj08xA9RL91 mX6igz88sVZi5uk/Lh+ZbE40rOH7Bm+Ma6P2uKtKB8eZh275Hxn0aNFF79KA7BCAJBrJ UPJvKf25eln49iyadIp3yHh+mJ2T271QXmXnqtfb0Jo+94BNlUxWNEV3uj9GrooDrCTT DZGXWeE0D4zClmuVkke2Cm9JCT78dO7nLc9sXNOLsQNmvgxYSeTv7GGUhUMQMBwjCIR/ 6+ow== X-Gm-Message-State: AOAM531aFBtmgVAvRBsC1MrUCv+wrEcdbSr6hh3bXWThw4nPYxAxkgRc CGU3kWKspAyuus1Z5b5FOiw= X-Google-Smtp-Source: ABdhPJzMR2aoI/ot0cCAz4BNCYeiMpqDNIl7Z+V8x15JvqUclNNUEm4rrqbUKaE4483jmSty5OGgbw== X-Received: by 2002:a50:f289:: with SMTP id f9mr23897856edm.188.1592237099627; Mon, 15 Jun 2020 09:04:59 -0700 (PDT) Received: from CBGR90WXYV0 (54-240-197-234.amazon.com. [54.240.197.234]) by smtp.gmail.com with ESMTPSA id n35sm8751903edc.11.2020.06.15.09.04.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jun 2020 09:04:58 -0700 (PDT) From: Paul Durrant X-Google-Original-From: "Paul Durrant" To: =?UTF-8?Q?'Roger_Pau_Monn=C3=A9'?= , "'Ian Jackson'" References: <24295.36070.945693.791220@mariner.uk.xensource.com> <20200615155646.GI735@Air-de-Roger> In-Reply-To: <20200615155646.GI735@Air-de-Roger> Subject: RE: [PATCH] libxl: tooling expects wrong errno Date: Mon, 15 Jun 2020 17:04:57 +0100 Message-ID: <003001d6432e$b80d8a20$28289e60$@xen.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: en-gb Thread-Index: AQJRrVmR5Atw2cuOlpDTe0mFV6HHUQIpYa7PAtS50FGnuxEqwA== X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Reply-To: paul@xen.org Cc: 'Kevin Tian' , 'Wei Liu' , jakub@bartmin.ski, 'Andrew Cooper' , marmarek@invisiblethingslab.com, 'Grzegorz Uriasz' , 'Anthony Perard' , 'Jan Beulich' , j.nowak26@student.uw.edu.pl, xen-devel@lists.xenproject.org, contact@puzio.waw.pl Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" > -----Original Message----- > From: Roger Pau Monn=C3=A9 > Sent: 15 June 2020 16:57 > To: Ian Jackson > Cc: Grzegorz Uriasz ; Jan Beulich = ; Andrew Cooper > ; Kevin Tian ; Paul = Durrant ; Wei Liu > ; jakub@bartmin.ski; marmarek@invisiblethingslab.com; = j.nowak26@student.uw.edu.pl; Anthony > Perard ; xen-devel@lists.xenproject.org; = contact@puzio.waw.pl > Subject: Re: [PATCH] libxl: tooling expects wrong errno >=20 > On Mon, Jun 15, 2020 at 03:59:50PM +0100, Ian Jackson wrote: > > Grzegorz Uriasz writes ("[PATCH] libxl: tooling expects wrong = errno"): > > > When iommu is not enabled for a given domain then pci passthrough > > > hypercalls such as xc_test_assign_device return EOPNOTSUPP. > > > The code responsible for this is in "iommu_do_domctl" inside > > > xen/drivers/passthrough/iommu.c > > > This patch fixes the error message reported by libxl when = assigning > > > pci devices to domains without iommu. > > > > > > Signed-off-by: Grzegorz Uriasz > > > Tested-by: Grzegorz Uriasz > > > --- > > > tools/libxl/libxl_pci.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c > > > index 957ff5c8e9..bc5843b137 100644 > > > --- a/tools/libxl/libxl_pci.c > > > +++ b/tools/libxl/libxl_pci.c > > > @@ -1561,7 +1561,7 @@ void libxl__device_pci_add(libxl__egc *egc, = uint32_t domid, > > > LOGD(ERROR, domid, > > > "PCI device %04x:%02x:%02x.%u %s?", > > > pcidev->domain, pcidev->bus, pcidev->dev, = pcidev->func, > > > - errno =3D=3D ENOSYS ? "cannot be assigned - no = IOMMU" > > > + errno =3D=3D EOPNOTSUPP ? "cannot be assigned - = no IOMMU" > > > : "already assigned to a different guest"); > > > goto out; > > > } > > > > Thanks. I have addressed some Xen IOMMU maintainers. Can you = confirm > > whether this is right ? >=20 > Not an IOMMU maintainer myself, but I've taken a look at the code and > I think Grzegorz is right. iommu_do_domctl will return -EOPNOTSUPP if > the IOMMU is not enabled for the domain. Another option would be to > check for EBUSY (which will certainly be returned when the device is > busy) and log the error code with a message when it's different than > EBUSY? >=20 > There are many possible error here, for example the device itself > might not be behind an IOMMU, in which case Xen will return -ENODEV at > least on the Intel case. ENOSYS is certainly wrong; it should only be used to indicate an = unimplemented hypercall. I think Roger's suggestion of avoiding EBUSY = and use LOGED would be better though. Paul >=20 > Thanks, Roger.