Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp129405lqc; Thu, 7 Mar 2024 12:21:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVd82R0imhkERzSqhwKUmP9UZZBIAFv+k6Rt+O3s8frhfhGzB/+K9cvmuDmiYy/HdeSta+/qSfvGFACvjpBVin5j18QZcv4NxMyVhCdtQ== X-Google-Smtp-Source: AGHT+IHk9QSYERf/5WWfc1McrE+DEQniT9p546MeQlLRDm+7k4menT6BcWM3tXnRBVY0+o5P9Xwv X-Received: by 2002:a17:902:ce8d:b0:1dc:b320:60d2 with SMTP id f13-20020a170902ce8d00b001dcb32060d2mr10169811plg.33.1709842918354; Thu, 07 Mar 2024 12:21:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709842918; cv=pass; d=google.com; s=arc-20160816; b=jUGznEmAwzfv4DKspNukUGud8CTIsRoNDDwQWgNlkPtQXkQK7n/PCiNNfeQeNjy/G1 dKNAau5eHil9mYNZRemle6LDYs5drZxiaDQp//n6XLT7iDbZEGofG0rqX5rtvxb/hAdv LN+mWzU9BjEigqdF5VBTZ6wid/eCW1CfoaXBZ/XFSSWvuKWHZ54v1JCe/ooMJlAnLgKu gQwLnO+6KciCf947WIs6NvaIl2uT/+Fu4+z784ZsJoDmxRQeOY5cj0POcIvQbv96KAEn a3LqvoZD21LEbPIwj5AxF9w8VN+GPnnApExl9y8nGvSK2Z5KGUr7miM/e8poeADJS6n8 BOUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=TabbR6fhpYCD09TE4BJb10XCjbbbQlcJP70V/fpmxt8=; fh=1uUNTyR/p7uCQ4eF9BFqbUaI0TdY/ai/3W+Mqrbl9qI=; b=B/cDfjw7OWxiqTvPxA0JpGTp8pP0Bs0ohNvXfQzQ+E9ZHDxx3WNgtonvpKSv4H/KiL uw40KoVaHXEEQ5KuCWd/oFHXyZf5ejb4wkSu7nuGbu1Sx2JP5P/46sG6xlgu6vqMAJRN xP/vSDeudX+3nbkdU5MXDNivIj55rWxRmHHBKrIfi3tHGgV+rJqb/BSZHqorUJC/GjM+ Llq82JHtXS/1LaJamJrIQWqOrSCEA23L900z3jAU4unkvAYNTEAuwUBKBlEECfOvJdIs 0evPn2m0kWw4NqQqLkAzStCbG1tvBIn8+0KHxufjSjUbboykNWg8HXlN1l3x4OEbp2+c P8QA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="CGau/35N"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-96181-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96181-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u1-20020a170902e80100b001dcfc0b6a42si10270002plg.180.2024.03.07.12.21.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 12:21:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96181-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="CGau/35N"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-96181-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96181-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0D31928176F for ; Thu, 7 Mar 2024 20:21:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20238139585; Thu, 7 Mar 2024 20:21:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CGau/35N" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7E101386A4 for ; Thu, 7 Mar 2024 20:21:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709842896; cv=none; b=oPEJy5SYfQJ3Sk84aATYok6gWDmIK8kbhn0wILRecK0MmWIj06G7ZHuNxeuXFyEtf1LbiUO04w1OpbbXFBTWpiQPDSx+Jcu8M8FM7WmfHDCoPxApIrPxO3CAhKoz2qIJTGyFcPnQmhrOZfTn1knvGrgyhy0ZNMUeXpurX7/0hU8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709842896; c=relaxed/simple; bh=qkAuaeGOA+K/jn50xyZamYK85gjUO7jxoiUIRTBCyro=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ipt/hW7eNXExFgDs9IG208xCVDcKteqx4kA0/UGFV3w0lXXsdhTL0VsRCnVs4fL74eoj+2N0qbvao5KlwleB3DrLu61sSxaXEO2i2xEsjhEeDaVN+4CYps8K5PVEmdGBqYTPvqJ2GYcrDNFCMntjP59zfG8hhD+56EPpFyBRNOA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CGau/35N; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709842893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TabbR6fhpYCD09TE4BJb10XCjbbbQlcJP70V/fpmxt8=; b=CGau/35NpYFx0tNPkjqsXIfxjYC+mMoyzkJ4PNWqavAiW7mmGNJBCycF/5ihkgT4xNHE1Z nOaEuTdwzVTl2c3zpfASn94wdrIFaSUEnfPlS5DIlPttw6gfsOZ8whIzMNjn3//n/3lJrq g4PY3KkD/sUMeBQlNkE/tPD8RpDAdaA= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-589-CW9kHMJpNvWtqesDfPFM8g-1; Thu, 07 Mar 2024 15:21:32 -0500 X-MC-Unique: CW9kHMJpNvWtqesDfPFM8g-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-7c887bcd6caso93075839f.3 for ; Thu, 07 Mar 2024 12:21:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709842891; x=1710447691; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TabbR6fhpYCD09TE4BJb10XCjbbbQlcJP70V/fpmxt8=; b=vIkoSqrA33DuUudIcYI0oMiY8a/MZUvXqlSb9ieEMOYVc1SaIN+Karm3UALj/lMAjR AqUb/n0ytLdeuOpZSvQUeheXQEksawfkBQtp94TN4bKj9rG/W/qV1BFt8cZ3liQRpAgq AuHEF/S1SM2CVod7q94j4xZjxGyfhum3onXT6KhXMw45LuTn/Itl1ZXezVySu+Uds9ei 8VNHDCH9P+McVsuINMdooz/xWnDLgyCg/2Fvajd+JMsNJtndo0Pb1zRIkuEYUhldwE1U kJvKVAWquSCu5lT7RWaXrfwXTSQMDACYhSuEJDzXQg5wnF1c6uJrD/DVw1mviPhB1QbU oFbA== X-Forwarded-Encrypted: i=1; AJvYcCVR59J0paihqet/lCnM8mBvZJMps5TyoUsMYB/Vl7bfe9d6wYI6gqJWC1JVMc7XxeFgEZYxWvOY6b9c11F24wrcW9eMegj9VO0Fp3cI X-Gm-Message-State: AOJu0Yxd0mQtjvx8kQ9+A5T5nqTGVja6QTPVON9Oux3TTvtOqJfGLXlh NcVqZOqxU5TKDULoXVe1GDpytSl5Zng/sKr91yLf1xH5iQLTEgaybHanYsq4jwaWxkBqlCeYa2p rC3G2Mtpa/MCWzIckK9NK/bdcArx93t5ENvTz+mK7KULyWxZ1plfu6nEhre682g== X-Received: by 2002:a05:6e02:1645:b0:365:2f3f:846 with SMTP id v5-20020a056e02164500b003652f3f0846mr24255067ilu.23.1709842891271; Thu, 07 Mar 2024 12:21:31 -0800 (PST) X-Received: by 2002:a05:6e02:1645:b0:365:2f3f:846 with SMTP id v5-20020a056e02164500b003652f3f0846mr24255048ilu.23.1709842891027; Thu, 07 Mar 2024 12:21:31 -0800 (PST) Received: from redhat.com ([38.15.36.11]) by smtp.gmail.com with ESMTPSA id i2-20020a056e02054200b00363a4b2a0ccsm4370000ils.7.2024.03.07.12.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 12:21:30 -0800 (PST) Date: Thu, 7 Mar 2024 13:21:29 -0700 From: Alex Williamson To: "Tian, Kevin" Cc: "kvm@vger.kernel.org" , "eric.auger@redhat.com" , "clg@redhat.com" , "Chatre, Reinette" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 2/7] vfio/pci: Lock external INTx masking ops Message-ID: <20240307132129.0585a4aa.alex.williamson@redhat.com> In-Reply-To: References: <20240306211445.1856768-1-alex.williamson@redhat.com> <20240306211445.1856768-3-alex.williamson@redhat.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 7 Mar 2024 08:37:53 +0000 "Tian, Kevin" wrote: > > From: Alex Williamson > > Sent: Thursday, March 7, 2024 5:15 AM > > > > Mask operations through config space changes to DisINTx may race INTx > > configuration changes via ioctl. Create wrappers that add locking for > > paths outside of the core interrupt code. > > > > In particular, irq_type is updated holding igate, therefore testing > > is_intx() requires holding igate. For example clearing DisINTx from > > config space can otherwise race changes of the interrupt configuration. > > > > Looks the suspend path still checks irq_type w/o holding igate: > > vdev->pm_intx_masked = ((vdev->irq_type == VFIO_PCI_INTX_IRQ_INDEX) && > vfio_pci_intx_mask(vdev)); > > Is it with assumption that no change of configuration is possible at > that point? Yes, I believe this is relatively safe because userspace is frozen at this point. That's not however to claim that irq_type is absolutely used consistently after this series. I just didn't see the other violations rise to the same level as the fixes in this series and wanted to avoid the distraction. I've stashed a number of patches that I'd eventually like to post as follow-ups to this series. Thanks, Alex