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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99DB9C36008 for ; Wed, 26 Mar 2025 14:53:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7867E28008B; Wed, 26 Mar 2025 10:53:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 70C76280088; Wed, 26 Mar 2025 10:53:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 587CD28008B; Wed, 26 Mar 2025 10:53:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 36286280088 for ; Wed, 26 Mar 2025 10:53:38 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 82FED160855 for ; Wed, 26 Mar 2025 14:53:38 +0000 (UTC) X-FDA: 83263996116.15.DD2964E Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) by imf18.hostedemail.com (Postfix) with ESMTP id C0EFB1C0015 for ; Wed, 26 Mar 2025 14:53:36 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=jDKWVb1L; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of 37xTkZwYKCO4iUQdZSWeeWbU.SecbYdkn-ccalQSa.ehW@flex--seanjc.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=37xTkZwYKCO4iUQdZSWeeWbU.SecbYdkn-ccalQSa.ehW@flex--seanjc.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743000816; a=rsa-sha256; cv=none; b=3lh9M81wgiNM90RGwBpm6BtRgeLMbP8d2z1tbiAKOSE/fhy4AYNcGEO/OS11mV1Ac3b5qE jQnsKgboOQOWQxpvte63KlLq4GlgluvP+ob2fg0QM06kO1B3ZKt5CBntO8RBBCW9B7uRrb +yV6PTTi5jE/7ocrnJtKIcxeLaMXyHE= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=jDKWVb1L; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of 37xTkZwYKCO4iUQdZSWeeWbU.SecbYdkn-ccalQSa.ehW@flex--seanjc.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=37xTkZwYKCO4iUQdZSWeeWbU.SecbYdkn-ccalQSa.ehW@flex--seanjc.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743000816; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LYuz+zY+9MTDf5KTG6gl5ifz+I238+i6zAPOdCI3LyY=; b=uvUPKTp0EoYQTMvDqE32rN14ubASxXc3VmmznjnWD0jXlFdHhfEBOp4W6Ow7Gf3bDU49z9 XOoc8X9gUmm+GrefvwfMTwNqT/RI9BiesulzwC+Gd2jzzi2f0TarKjlaJQPClAghR3txwF A0wVr22jJYyYxRa2Te7jUL9lvrLVtBU= Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-22403329f9eso100244945ad.3 for ; Wed, 26 Mar 2025 07:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1743000815; x=1743605615; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=LYuz+zY+9MTDf5KTG6gl5ifz+I238+i6zAPOdCI3LyY=; b=jDKWVb1LcUtIrycmvMYq36W6BJ8+JoVo2rVEh7I3sG+GIxyGcB4/cIZJ0WcNwweK28 3/ZWlHVBIa8VTbfgkOkcUsVc1KQKqBJ7DDB+ZdQ3n80kzWBg89E3xlZLkFk2jBnDZzTv cU/dPhPh2b0+ng1sIwAya1zjC1cogRYMSpOL56335vHporPxYcpg6dSQKdvAx6DNNdD1 xkv7VjxDRDBqpO7zxBQwMOoAzVH2naA0s5v+hk+hVjsxCf+AY1vTZXMHYsphSJIXEnMt tNx/gSCC1KrdCwGiXp/wObJ0v4gn/yZKV/nrNYvq7vdhs3lijj/SkadiAuWF0Afo0z+b 10gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743000815; x=1743605615; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LYuz+zY+9MTDf5KTG6gl5ifz+I238+i6zAPOdCI3LyY=; b=CK3tNoagUWTR1KYombR4QI1ptjrc7/08VYyvmTKT0WUozZRMT6hVu1eiECHpVdA0nQ 4BIdnVcnQrK+wBvejnvsqK804mrlYgZmJixvvFhuYpu3wOjJtumhl5vO9XtsrQhyGXrr 2DE7Cg4hbJpVZgbIh1CYn5ECMESH9/0ygBwYtRAMm/tN7+rbuodbm4AWJBmQK3HT43O0 3kFzM25l0Cz5AjeziQ0Y6+p5WmlHscKhJcYNV9xh8rWh3tlv/0OtiKdrlTWi7CPOGIsm oF6DiOpYsFQf7Fx3jSWlBL2/888dSaaSImnYGFDR2p3neJqluBiP2oA+lQKNMlbU7ZGB fuOw== X-Forwarded-Encrypted: i=1; AJvYcCXilaO3q3v8iycS5KJcPo5ReEz0kjvSXKisef7nNSX/uMjAbI4MIQhEEZQACnhDg8KQavu2vhTumw==@kvack.org X-Gm-Message-State: AOJu0Yx1Rfa3Z+HYeTdG5R+zACKUVgk0J/33CJo/jWQwxtK5Q4lPoZKk AXwzNMUHc8br8WRn7KY4F6QvGjTVjZLkZQ3FREYAjfYZ5vej7C/RLItvZKZZtxgWvpzSzME3oPQ mlw== X-Google-Smtp-Source: AGHT+IHVU+TN9kjlCemo9tNjMiVG/tGpBwU7pEuQb4ZMMbfYRfUmUXxSOBuTHhWOXzajakxNTBbnItO9Nyg= X-Received: from pfblk16.prod.google.com ([2002:a05:6a00:7210:b0:736:47b8:9b88]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:1885:b0:736:362a:6fc8 with SMTP id d2e1a72fcca58-73905a3b306mr29041774b3a.15.1743000815485; Wed, 26 Mar 2025 07:53:35 -0700 (PDT) Date: Wed, 26 Mar 2025 07:53:34 -0700 In-Reply-To: Mime-Version: 1.0 References: <86wmcmn0dp.wl-maz@kernel.org> <20250318125527.GP9311@nvidia.com> <20250318230909.GD9311@nvidia.com> <20250319170429.GK9311@nvidia.com> <20250319192246.GQ9311@nvidia.com> Message-ID: Subject: Re: [PATCH v3 1/1] KVM: arm64: Allow cacheable stage 2 mapping using VMA flags From: Sean Christopherson To: Ankit Agrawal Cc: Catalin Marinas , Jason Gunthorpe , Oliver Upton , Marc Zyngier , "joey.gouly@arm.com" , "suzuki.poulose@arm.com" , "yuzenghui@huawei.com" , "will@kernel.org" , "ryan.roberts@arm.com" , "shahuang@redhat.com" , "lpieralisi@kernel.org" , "david@redhat.com" , Aniket Agashe , Neo Jia , Kirti Wankhede , "Tarun Gupta (SW-GPU)" , Vikram Sethi , Andy Currid , Alistair Popple , John Hubbard , Dan Williams , Zhi Wang , Matt Ochs , Uday Dhoke , Dheeraj Nigam , Krishnakant Jaju , "alex.williamson@redhat.com" , "sebastianene@google.com" , "coltonlewis@google.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "ardb@kernel.org" , "akpm@linux-foundation.org" , "gshan@redhat.com" , "linux-mm@kvack.org" , "ddutile@redhat.com" , "tabba@google.com" , "qperret@google.com" , "kvmarm@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" X-Rspamd-Queue-Id: C0EFB1C0015 X-Stat-Signature: bjb97y5mkwixnca3sjtixmwsfz5jiizt X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1743000816-831307 X-HE-Meta: U2FsdGVkX1/uy50LszLXDQB45p8je1+w9eKQmmJb72d3qJ+7aHRfZRj3sT8gRrYUyETnpJZPLgVNIMNacypo2yODZpw2CbDdpmnTxjcl6QWmNhtsWjhPJOoI/kEl3u0wtDqPs1h/3BazDT91VCTVVVqHh8BsBaEHUgItpwrfIJAO6szinETCXCI6Y6P+J6aCSVs7N4LVdhQuKQ3S3e5fYxGpskhVNVjNaIiuGJvGYXE6GIWw68zb4FbN0OB1X8nNrJj5ExsxUXyhq3vWlPQD5i4OyU/k84QHCPI6CD61LqMr3kM3yJG0jnXtU81w7VspyOvsH0wFjccPt/TyUBpHGUUkKXytwH0JPy62VAM4olwmXptBu9VB0EHkp82iT2xZclfTiVDV922RPjQ46A2PkTyDT4Aw+/uRsGrecpc/SNF4z0J3oFn2QPZkNSojoWHYTDnmZZGEY5+3ahQurkswh3dBxzY1Ob1R/qS+Itfdd5GU8K6AcQBVBCqcuLduBO60SUusY054HEcPY35EoUwrUyaIGcAPdM4pCZL6aBaap1Y9nuF+L4hk/5CDedOy1Uqi+Q7W6iStakBAhzukZ0Tjgtk75gHowgbOEywM5lLz5Cf2pT4qojYw/gu5tv4lfyEcGF00BHYsDlHxoQHarcpFEtRgAjaOGioRvDWN5zEXt4ZtGQtTpcTkZ7PIMQGf6Wr85fx8LPunLpX/utC8Ih4lQZY+DSciCEQ1RAV7QbuQSCjWvHlP5I0pReyWs/FjFIuQ6rzh0qRvTu1ahlONS0XTgOwTNbFAFzP/gyzJPI3RDx/tLb284HA8MLilW3GfuaLrVHCTBsGp6aWrpg89Cqj7xFftJUl+6QZvjrwU1d31TX1Au5Kcfd7AWvT/EoLA0Im+I5j/2An6RssuvX4KZjdR29GLQZG3daCEvehA2YFqhr2/RrnfoPUJf8Kw+d5jDNcmZUChRqtsSkuEg6TZiea 7yNYqEL2 q/p0vRc8/aW+RokG950M51vKF7WYEJGRAZaZrGHe9eG44/xcY7Fk3co+2GsfT5CG2wJKqj6fsUiyl9R0F39nsVeydD8BgzsLBWO2LfnepB2sdbdMUXVSyhz07zIoJVUwOH9NJiDvttqsLxxAab0OPCCZdZihd/rTEbujVn/gVKIaz5XDwVJ6FDkyJmWmxKLYaNu4hY/dK5ldJUsYBjrOyqHfNclzAZK4/FkMLFUqsH/8UP08QB4bcKQKYH8tF/lrLFsgOTwpg+zassF9mqD8RCbxct3R9pNFPwhgGnha93r8fb3YLdCv8b1woBwXnbnaX5xVnXBlK/z7wjJXCPH3Xxva30eAAml9xo+a9kcQ+apBd3qw0+CEFGvKbCfUAudxvO0VnyOssD46NSCDhhwl2UaCE5pd6jaFUi1hGAthG/u8eYMbgun4UGxgcC7Ym1pkYsD237tQFY+/P5UHVYg0CfpJ12d3e/+jaIv06a1JcjDEFrNk5w1Hj8feg+RsV0NHzTTHJt0mfdKwrRwUrKHF/YZaSxMZymv50fEynzGL+acmalehwwKqJC/kO+McHtQW8n8ITlvZ7dkg/KrZbOE6G6poFd6qbR7oh8FefhRaA9ub4LlbJe1a+K7L97VsD1kLNANFu X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Mar 26, 2025, Ankit Agrawal wrote: > > On Wed, Mar 19, 2025 at 04:22:46PM -0300, Jason Gunthorpe wrote: > > > On Wed, Mar 19, 2025 at 06:11:02PM +0000, Catalin Marinas wrote: > > > > On Wed, Mar 19, 2025 at 02:04:29PM -0300, Jason Gunthorpe wrote: > > > > > On Wed, Mar 19, 2025 at 12:01:29AM -0700, Oliver Upton wrote: > > > > > > You have a very good point that KVM is broken for cacheable PFNMAP'd > > > > > > crap since we demote to something non-cacheable, and maybe that > > > > > > deserves fixing first. Hopefully nobody notices that we've taken away > > > > > > the toys... > > > > > > > > > > Fixing it is either faulting all access attempts or mapping it > > > > > cachable to the S2 (as this series is trying to do).. > > > > > > > > As I replied earlier, it might be worth doing both - fault on !FWB > > > > hardware (or rather reject the memslot creation), cacheable S2 > > > > otherwise. > > > > > > I have no objection, Ankit are you able to make a failure patch? > > > > I'd wait until the KVM maintainers have their say. > > > > Maz, Oliver any thoughts on this? Can we conclude to create this failure > patch in memslot creation? That's not sufficient. As pointed out multiple times in this thread, any checks done at memslot creation are best effort "courtesies" provided to userspace to avoid terminating running VMs when the memory is faulted in. I.e. checking at memslot creation is optional, checking at fault-in/mapping is not. With that in place, I don't see any need for a memslot flag. IIUC, without FWB, cacheable pfn-mapped memory is broken and needs to be disallowed. But with FWB, KVM can simply honor the cacheability based on the VMA. Neither of those requires a memslot flag. A KVM capability to enumerate FWB support would be nice though, e.g. so userspace can assert and bail early without ever hitting an ioctl error. If we want to support existing setups that happen to work by dumb luck or careful configuration, then that should probably be an admin decision to support the "unsafe" behavior, i.e. an off-by-default KVM module param, not a memslot flag.