Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp371172rdb; Fri, 5 Jan 2024 12:44:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGbYp1PwmNeP+elpcegansc2LEZ81/0eNQg83w1xTyTDhRO2hLUqxNGcCBfRxCxGlooenN2 X-Received: by 2002:a05:6a00:4f19:b0:6d9:ecbc:14cd with SMTP id lb25-20020a056a004f1900b006d9ecbc14cdmr2351719pfb.0.1704487450973; Fri, 05 Jan 2024 12:44:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704487450; cv=none; d=google.com; s=arc-20160816; b=qW858YT69AN1y0b4lGzhiaLxBrKOB69h5gE9rSJEJjP1K7uOvRw72CD908BGpVi9KA ncKRJMI+U5ouY10vJL66wZVK6H1DnqWKf0iz8cBk1yMC1PKCIlnNFJG4Kn2d7cPy3Z+D n3XIPzjMf7lOrgwSwU2rd35do00cbBsE3EEnq9vFLiuUCjuGnCR68eQnyiLek0hj/C+R jN+VVwRkZAvCnjF83wLonzcXwX0d3byQ8OKSonG7HWfohWwrXmGBGdfwP7X6zQLnVm8T REMSmcAwKM16XOsSvXBBEwCvHZt9or6aP45QJgYd5wlQfekordjgw3M2ya4cnV5QM269 AWlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=YIgLwiupop3bcxFtQ1AH4pX9ofQaPh7Mzpc0S80SOXs=; fh=CWsE/raXt0kB/ZtQn1l+ADIMSlOykgClqg625cOViTQ=; b=rCqeiyz5YbPBrglyRO2y6q8FYAQCIpe8QdkU4yV+0T7cUwWkTwhWJFqRAYUDZQ139u yvTIyVUjlIxUAoivSX+zj/j072VBi6c/BnDgUMlByqx4Wara9RmdUeQ6wiMXEzbdZjgF LytDYrr5LTA0WZd9Iq/ZEo7+NHO+NhmdLn3OT/4V14+KrYStemmiEsigjV7MOs9PwqFU r+yzH3kGbCGXy3jlHI3HZgsfwKOJijIAfnBw+WZ3do9bg+r09yTR8MwMfcseAR7S5RVI BNCU7c8tpU4aQhocSRyKjPX3qc1cIDC+7GNUq6qIBnS1PUThDwXvKhu3vwilQWWwVvlf nZCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=XqyiIYzj; spf=pass (google.com: domain of linux-kernel+bounces-18348-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18348-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t21-20020a639555000000b005c6bc2367ebsi1768361pgn.216.2024.01.05.12.44.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 12:44:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18348-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=XqyiIYzj; spf=pass (google.com: domain of linux-kernel+bounces-18348-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18348-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 8D499284E4E for ; Fri, 5 Jan 2024 20:44:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D17A36AF9; Fri, 5 Jan 2024 20:42:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="XqyiIYzj" X-Original-To: linux-kernel@vger.kernel.org Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (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 49B8E364D4 for ; Fri, 5 Jan 2024 20:42:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Fri, 5 Jan 2024 20:42:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1704487358; 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: in-reply-to:in-reply-to:references:references; bh=YIgLwiupop3bcxFtQ1AH4pX9ofQaPh7Mzpc0S80SOXs=; b=XqyiIYzjEWK+lm3UJXl+Vepjb6r75wBWBi9XIOu99PHz4UoyFsf5hyJcpiTvig2PFZqfAa S8QYTaVvSX4WXvUncN3E9CeUPUh98X6eDHybtqCe7gwZPwEYwS8ILIbBFbc0Oq3mJLVPqB H5ExmHtEKBIoIc+f2+qjmPXgY/QWakI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Catalin Marinas Cc: Lorenzo Pieralisi , Jason Gunthorpe , ankita@nvidia.com, maz@kernel.org, suzuki.poulose@arm.com, yuzenghui@huawei.com, will@kernel.org, alex.williamson@redhat.com, kevin.tian@intel.com, yi.l.liu@intel.com, ardb@kernel.org, akpm@linux-foundation.org, gshan@redhat.com, linux-mm@kvack.org, aniketa@nvidia.com, cjia@nvidia.com, kwankhede@nvidia.com, targupta@nvidia.com, vsethi@nvidia.com, acurrid@nvidia.com, apopple@nvidia.com, jhubbard@nvidia.com, danw@nvidia.com, mochs@nvidia.com, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com Subject: Re: [PATCH v3 2/2] kvm: arm64: set io memory s2 pte as normalnc for vfio pci devices Message-ID: References: <20231208164709.23101-1-ankita@nvidia.com> <20231208164709.23101-3-ankita@nvidia.com> <20231212181156.GO3014157@nvidia.com> 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-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT On Thu, Dec 21, 2023 at 01:19:18PM +0000, Catalin Marinas wrote: [...] > > Apologies, I didn't mean to question what's going on here from the > > hardware POV. My concern was more from the kernel + user interfaces POV, > > this all seems to work (specifically for PCI) by maintaining an > > intentional mismatch between the VFIO stage-1 and KVM stage-2 mappings. > > If you stare at it long enough, the mismatch starts to look fine ;). > Even if you have the VFIO stage 1 Normal NC, KVM stage 2 Normal NC, you > can still have the guest setting stage 1 to Device and introduce an > architectural mismatch. These aliases have some bad reputation but the > behaviour is constrained architecturally. > > IMHO we should move on from this attribute mismatch since we can't fully > solve it anyway and focus instead on what the device, system can > tolerate, who's responsible for deciding which MMIO ranges can be mapped > as Normal NC. Fair enough :) The other slightly unsavory part is that we're baking the mapping policy into KVM. I'd prefer it if this policy were kept in userspace somehow, but there's no actual usecase for userspace selecting memory attributes at this point. > If we really want to avoid any aliases (though I think we are spending > too many cycles on something that's not a real issue), the only way is > to have fd-based mappings in KVM so that there's no VMM alias. After > that we need to choose between (2) and (3) since the VMM may no longer > be able to probe the device and figure out which ranges need what > attributes. These are the sorts of things I was more worried about. I completely agree that the patches are fine for relaxing the 'simple' PCIe use cases, I just don't want to establish the precedent that the kernel/KVM will be on the hook to work out more complex use cases that may require the composition of various mappings. But I'm happy to table that discussion until the usecase arises :) -- Thanks, Oliver