Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp834058rdg; Fri, 13 Oct 2023 02:32:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHWX7TdERU+dKqh1XzALSaOJepxu4cXJzbKJlr09FN9B18vymGBN63sFkyJibugfhxKwTyk X-Received: by 2002:a17:902:e88f:b0:1c5:cfd6:9e82 with SMTP id w15-20020a170902e88f00b001c5cfd69e82mr28617963plg.18.1697189521508; Fri, 13 Oct 2023 02:32:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697189521; cv=none; d=google.com; s=arc-20160816; b=qzjsDGYWUc0AA8R2PFwPHntrxYZEgmYH9K1BCSvz7fwoiFaHHYxYuiixi4NtcqjxS+ sKCkqZ+OHB9O/jvpPTuu5/DOieyFWK1UeuAJIAOgCd2O7Z4U+ZA1mTAfJ5MuHi398fHm yo3PEQhIUhiuESWPM5qFB3Nklj33armMByQ7vyAWD9o47q6eV3bzqhtVqBIy4yu/j5+a 4B+Tiye9MjC7zdVfKG1gEU3xroLKJOdwrXEbv/kkrx7w8/fndi87GsyjutCebSCCTm+T GaLK+KiS/VZdvpqJUZz1m9m0LdsgVMt1aHd8r8jExXLr2yyZMkvPXHjeu4dQgcDXoLLU fvBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Y+ZUM6aPVYKiPoow6Rk2Owp8HsWpqSPRnTLT5n6YT6Y=; fh=J7iLzNj1wt8gyijTI3WmLVg6dqRS7qqV+3pCPBUhNis=; b=kJm0bJrCJvNEvsgcNknOeuosMmQr5wj+jsOLEg7o44yEPTd1PFEd5jRBeKZ0b+p8LX KTcNx3D/KvKvpfYXqA3Os+yqmcfVpU03LyIqw174pZselSYOqEj/thX4QnNPeGo11fHa IPPsiUeecaKPrj7zjaRMyy9gBOR3Yjg+nFBF5SP/ygx/2tFkthjt8lZX+BkW7vsWQrSN pCN+/vMSXGkKcNkKVKk/izdzaKY51bhcX1czs5SncY9REmWbCkCo6WIHWbbCti7xeLzP 4v0NRTjjerf7BNUvDnT2MRsNu5KQIfh8Tqarup6WcJXaWoH/9KSOZItKmIJ9ROiLBnmO j+5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UCDlKR0u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id h6-20020a170902748600b001c3e9170068si3809521pll.61.2023.10.13.02.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 02:32:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UCDlKR0u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id EEDFC8082042; Fri, 13 Oct 2023 02:30:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230519AbjJMJaF (ORCPT + 99 others); Fri, 13 Oct 2023 05:30:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230475AbjJMJaE (ORCPT ); Fri, 13 Oct 2023 05:30:04 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86B59BE for ; Fri, 13 Oct 2023 02:30:02 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7C22C433C8; Fri, 13 Oct 2023 09:29:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697189402; bh=f7do+dpudNZPy0yWryXE+ho+/1AmjqbHW/++9cnKmVM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UCDlKR0u2gWn+VGKL+Xw0nM+aPj09j749/NPPfpzHYQkmACi93tfi4+bChNwRg7sv Am+NE49hZdohDMRnY9SX0uO/c05BUTQEXBZ/4tytq8+9fOY9pkinQ3j8KPdynNMaWB y08VdhetBOBFoqZNET2jqfRuMNFFF/x5igTsHwhiNWfQI/OnOtDjV0j0E9lnQUv42m g/r3iv9TPRZXpEvwyXUyRkcpgJr02Lp/0+NIITcUM8CczLjY32ES19KwIFqvyiF92Y JAq8/qmrNHtzrSWEGu++z0JwaJhiL2Ntp9rhD3u2y5HKd4DBihztObUADnTGilPl7X 7J8MpnZb+38LA== Date: Fri, 13 Oct 2023 10:29:55 +0100 From: Will Deacon To: Jason Gunthorpe Cc: Catalin Marinas , Lorenzo Pieralisi , ankita@nvidia.com, maz@kernel.org, oliver.upton@linux.dev, 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, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 2/2] KVM: arm64: allow the VM to select DEVICE_* and NORMAL_NC for IO memory Message-ID: <20231013092954.GB13524@willie-the-truck> References: <20231012123541.GB11824@willie-the-truck> <20231012144807.GA12374@willie-the-truck> <20231012154439.GM3952@nvidia.com> <20231012163931.GA12592@willie-the-truck> <20231012183624.GN3952@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231012183624.GN3952@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 13 Oct 2023 02:30:16 -0700 (PDT) On Thu, Oct 12, 2023 at 03:36:24PM -0300, Jason Gunthorpe wrote: > On Thu, Oct 12, 2023 at 05:39:31PM +0100, Will Deacon wrote: > > > All I'm asking for is justification as to why Normal-NC is the right > > memory type rather than any other normal memory type. If it's not possible > > to explain that architecturally, then I'm not sure this change belongs in > > architecture code. > > Well, I think Catalin summarized it nicely, I second his ask at the end: > > We are basically at your scenario below - can you justify why > DEVICE_GRE is correct today, architecturally? We could not. Earlier > someone said uncontained failure prevention, but a deep dive on that > found it is not so. This logic can be used to justify the use of any other memory type. I'm asking specifically why Normal-NC is correct. > > Ultimately, we need to be able to maintain this stuff, so we can't just > > blindly implement changes based on a combination of off-list discussions > > and individual product needs. For example, if somebody else rocks up > > tomorrow and asks for this to be Normal-writethrough, what grounds do > > we have to say no if we've taken this change already? > > Hmm. Something got lost here. Well, I didn't assume FWB since these patches change the behaviour regardless... > This patch is talking about the S2 MemAttr[3:0]. There are only 4 > relevant values (when FEAT_S2FWB) (see D5.5.5 in ARM DDI 0487F.c) > > 0b001 - Today: force VM to be Device nGnRE > > 0b101 - Proposed: prevent the VM from selecting cachable, allow it to > choose Device-* or NormalNC > > 0b110 - Force write back. Would totally break MMIO, ruled out > > 0b111 - Allow the VM to select anything, including cachable. > This is nice, but summarizing Catalin's remarks: > a) The kernel can't do cache maintenance (defeats FWB) > b) Catalin's concerns about MTE and Atomics triggering > uncontained failures > c) It is unclear about uncontained failures for cachable > in general > > So the only argument is 001 v 110 v 111 Ok, so I can see why you end up with Normal-NC on a system that implements FWB. Systems without FWB have other options, but you can reasonably argue that having consistent behaviour between the two configurations is desirable. Please can you add that to the commit message? I still don't understand how to reclaim an MMIO region that the guest has mapped Normal-NC (see the thread with Catalin). Will