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=-6.1 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FSL_HELO_FAKE,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 174FFC07E9B for ; Tue, 20 Jul 2021 10:38:27 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 848626113C for ; Tue, 20 Jul 2021 10:38:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 848626113C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 126F64B08E; Tue, 20 Jul 2021 06:38:26 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4gG+uAnDT1QL; Tue, 20 Jul 2021 06:38:25 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 113304B090; Tue, 20 Jul 2021 06:38:25 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9E68E4B087 for ; Tue, 20 Jul 2021 06:38:23 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aknMQCwumC2k for ; Tue, 20 Jul 2021 06:38:22 -0400 (EDT) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 8E87D4A5A0 for ; Tue, 20 Jul 2021 06:38:22 -0400 (EDT) Received: by mail-wr1-f52.google.com with SMTP id f17so25467054wrt.6 for ; Tue, 20 Jul 2021 03:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=S2sNXLvJ4dwORJ7M5/nfuYVqqM+rERqyTBGgtikYXaE=; b=mPoeiN3M2AOmzdQgoZ+DsS2PhTUq2lw5i1UCT1ddfJG9kUVbabmUf6v6T/MJAnkcik Ud4mVQ2cHb5Bg2HqtZvCddGuPnOeb8RhDgH3SzMzXKHj4uvX2jEN8Bw0VcGbglQe2Dsq vouf/5a7Mc3Pn/bkqJbHrfvkh70Dq9nxzGQBXEDXMaQzIFsYiHlqx2FuNizQXtVY7UNp Kv41e6ik1XPLx4m6TiqW4Ngp46rhtMgmWDFnv+zX1TtY4Da+Ls+n3zuQMIb5C0HXeGY9 c0JEnJGW7vgmMokunPk94EwP213E7vP7VRB1R/sKUjGSVeoOAqC0hBSVX+t0qmsR8XOf aT4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=S2sNXLvJ4dwORJ7M5/nfuYVqqM+rERqyTBGgtikYXaE=; b=m54NCaCDbW10GOTZU50mDnLZfIBMoAL7pPgiZi8rtucPm/nAFrG9uzURZlDuDEWWBE VXTQdF4fQAMrH5P7HaFgpggAGnJBY/UHGoY9wo1pN/5cyrjrjmcvgNrjxEaW2MAsNk2l pD1ntWr3ygfk4D0DAXyLpcvTEq+Ea1JcSRQ8KwFgCc9P5NW7E3MAWTM9M0Mz2Lpmjwto 9/D+NIRh6X+ZsQcm7jGh8OCsR6vI0VTRlyVxcqy25LoxCec+Rw3Wgf63wIiK/9zu17sc 4Z7OIVMnkCPgFMBXgp4o7Ixd4xdrpZagkqZMQ5nSkPjcRpH9JHXi9PtXzqrwTrz9is/w B4bw== X-Gm-Message-State: AOAM530odUA2hmpmoHOE4dzS0U33Btm0tQ8up9ujddxQUQ/rceT3+1A4 ooQVKjRGRmSG5xP/pnDZeFNF5g== X-Google-Smtp-Source: ABdhPJy7g7Xq2cQ/7zmh8X/o4J7TfkA9+eUT4oUX5FYEN6LxPQ9LUW/2mD3SHGS2l5+cFKz+ca5WyA== X-Received: by 2002:a5d:6992:: with SMTP id g18mr35879296wru.118.1626777501471; Tue, 20 Jul 2021 03:38:21 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:83e0:11ac:c870:2b97]) by smtp.gmail.com with ESMTPSA id a10sm22857100wrm.12.2021.07.20.03.38.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 03:38:20 -0700 (PDT) Date: Tue, 20 Jul 2021 11:38:17 +0100 From: Quentin Perret To: Marc Zyngier Subject: Re: [PATCH 03/16] KVM: arm64: Turn kvm_pgtable_stage2_set_owner into kvm_pgtable_stage2_annotate Message-ID: References: <20210715163159.1480168-1-maz@kernel.org> <20210715163159.1480168-4-maz@kernel.org> <871r7t9tgi.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <871r7t9tgi.wl-maz@kernel.org> Cc: kernel-team@android.com, kvm@vger.kernel.org, Srivatsa Vaddagiri , linux-kernel@vger.kernel.org, Shanker R Donthineni , will@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Tuesday 20 Jul 2021 at 11:21:17 (+0100), Marc Zyngier wrote: > On Tue, 20 Jul 2021 11:09:21 +0100, > Quentin Perret wrote: > > > > On Thursday 15 Jul 2021 at 17:31:46 (+0100), Marc Zyngier wrote: > > > @@ -815,7 +807,7 @@ int kvm_pgtable_stage2_set_owner(struct kvm_pgtable *pgt, u64 addr, u64 size, > > > .arg = &map_data, > > > }; > > > > > > - if (owner_id > KVM_MAX_OWNER_ID) > > > + if (!annotation || (annotation & PTE_VALID)) > > > return -EINVAL; > > > > Why do you consider annotation==0 invalid? The assumption so far has > > been that the owner_id for the host is 0, so annotating a range with 0s > > should be a valid operation -- this will be required when e.g. > > transferring ownership of a page back to the host. > > How do you then distinguish it from an empty entry that doesn't map to > anything at all? You don't, but that's beauty of it :) The host starts with a PGD full of zeroes, which in terms of ownership means that it owns the entire (I)PA space. And it loses ownership of a page only when we explicitly annotate it with an owner id != 0. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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=-7.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 DF46FC07E95 for ; Tue, 20 Jul 2021 10:39:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 AF34361003 for ; Tue, 20 Jul 2021 10:39:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF34361003 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.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=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fGoymKLXJ0fnwYxEYiARWNHugy4PgirjXj/L3mBm6vE=; b=mM+8AxC5QTPknh iiCEiplXeHJEmjXdLj/cgrvqmDoOfSn94au36gEnydpFx3SXll+E22PO8SDO1kGSKnmLlwmCWX+CI 7FjEHci7aALGInEaIUsn/qZ71Ct2n+iPxS0TK+VZhm4VEYUzrAaL8eZLEUfgWtWVELUvl3CkS7s8d p3nQXNK3ZAAHwO0/tKhvELceT6SLNtiUcD9InACb6NNYqmG+0V+C11FRvrZR90ckhh5nquaD3bLiF jqYSIGOVFo+gxa8LZGu8uZDryzo6Dqq/EjR6+NBTaKxW5uQfgETQ/vXWtFDm76J3eFynM7nv3GB+K 4LhlLYIzzMD22vwYMvFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m5n8t-00CY1o-L4; Tue, 20 Jul 2021 10:38:27 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m5n8p-00CY0a-9J for linux-arm-kernel@lists.infradead.org; Tue, 20 Jul 2021 10:38:24 +0000 Received: by mail-wr1-x434.google.com with SMTP id r11so25432854wro.9 for ; Tue, 20 Jul 2021 03:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=S2sNXLvJ4dwORJ7M5/nfuYVqqM+rERqyTBGgtikYXaE=; b=mPoeiN3M2AOmzdQgoZ+DsS2PhTUq2lw5i1UCT1ddfJG9kUVbabmUf6v6T/MJAnkcik Ud4mVQ2cHb5Bg2HqtZvCddGuPnOeb8RhDgH3SzMzXKHj4uvX2jEN8Bw0VcGbglQe2Dsq vouf/5a7Mc3Pn/bkqJbHrfvkh70Dq9nxzGQBXEDXMaQzIFsYiHlqx2FuNizQXtVY7UNp Kv41e6ik1XPLx4m6TiqW4Ngp46rhtMgmWDFnv+zX1TtY4Da+Ls+n3zuQMIb5C0HXeGY9 c0JEnJGW7vgmMokunPk94EwP213E7vP7VRB1R/sKUjGSVeoOAqC0hBSVX+t0qmsR8XOf aT4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=S2sNXLvJ4dwORJ7M5/nfuYVqqM+rERqyTBGgtikYXaE=; b=YhOMsLBVJQDMQ6d25/+Tt/d8o5hBA81ecR7LlwlVDGZ5F5LiZ2jDFH3k2wPOQZmPzd mYqOuFsrb4Y6YGAKkwMmIcAXN6U/f9Cx/h8VE0TKDbs0S4T6FKYz2Idq9anqUI/m856N 2BCNxIj01UD3wu+DkbT/s31JyWpa2ncgu8M3L+vniWSoP/xlJOggl6h67AzTQYNEaejf oprnHOWfYPeq7dBA0tSNxtroQyXaTuzfuqhr5F/H6+qBWbNcAb8B9R83SUoI01WthGlG 8QrO6nSvmABsUm1Q9HZF4gCk2Z81vJcq0CR+0exopuEwBGoVhEoITDSj/M3aDOyW6Tct TgKw== X-Gm-Message-State: AOAM5305t3E97i2NLIvXcJxKivrJMruPto3c2Wt1fSoKyumVlB+vfUlv CiyUJalbD8cVXUy7WLLOidEqjQ== X-Google-Smtp-Source: ABdhPJy7g7Xq2cQ/7zmh8X/o4J7TfkA9+eUT4oUX5FYEN6LxPQ9LUW/2mD3SHGS2l5+cFKz+ca5WyA== X-Received: by 2002:a5d:6992:: with SMTP id g18mr35879296wru.118.1626777501471; Tue, 20 Jul 2021 03:38:21 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:83e0:11ac:c870:2b97]) by smtp.gmail.com with ESMTPSA id a10sm22857100wrm.12.2021.07.20.03.38.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 03:38:20 -0700 (PDT) Date: Tue, 20 Jul 2021 11:38:17 +0100 From: Quentin Perret To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, will@kernel.org, dbrazdil@google.com, Srivatsa Vaddagiri , Shanker R Donthineni , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH 03/16] KVM: arm64: Turn kvm_pgtable_stage2_set_owner into kvm_pgtable_stage2_annotate Message-ID: References: <20210715163159.1480168-1-maz@kernel.org> <20210715163159.1480168-4-maz@kernel.org> <871r7t9tgi.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <871r7t9tgi.wl-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210720_033823_399764_C434DF82 X-CRM114-Status: GOOD ( 16.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tuesday 20 Jul 2021 at 11:21:17 (+0100), Marc Zyngier wrote: > On Tue, 20 Jul 2021 11:09:21 +0100, > Quentin Perret wrote: > > > > On Thursday 15 Jul 2021 at 17:31:46 (+0100), Marc Zyngier wrote: > > > @@ -815,7 +807,7 @@ int kvm_pgtable_stage2_set_owner(struct kvm_pgtable *pgt, u64 addr, u64 size, > > > .arg = &map_data, > > > }; > > > > > > - if (owner_id > KVM_MAX_OWNER_ID) > > > + if (!annotation || (annotation & PTE_VALID)) > > > return -EINVAL; > > > > Why do you consider annotation==0 invalid? The assumption so far has > > been that the owner_id for the host is 0, so annotating a range with 0s > > should be a valid operation -- this will be required when e.g. > > transferring ownership of a page back to the host. > > How do you then distinguish it from an empty entry that doesn't map to > anything at all? You don't, but that's beauty of it :) The host starts with a PGD full of zeroes, which in terms of ownership means that it owns the entire (I)PA space. And it loses ownership of a page only when we explicitly annotate it with an owner id != 0. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_IN_DEF_DKIM_WL 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 E6A67C07E95 for ; Tue, 20 Jul 2021 10:39:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D490A610F7 for ; Tue, 20 Jul 2021 10:39:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237104AbhGTJ7J (ORCPT ); Tue, 20 Jul 2021 05:59:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234895AbhGTJ6G (ORCPT ); Tue, 20 Jul 2021 05:58:06 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E528AC0613DC for ; Tue, 20 Jul 2021 03:38:22 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id t5so25424147wrw.12 for ; Tue, 20 Jul 2021 03:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=S2sNXLvJ4dwORJ7M5/nfuYVqqM+rERqyTBGgtikYXaE=; b=mPoeiN3M2AOmzdQgoZ+DsS2PhTUq2lw5i1UCT1ddfJG9kUVbabmUf6v6T/MJAnkcik Ud4mVQ2cHb5Bg2HqtZvCddGuPnOeb8RhDgH3SzMzXKHj4uvX2jEN8Bw0VcGbglQe2Dsq vouf/5a7Mc3Pn/bkqJbHrfvkh70Dq9nxzGQBXEDXMaQzIFsYiHlqx2FuNizQXtVY7UNp Kv41e6ik1XPLx4m6TiqW4Ngp46rhtMgmWDFnv+zX1TtY4Da+Ls+n3zuQMIb5C0HXeGY9 c0JEnJGW7vgmMokunPk94EwP213E7vP7VRB1R/sKUjGSVeoOAqC0hBSVX+t0qmsR8XOf aT4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=S2sNXLvJ4dwORJ7M5/nfuYVqqM+rERqyTBGgtikYXaE=; b=hi+VKwRXWOBsFjmY9+3C83tKejJhhV1jQlhHrJI0+l+BDsxpPYnLZl5kcAB9Zt34eJ qPfgrq+p5Y1/HY0EnQxaermkaNib7jXifZp6HNqqrSM9CSoPYD3dvhEzHDST6yqE5j9s 0p4e/aFDt1AYTiAjrxYIsEfUzy49Re2WC8QfMcjxkVz+9C1cfSJ82sPbOwqVZ8P1kDLC fG8oRNN8BoCtwslPQvHWfo/YfxCEfbovVqMHNmCYhLUsq9BSz/Luaf4bufEJYXQygqb2 XNOKBYtMcI8U4v/svNeXHawuECulTLie5NiyCqkckdVrr1QcjUdElTEL50XxOw0BLPif QBZQ== X-Gm-Message-State: AOAM531noL8loBLbweq7uOAC0Ig0aFENLWnQwCfHFBMXtzwkeV1zyCH1 Or9GjGg+v338lmLNIhmtRQZrVA== X-Google-Smtp-Source: ABdhPJy7g7Xq2cQ/7zmh8X/o4J7TfkA9+eUT4oUX5FYEN6LxPQ9LUW/2mD3SHGS2l5+cFKz+ca5WyA== X-Received: by 2002:a5d:6992:: with SMTP id g18mr35879296wru.118.1626777501471; Tue, 20 Jul 2021 03:38:21 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:83e0:11ac:c870:2b97]) by smtp.gmail.com with ESMTPSA id a10sm22857100wrm.12.2021.07.20.03.38.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 03:38:20 -0700 (PDT) Date: Tue, 20 Jul 2021 11:38:17 +0100 From: Quentin Perret To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, will@kernel.org, dbrazdil@google.com, Srivatsa Vaddagiri , Shanker R Donthineni , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH 03/16] KVM: arm64: Turn kvm_pgtable_stage2_set_owner into kvm_pgtable_stage2_annotate Message-ID: References: <20210715163159.1480168-1-maz@kernel.org> <20210715163159.1480168-4-maz@kernel.org> <871r7t9tgi.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <871r7t9tgi.wl-maz@kernel.org> Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Tuesday 20 Jul 2021 at 11:21:17 (+0100), Marc Zyngier wrote: > On Tue, 20 Jul 2021 11:09:21 +0100, > Quentin Perret wrote: > > > > On Thursday 15 Jul 2021 at 17:31:46 (+0100), Marc Zyngier wrote: > > > @@ -815,7 +807,7 @@ int kvm_pgtable_stage2_set_owner(struct kvm_pgtable *pgt, u64 addr, u64 size, > > > .arg = &map_data, > > > }; > > > > > > - if (owner_id > KVM_MAX_OWNER_ID) > > > + if (!annotation || (annotation & PTE_VALID)) > > > return -EINVAL; > > > > Why do you consider annotation==0 invalid? The assumption so far has > > been that the owner_id for the host is 0, so annotating a range with 0s > > should be a valid operation -- this will be required when e.g. > > transferring ownership of a page back to the host. > > How do you then distinguish it from an empty entry that doesn't map to > anything at all? You don't, but that's beauty of it :) The host starts with a PGD full of zeroes, which in terms of ownership means that it owns the entire (I)PA space. And it loses ownership of a page only when we explicitly annotate it with an owner id != 0.