Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1677881rwb; Tue, 29 Nov 2022 17:38:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Zc6eYo6UL5vC3pGZ4+cpT0deYIWu9x8BtAR52GOtIhrMRSuuTvTE+I/vmPT/cFn4WD+x/ X-Received: by 2002:a17:90a:c712:b0:212:9625:c8e9 with SMTP id o18-20020a17090ac71200b002129625c8e9mr67988918pjt.128.1669772297050; Tue, 29 Nov 2022 17:38:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669772297; cv=none; d=google.com; s=arc-20160816; b=Eh1Xotj5skKUWgkLaJYnANhbtAQUfE3D9gnXwt6iKaraquZe/lS+eZVsugQ2b23d/d 86llKu2F2FE7RT8FFTP4/WC2IyNHGqKxsu5mHAVdhyz7VYTAbZoFvzHr29SCJbZoc1wY IyXuenPkzpC9AKksEsDO7mawXNyxnpNFvWwiKnuh3mYb0vSsD35IugklMcgjGpxek/40 d6ZmlpliFUlaEGcoixIwkzzdzINItjY6qnpJfKnAYknB+AnX2BsFctSNHAjgZvpKzksu gzDz8KYHlOLQecip3lHI0sWFBx1cEANIWPPlaYfhr4WA+hIdfbv7naVZt4Q1Vq0imHZ7 bpug== 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:dkim-signature; bh=ewUKpCuoaPzAR2fmrr+FD3H80AnrDry9LxbpWXLNvF4=; b=H0dTmPX4kYbm4DoC3UsMlcDExaQvHFojZAeXzzYjfnH82j49LiSZsPxy8oJrlAa1DE rb13UX7jxfTgblBpdyKgxFZ1RHW4wWyuKBrJqJ7pAdNrh5I1WlF+lvReZZ1/UBYjskzz HskL3MFs1T0e2WB5raPkohcXjifaddC4qD7BhYqLnCwocTszYKsS6e/TQh0CBmsNWR9M iQKGEVTbUHALdDuitFPLpx+/JLvhLeSiGoApJrdntwEFJiNkMipOQOZsMEdVGgCPhJ1k S0G5oSmT92PqbTUrTjGhepUQ1dkCcJvU6zJOBOu/4uvsILvPxUxlLPO3pgwn9fs3frEa j9RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=fb6DDgCa; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k70-20020a638449000000b00477c0bc4844si2595756pgd.135.2022.11.29.17.38.05; Tue, 29 Nov 2022 17:38:17 -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=@google.com header.s=20210112 header.b=fb6DDgCa; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231354AbiK3BX1 (ORCPT + 86 others); Tue, 29 Nov 2022 20:23:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbiK3BXZ (ORCPT ); Tue, 29 Nov 2022 20:23:25 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED7142F66C for ; Tue, 29 Nov 2022 17:23:24 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id jn7so15163925plb.13 for ; Tue, 29 Nov 2022 17:23:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ewUKpCuoaPzAR2fmrr+FD3H80AnrDry9LxbpWXLNvF4=; b=fb6DDgCaO06aAL+G5/T2sy0zhAJSlkluomnYowvIHNfrJbn2iaW5lHshIKewz5bOza ZaVgBpSB1cf2gMMANnU8K3AmjeUTIEKMNAbICy4G4jI4J2CpMNUvY/Js2ymp2Vkdcrpc I/d8R9iBlPs25vU0P4/h91XTk5DY/HLFSeS9bfgUuz+/VqMoOnk6kDmp8yWPVrf6tnND gTm4F2hpkbVA2broOTWoHcFoZM+TXUmFgKcJTGxHhtdYC50vDAMDfxB23yxt9I+Qq5xa Efw8DrsJ1oUnwHKABaYjsxPhyqo6wl960Zc0CTDg/x5TzQW5EkrrtjjLH6tEdMXomJIo QP7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ewUKpCuoaPzAR2fmrr+FD3H80AnrDry9LxbpWXLNvF4=; b=X2uYablb7xEnZh1sPsgtSa7v4iXFwhAp44wd2txE4h2anEjq3JmpdbFsp+mkJP+vhC RZ255ZKTgk3KJnEBQSmNI5ESAAzlzsvTb0iWveDcdwWLVe/HdWLYaMQ9WmQ1eUsu9xgp bsxHKNEr1+Z3H+HmIabl12WOrL2yTzoDdEYt4QR6csWB4brRvR/0V2MiDZ0tU2ecEBmY Lf0lzpR10qfPx7oeo4Wc2RghZUztJHuS5fUO3qb5ohyvV5Oa7CIJBhCPS7HMy3iPTPq8 V4eoWDzAXGIYfXIg2ZYDeQfy+3936d2Pqa26SO8TXlW244GvR9RxNBvzBlF4ynUOeIuD ScUw== X-Gm-Message-State: ANoB5pnK6AMnv/ALb7Y6/9kdW4n3XbjPHb1EVLPRx8Vsmcys4B4q+Cr1 TZIFVu+9S4SFutrVAl04MmfR7w== X-Received: by 2002:a17:902:db07:b0:189:9ee0:cca4 with SMTP id m7-20020a170902db0700b001899ee0cca4mr4412610plx.74.1669771404345; Tue, 29 Nov 2022 17:23:24 -0800 (PST) Received: from google.com (220.181.82.34.bc.googleusercontent.com. [34.82.181.220]) by smtp.gmail.com with ESMTPSA id z3-20020aa79903000000b0056da63c8515sm119230pff.91.2022.11.29.17.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Nov 2022 17:23:23 -0800 (PST) Date: Tue, 29 Nov 2022 17:23:20 -0800 From: Ricardo Koller To: Oliver Upton Cc: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] KVM: arm64: Don't serialize if the access flag isn't set Message-ID: References: <20221129191946.1735662-1-oliver.upton@linux.dev> <20221129191946.1735662-3-oliver.upton@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Tue, Nov 29, 2022 at 09:15:21PM +0000, Oliver Upton wrote: > Hi Ricardo, > > Thanks for having a look. > > On Tue, Nov 29, 2022 at 12:52:12PM -0800, Ricardo Koller wrote: > > On Tue, Nov 29, 2022 at 07:19:44PM +0000, Oliver Upton wrote: > > [...] > > > > + ret = stage2_update_leaf_attrs(pgt, addr, 1, KVM_PTE_LEAF_ATTR_LO_S2_AF, 0, > > > + &pte, NULL, 0); > > > + if (!ret) > > > + dsb(ishst); > > > > At the moment, the only reason for stage2_update_leaf_attrs() to not > > update the PTE is if it's not valid: > > > > if (!kvm_pte_valid(pte)) > > return 0; > > > > I guess you could check that as well: > > > > + if (!ret || kvm_pte_valid(pte)) > > + dsb(ishst); > > Thanks for catching this. > > Instead of pivoting on the returned PTE value, how about we return > -EAGAIN from the early return in stage2_attr_walker()? It would better > match the pattern used elsewhere in the pgtable code. That works, although I would use another return code (e.g., EINVAL)? as that's not exactly a "try again" type of error. > > -- > Thanks, > Oliver