Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2101052rwb; Thu, 17 Nov 2022 06:35:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf5VdSSrGqNAABOo8PChAjbJe549320S0WzXGZcnBXPKNvKjg90WUCJus53Xuyvr7jmgLcZm X-Received: by 2002:a17:90b:2d90:b0:212:ca73:4d6b with SMTP id sj16-20020a17090b2d9000b00212ca734d6bmr8951335pjb.16.1668695733361; Thu, 17 Nov 2022 06:35:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668695733; cv=none; d=google.com; s=arc-20160816; b=WHn3EVlqL1eq+Qgx5iTIwE3kNZy91TEZ4vjRQvzmvFpBoOFW9o5rB428/ADrHOx4KT 8HiCIC4zp15GQKdD7C9UD4+DzC1xn04CaqmCyQgaNzVQRZOvKcGAOSOiYMlVVQK/Waxo KwTEj6MOylnvSpQnxUMUJOrofjGlsgw+NrIPtJlZ/vspgNSw7wh7qRT48w77JS7lZb5d 3QH+RDYBRmKRjcA1y1L8rMqL8cI5P2i/35PRE+/m+Swv57Tlix/KsPLGt8mlXLfkm4nD 9ml1v+9cY1Y9JqlWIed4vpecyMpcX2uKUvrEaQcOFxBi3eWzJdGKKXRpoSMmkmGiyyWX iLyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=VDHNMVouOnbd2BIm6kQ/z4TnyWsucBlyWGHOxBu8DFc=; b=ilgaFcle5QQuviN7LhP1BjRTMxKExHDwWfRfm6wCpS5FNl5yH9AXItog7N+DQrzT30 i01fldODw5Po+trzL4tDCP3MDu0MfMHRdAyz0mcCbzybndI0m+AJxXv+1t1Ua/tU3DU9 oz9Dgk+v3Dw+T666VtE61qszbJXKif98Dsq1rRUXJJB6CLONjeAha/Zy51YVW7Ml4KIE lJBYhNI5QhYs1FRGl+x9qXU+0XX05U1hMAKTJ7b1hBjcjFc2nzU6B4NLamcAVjBm0Eeq 4CW6mvn0Y12MVGvukEePUHvJXjWU8pkmhTWrRfXxSrN/3NOsViC4GE+OqFm3UIamZDzd ovOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@invisiblethingslab.com header.s=fm1 header.b=ExXLDel3; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=lyK9mBhv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mi11-20020a17090b4b4b00b0021409b2423esi5564669pjb.86.2022.11.17.06.35.21; Thu, 17 Nov 2022 06:35:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@invisiblethingslab.com header.s=fm1 header.b=ExXLDel3; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=lyK9mBhv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234861AbiKQOc4 (ORCPT + 93 others); Thu, 17 Nov 2022 09:32:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240193AbiKQOcJ (ORCPT ); Thu, 17 Nov 2022 09:32:09 -0500 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDC0E7723E for ; Thu, 17 Nov 2022 06:32:08 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 50CE532010D8; Thu, 17 Nov 2022 09:32:05 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 17 Nov 2022 09:32:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1668695524; x= 1668781924; bh=VDHNMVouOnbd2BIm6kQ/z4TnyWsucBlyWGHOxBu8DFc=; b=E xXLDel3Fni8lmKAgawxSh3Z/oU3G+BKkylnFPFTNvljw2oJj5RzS1q8bnkZsyGBI QJaAfOorKyEC8U7vaBpmiZtXTF2Q0sC1Ngb9HSZObf7SkqYxiclVjQnFjQqOx0fp DWxCiOjd/3grLfgNnJDJ2H2ZQwWaicyUT/ZGv0Q5IhNijwhqoSqifVMHU9LTSCku 1qGRPP0r1vGy102p/gelD15r232vUMXF/zBsARjAWpGp/aTkBDncBIheWZ+fNgZv dQzgAAMJt4mq54SR/fvqAvwpy8aUMC5rCYVTBg3Ps7Gn4uKOraU01pLOH5hbVOXs smx6OxgeaxDU71cFLFhDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1668695524; x=1668781924; bh=VDHNMVouOnbd2BIm6kQ/z4TnyWsu cBlyWGHOxBu8DFc=; b=lyK9mBhvya9ZvHyklUFqMDr5JZTcBk3uqUDidtaFZDnZ hqzLy5dnc9xJUQrmsni0UNCUo5k5E6jr6DTtq0nSD98qlP+r3LCiHD23uIoykxbo jD/0Dp4/jj5Zfs7aL+xfpuMwHPFf7CEuFOTgxzCv1pNPyvbqUGcctrI4NNZrjcqs hiA0WQ2rt0oQbXXkhoXj7rvuKs56gLLLYA+VG/LL6NIDQ4QL2b09pirYcrTYQ0lg EbDAJ/LnRQoC6gp3mz961h5+XWOhn54bDSJLtVjko0DNBVRi1OykYmRyCf/HIWEj POxo1vlvnmIrKie2ZeL+c8vLglcduSppGxcKCKkp7Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrgeekgdeigecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehgtderredttdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpefgudel teefvefhfeehieetleeihfejhfeludevteetkeevtedtvdegueetfeejudenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrghrmhgrrhgvkhes ihhnvhhishhisghlvghthhhinhhgshhlrggsrdgtohhm X-ME-Proxy: Feedback-ID: i1568416f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 17 Nov 2022 09:32:03 -0500 (EST) Date: Thu, 17 Nov 2022 15:32:00 +0100 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Jan Beulich Cc: linux-kernel@vger.kernel.org, Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , "moderated list:XEN HYPERVISOR INTERFACE" , David Vrabel Subject: Re: [PATCH] xen-pciback: Consider MSI-X enabled only when MASKALL bit is cleared Message-ID: References: <20221117114122.1588338-1-marmarek@invisiblethingslab.com> <0afe3f35-1b25-d1c6-89bb-8dae7a4070e9@cantab.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hsWQDkJqLvEsIMcB" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --hsWQDkJqLvEsIMcB Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Thu, 17 Nov 2022 15:32:00 +0100 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Jan Beulich Cc: linux-kernel@vger.kernel.org, Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , "moderated list:XEN HYPERVISOR INTERFACE" , David Vrabel Subject: Re: [PATCH] xen-pciback: Consider MSI-X enabled only when MASKALL bit is cleared On Thu, Nov 17, 2022 at 02:33:16PM +0100, Jan Beulich wrote: > On 17.11.2022 14:13, Marek Marczykowski-G=C3=B3recki wrote: > > On Thu, Nov 17, 2022 at 12:54:51PM +0000, David Vrabel wrote: > >> On 17/11/2022 11:41, Marek Marczykowski-G=C3=B3recki wrote: > >>> Linux enables MSI-X before disabling INTx, but keeps MSI-X masked unt= il > >>> the table is filled. Then it disables INTx just before clearing MASKA= LL > >>> bit. Currently this approach is rejected by xen-pciback. > >>> Allow setting PCI_MSIX_FLAGS_ENABLE while INTx is still enabled as lo= ng > >>> as PCI_MSIX_FLAGS_MASKALL is set too. > >> > >> The use of MSI-X interrupts is conditional on only the MSI-X Enable bi= t. > >> Setting MSI-X Enable effectively overrides the Interrupt Disable bit i= n the > >> Command register. > >=20 > > That means the second chunk of the patch may even drop the '(new_value & > > PCI_MSIX_FLAGS_MASKALL)' part, right?=20 > >=20 > >> PCIe 6.0.1 section 7.7.2.2. "MSI-X Enable ... is prohibited from using= INTx > >> interrupts (if implemented)." And there is similar wording for MSI Ena= ble. > >=20 > > And this would mean the 'field_config->int_type =3D=3D INTERRUPT_TYPE_M= SIX' > > part isn't necessary either. > >=20 > > Jan in another thread pointed out that disabling INTx explicitly is > > still a useful workaround for a flawed hardware. But if that isn't > > mandated by the spec, maybe it doesn't need to be enforced by pciback > > either? >=20 > Well, allowing a device to go into a mode exhibiting undefined behavior > is what we ought to prevent when it comes to a DomU doing so vs overall > host safety. If the spec prohibits using INTx if MSI/MSI-X is enabled (regardless of PCI_COMMAND_INTX_DISABLE bit), then well-behaving device should be fine (we aren't hitting undefined behavior). As for buggy device, it wouldn't be much different from a device ignoring PCI_COMMAND_INTX_DISABLE completely, no (besides the latter being probably much less probable bug)? If the above is assumption is correct, it seems such device may not function correctly without extra workarounds (which are in the driver interest to apply), but should not affect overall host safety (as in: beyond the guest having that device assigned). I think pciback should only enforce what's necessary to prevent one guest hurting others (or the hypervisor), but it doesn't need to prevent guest hurting itself. --=20 Best Regards, Marek Marczykowski-G=C3=B3recki Invisible Things Lab --hsWQDkJqLvEsIMcB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmN2ReEACgkQ24/THMrX 1yzzUQf/fRtFToxRDSo67Ei2SnzYd3QNLi4bA/SAL/6aFptPOlDlc9x5/3vcxPdP 9XXxKSV8XCpz1Ujxbq8jc2F04SBoQOblw8gOvxXzxLx8OF7r0wslheBBKCnd9p4L K75QUIBMp7FPdG5zZNlE0uEeDZXfZQEQWUe3ZkI3DwQEA0pNge2TQcFboJYCgo7u jFKA2HUoGKdIHXyOrq32dQA3MIQHGbKuOlh7amutgfjSGVHhf7mKWlicmrac1Xvg J51tmZU6hTUm/XXN9/NHqVCcPpC+umlxfAWi6wDcsUrS4upTT36fh3XWD3PO6twk XYA18LE0FTW2NIsUbImeFTak0mp2tw== =ahAp -----END PGP SIGNATURE----- --hsWQDkJqLvEsIMcB--