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 X-Spam-Level: X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55BFDC43461 for ; Fri, 4 Sep 2020 01:03:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 16ED0206B7 for ; Fri, 4 Sep 2020 01:03:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1bqrBFgG"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RAR6msvV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16ED0206B7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:Reply-To:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4VA7TjW8p2NSqiNqLTF31wvODOhAAlXat6O+B98Libw=; b=1bqrBFgG+HAn9o Ss/F7b2RaLnkdJ+lQ0D1RGe8A01qhBvrRreUkzEJ0jwm52ddmHSWlZzce66khry2Sb8254KVPbodp E+zBCrBb/6RbEDJyy21OYQm2k6qYah0LRn87KT9OWA2uhS92GkJx+CPf7ZyQkBCTPgIxkrdktfzyw T1cSMukkZjn56FBM1g8ZM67jwYjTLr8+g4r0ehhhjWXrK6htAJMpb53odnmeoa++yHI7/xJgjmHbN XhYA3MgQLnWHc/xaetZfQe60zQB/wxe0+ZvzHXCjuuIhVJ88ww4IVMO/M8K3cnA1YJmZ2IxyQqZQg wAAeYXQ6q3ePDdsOtpKg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kE078-00017U-U1; Fri, 04 Sep 2020 01:02:03 +0000 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120] helo=us-smtp-1.mimecast.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kE075-000173-Q9 for linux-arm-kernel@lists.infradead.org; Fri, 04 Sep 2020 01:02:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599181319; h=from:from:reply-to: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=iLeIPiws4G7aX/bY/3JypF9XxwhNJ2foyB1wMepr/2U=; b=RAR6msvVETZMkrCcOapEdTEZBaSq7gW1d0e8R+AdkdDoa7RMf5x39sC6JfL8jouk8pWwjM yKLTX5sQ7d/dGGqhCwbZj9TY/iemLcMeaONov/IAQdsEBQbpKZFLYytvRrb2xmChHKIxt0 fMarrGFJSCXE+T4BXkCM296mRZe/so4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-112-qtWmNGlgPGSdMKCwrruY-A-1; Thu, 03 Sep 2020 21:01:57 -0400 X-MC-Unique: qtWmNGlgPGSdMKCwrruY-A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C2C7D81F035; Fri, 4 Sep 2020 01:01:55 +0000 (UTC) Received: from [10.64.54.159] (vpn2-54-159.bne.redhat.com [10.64.54.159]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D7CA7E412; Fri, 4 Sep 2020 01:01:53 +0000 (UTC) Subject: Re: [PATCH v3 10/21] KVM: arm64: Add support for stage-2 page-aging in generic page-table To: Will Deacon References: <20200825093953.26493-1-will@kernel.org> <20200825093953.26493-11-will@kernel.org> <20200903164832.GB7791@willie-the-truck> From: Gavin Shan Message-ID: <8573bc7e-e54a-9714-4dbe-c7791f59953d@redhat.com> Date: Fri, 4 Sep 2020 11:01:51 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20200903164832.GB7791@willie-the-truck> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=gshan@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200903_210159_869196_687C756A X-CRM114-Status: GOOD ( 20.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Gavin Shan Cc: Suzuki Poulose , Marc Zyngier , Quentin Perret , James Morse , Catalin Marinas , kernel-team@android.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Will, On 9/4/20 2:48 AM, Will Deacon wrote: > On Thu, Sep 03, 2020 at 02:33:22PM +1000, Gavin Shan wrote: >> On 8/25/20 7:39 PM, Will Deacon wrote: >>> Add stage-2 mkyoung(), mkold() and is_young() operations to the generic >>> page-table code. >>> >>> Cc: Marc Zyngier >>> Cc: Quentin Perret >>> Signed-off-by: Will Deacon >>> --- >>> arch/arm64/include/asm/kvm_pgtable.h | 38 ++++++++++++ >>> arch/arm64/kvm/hyp/pgtable.c | 86 ++++++++++++++++++++++++++++ >>> 2 files changed, 124 insertions(+) > > [...] > >>> +static int stage2_update_leaf_attrs(struct kvm_pgtable *pgt, u64 addr, >>> + u64 size, kvm_pte_t attr_set, >>> + kvm_pte_t attr_clr, kvm_pte_t *orig_pte) >>> +{ >>> + int ret; >>> + kvm_pte_t attr_mask = KVM_PTE_LEAF_ATTR_LO | KVM_PTE_LEAF_ATTR_HI; >>> + struct stage2_attr_data data = { >>> + .attr_set = attr_set & attr_mask, >>> + .attr_clr = attr_clr & attr_mask, >>> + }; >>> + struct kvm_pgtable_walker walker = { >>> + .cb = stage2_attr_walker, >>> + .arg = &data, >>> + .flags = KVM_PGTABLE_WALK_LEAF, >>> + }; >>> + >>> + ret = kvm_pgtable_walk(pgt, addr, size, &walker); >>> + if (ret) >>> + return ret; >>> + >>> + if (orig_pte) >>> + *orig_pte = data.pte; >>> + return 0; >>> +} >>> + >> >> The @size is always 1 from the caller, which means the parameter >> can be dropped from stage2_update_leaf_attrs(). In the meanwhile, >> we don't know the page is mapped by PUD, PMD or PTE. So to have >> fixed value ("1") looks meaningless. > > I add extra callers later on, for example kvm_pgtable_stage2_wrprotect(), > which pass a size, so it's needed for that. > Yes, we still need @size in the subsequent patches. So this suggestion isn't valid. Thanks, Gavin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel