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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 C561DC4338F for ; Tue, 3 Aug 2021 10:44:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF61260F93 for ; Tue, 3 Aug 2021 10:44:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235594AbhHCKoV (ORCPT ); Tue, 3 Aug 2021 06:44:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235442AbhHCKoU (ORCPT ); Tue, 3 Aug 2021 06:44:20 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A312C06175F for ; Tue, 3 Aug 2021 03:44:08 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id o20so27604894oiw.12 for ; Tue, 03 Aug 2021 03:44:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yaNx5vDzglyO/0OfjHwfgJ9vhfDLVyx661pK/MAUsA8=; b=dVh6ktfKl/CmGwenXxBiuBj7rQKh2aljyeA1exgKoGSGKNgNYgcjYdawdaDKHH8nzn /BQL/xwjCvvlTq7RvVWJnDnlIVV/aZr4pzV3RLA9NNynINGSSKLWu6uARzGcwM3coHR8 Varoz0BHPMjUE80DcbiIsdcwPxx1SMgyWTYpagPD/PJZAyQGJt0zEz3y3EiIkg/el/ES oaCCFlt4a4J+tNoj6nFdSnwvLkeB/OAhLAhy7O4WdZn6S7DTXExr0zVWdaaB3hCP7pBW v5Yi/QTAA6jM5SPjTcOnBBlfX2vUWu1YZTjOOooTLlLd24h7plROwT2vsyroHVMAvuCo MzoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yaNx5vDzglyO/0OfjHwfgJ9vhfDLVyx661pK/MAUsA8=; b=RvOmhVHfKHR09xGN2znknzp86KwCq4DUHnY/vn5t0TnMHTRjEfnOCq8O8cDwqHVRWT MPpxDWNKSlsJvEmmC9xKWpiok3wmWE1tu0Wcf4oneI3v5u1VvzEPIx4m/YYwvM6vaY6A 4NVaX9xmVGqclrdXyPWku7MFZglVxgV0yt751KctBVGvfb6Z698gKTJj4f/kuvNPRJ9C FYGad+EOcnICmT9hC0KfD+N4BMdzJKL+sMaLMX0nUctNLW1OYnTssc8pQOahgLv0qBrl 6BBhLH6Ro0Xy6ycuQ9EWq6CQjKYuhOm1YcSczIasj0zCgBJdC/AO5Y2yZy21IeqkRe3i D+YQ== X-Gm-Message-State: AOAM532Lb9t1SL+YWhsUHUVrsgqFDS3EsnxLB/KP5xmTTvNYqfZPPbCX Yu22RlSRBolk6Wg9AmXGElXj63qOtzyewXUmuXOBP65u3ntFB0K1 X-Google-Smtp-Source: ABdhPJwYzCSdWjyi0pYSnKyyrs+IptK4BCpyosUrou0C9GbEJeZ1RjMGqStuxXt0pVyzMJHXXFxwuoId3kQv0IvjGUQ= X-Received: by 2002:aca:2102:: with SMTP id 2mr2456621oiz.67.1627987447441; Tue, 03 Aug 2021 03:44:07 -0700 (PDT) MIME-Version: 1.0 References: <20210729132818.4091769-1-qperret@google.com> <20210729132818.4091769-11-qperret@google.com> In-Reply-To: From: Fuad Tabba Date: Tue, 3 Aug 2021 12:43:30 +0200 Message-ID: Subject: Re: [PATCH v3 10/21] KVM: arm64: Enable forcing page-level stage-2 mappings To: Quentin Perret Cc: maz@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, ardb@kernel.org, qwandor@google.com, dbrazdil@google.com, kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Quentin, > > > +static bool stage2_block_mapping_allowed(u64 addr, u64 end, u32 level, > > > + struct stage2_map_data *data) > > > +{ > > > + if (data->force_pte && (level < (KVM_PGTABLE_MAX_LEVELS - 1))) > > > + return false; > > > > I'm not sure I understand why checking the level is necessary. Can > > there be block mapping at the last possible level? > > That's probably just a matter of naming, but this function is in fact > called at every level, just like kvm_block_mapping_supported() was > before. And we rely on it returning true at the last level, so I need to > do that check here. > > Maybe renaming this stage2_leaf_mapping_allowed() would clarify? Yes it would. Thanks, /fuad 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=-3.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 67E53C4338F for ; Tue, 3 Aug 2021 10:44:13 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id D4FF5600D4 for ; Tue, 3 Aug 2021 10:44:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D4FF5600D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 6A61449FE6; Tue, 3 Aug 2021 06:44:12 -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 bgZnI7JhnzSb; Tue, 3 Aug 2021 06:44:11 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 4DA664086F; Tue, 3 Aug 2021 06:44:11 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 4AC014086F for ; Tue, 3 Aug 2021 06:44:09 -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 TSs4KpQgXnch for ; Tue, 3 Aug 2021 06:44:08 -0400 (EDT) Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 3F88740623 for ; Tue, 3 Aug 2021 06:44:08 -0400 (EDT) Received: by mail-oi1-f177.google.com with SMTP id 26so9774750oiy.0 for ; Tue, 03 Aug 2021 03:44:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yaNx5vDzglyO/0OfjHwfgJ9vhfDLVyx661pK/MAUsA8=; b=dVh6ktfKl/CmGwenXxBiuBj7rQKh2aljyeA1exgKoGSGKNgNYgcjYdawdaDKHH8nzn /BQL/xwjCvvlTq7RvVWJnDnlIVV/aZr4pzV3RLA9NNynINGSSKLWu6uARzGcwM3coHR8 Varoz0BHPMjUE80DcbiIsdcwPxx1SMgyWTYpagPD/PJZAyQGJt0zEz3y3EiIkg/el/ES oaCCFlt4a4J+tNoj6nFdSnwvLkeB/OAhLAhy7O4WdZn6S7DTXExr0zVWdaaB3hCP7pBW v5Yi/QTAA6jM5SPjTcOnBBlfX2vUWu1YZTjOOooTLlLd24h7plROwT2vsyroHVMAvuCo MzoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yaNx5vDzglyO/0OfjHwfgJ9vhfDLVyx661pK/MAUsA8=; b=DINgMq8imjy2XAiNHPKUdmZqdx8RfuR6VZK5K4B5qrjN3wpuKPxDIs6QcVMAFGMYye g5wrNbUQi+Wh3NJueX8BbvU1g8XlnqHB4Fzk6HINZ1oRcOI/libo95rHxdi61wAskG5f +usZIkHSUXhhdGUV9zy7fBcwKusfpZPB5QktZ2sbHA0wXfsErhKU2kdZ7YiFIipLEeAn V8qdc9ILFQdGyAmy7YreyrDB8i7D/4hitq3ffGmespcaektpdXoNAansFBv2iy8vNOEC LUvTKyFb2oYR3ohBvM4AIqWPGiBjOPm08/9hCXl/oXpaJNmSvoYkLlIgaf2/al/uvIdr Wgqw== X-Gm-Message-State: AOAM531fjc5bLKhba1XW9vQAdx687xJQOfVTDEg2Ld355qC1QYqiDuKA ahqHoa3OLdP1vl16+vVGdHqb7zxR7RIRVUUGQbJsAQ== X-Google-Smtp-Source: ABdhPJwYzCSdWjyi0pYSnKyyrs+IptK4BCpyosUrou0C9GbEJeZ1RjMGqStuxXt0pVyzMJHXXFxwuoId3kQv0IvjGUQ= X-Received: by 2002:aca:2102:: with SMTP id 2mr2456621oiz.67.1627987447441; Tue, 03 Aug 2021 03:44:07 -0700 (PDT) MIME-Version: 1.0 References: <20210729132818.4091769-1-qperret@google.com> <20210729132818.4091769-11-qperret@google.com> In-Reply-To: From: Fuad Tabba Date: Tue, 3 Aug 2021 12:43:30 +0200 Message-ID: Subject: Re: [PATCH v3 10/21] KVM: arm64: Enable forcing page-level stage-2 mappings To: Quentin Perret Cc: kernel-team@android.com, qwandor@google.com, maz@kernel.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, 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 Hi Quentin, > > > +static bool stage2_block_mapping_allowed(u64 addr, u64 end, u32 level, > > > + struct stage2_map_data *data) > > > +{ > > > + if (data->force_pte && (level < (KVM_PGTABLE_MAX_LEVELS - 1))) > > > + return false; > > > > I'm not sure I understand why checking the level is necessary. Can > > there be block mapping at the last possible level? > > That's probably just a matter of naming, but this function is in fact > called at every level, just like kvm_block_mapping_supported() was > before. And we rely on it returning true at the last level, so I need to > do that check here. > > Maybe renaming this stage2_leaf_mapping_allowed() would clarify? Yes it would. Thanks, /fuad _______________________________________________ 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=-4.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 3BEF6C4338F for ; Tue, 3 Aug 2021 10:51:00 +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 0D9136056B for ; Tue, 3 Aug 2021 10:51:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0D9136056B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QlHSxvg9PrPyl5mxVjECRPdp91PHZkVZq6Q4uJmr4qM=; b=SDjUgWFhjAByRd 6XhojFsQTucgksXlYs2QDtgYnN8NaUbLGqVgC1dA4Rn+J3Rfr8tTBtftW3zNnjRrwbrnqXxCzv5p5 geSTQzSExt9Gtwe7gX9aq581AuW4BViNi1uQ/DWid/+VHLf1YZoBZtQw3EiHfGwj7y8OhXCNp3X4J +F75lWmGJFaxsZwJOnBQ6fUm1fdAQBcqc31AYZcvFfB1ZOoRYnvKex7r4lJ5ysA0Qcju0gMHZZ2Cd Nnw5R7Wq3GEU+mlYkXC3A5EJdqG6UTp7WzvUKf7ubvOuZu/xF09dlw08p8PdVXRS+wc10DujSr6mV uT+72wlnJwoCDeBLvnjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAryk-0029rq-LI; Tue, 03 Aug 2021 10:48:59 +0000 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAru7-00283i-QB for linux-arm-kernel@lists.infradead.org; Tue, 03 Aug 2021 10:44:13 +0000 Received: by mail-oi1-x22e.google.com with SMTP id n16so21083652oij.2 for ; Tue, 03 Aug 2021 03:44:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yaNx5vDzglyO/0OfjHwfgJ9vhfDLVyx661pK/MAUsA8=; b=dVh6ktfKl/CmGwenXxBiuBj7rQKh2aljyeA1exgKoGSGKNgNYgcjYdawdaDKHH8nzn /BQL/xwjCvvlTq7RvVWJnDnlIVV/aZr4pzV3RLA9NNynINGSSKLWu6uARzGcwM3coHR8 Varoz0BHPMjUE80DcbiIsdcwPxx1SMgyWTYpagPD/PJZAyQGJt0zEz3y3EiIkg/el/ES oaCCFlt4a4J+tNoj6nFdSnwvLkeB/OAhLAhy7O4WdZn6S7DTXExr0zVWdaaB3hCP7pBW v5Yi/QTAA6jM5SPjTcOnBBlfX2vUWu1YZTjOOooTLlLd24h7plROwT2vsyroHVMAvuCo MzoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yaNx5vDzglyO/0OfjHwfgJ9vhfDLVyx661pK/MAUsA8=; b=CQfhXiubAAaHZ+k+GpVkXd6BLVTBmmxzRuU3dszZq7txLGMl6MZ/dzkEvChAUbiC4P hyJjltrnatyEcXHM1vP1Q1AXXaEm/ozd4nHqQoVTXpLZuH+VcvdiPX6LiSOaH8+DLbYE EalyBsVQUOXa54mzM5qTepMp4pNDF2v+vXtHw5587rtjW7tRspE4iNf3b127vzXdhOzL OeJXE6RhJqbfRxRRMF+hmkqbvkeoSYlkMc5N3/Q9iAQy+ek1rDCYsfYQhAVvVvsIxuIR pPkCo6SC3D0kQnxkVTtG4mPyrFDiwQCV5NTwt5uKc+NkOC8Xt6Wc9k049Jzd075cdkgL h01Q== X-Gm-Message-State: AOAM530r1yaqa2w7mtoILzPlY6+ZjuftMss8x0Qxdxu8QJwqNTQELoKW YErvfL3zcFCUI2J/p4dG6L7MDbD5OGVMRJxGR0F2dA== X-Google-Smtp-Source: ABdhPJwYzCSdWjyi0pYSnKyyrs+IptK4BCpyosUrou0C9GbEJeZ1RjMGqStuxXt0pVyzMJHXXFxwuoId3kQv0IvjGUQ= X-Received: by 2002:aca:2102:: with SMTP id 2mr2456621oiz.67.1627987447441; Tue, 03 Aug 2021 03:44:07 -0700 (PDT) MIME-Version: 1.0 References: <20210729132818.4091769-1-qperret@google.com> <20210729132818.4091769-11-qperret@google.com> In-Reply-To: From: Fuad Tabba Date: Tue, 3 Aug 2021 12:43:30 +0200 Message-ID: Subject: Re: [PATCH v3 10/21] KVM: arm64: Enable forcing page-level stage-2 mappings To: Quentin Perret Cc: maz@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, ardb@kernel.org, qwandor@google.com, dbrazdil@google.com, kernel-team@android.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210803_034411_900539_D27D4B26 X-CRM114-Status: GOOD ( 15.18 ) 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 Hi Quentin, > > > +static bool stage2_block_mapping_allowed(u64 addr, u64 end, u32 level, > > > + struct stage2_map_data *data) > > > +{ > > > + if (data->force_pte && (level < (KVM_PGTABLE_MAX_LEVELS - 1))) > > > + return false; > > > > I'm not sure I understand why checking the level is necessary. Can > > there be block mapping at the last possible level? > > That's probably just a matter of naming, but this function is in fact > called at every level, just like kvm_block_mapping_supported() was > before. And we rely on it returning true at the last level, so I need to > do that check here. > > Maybe renaming this stage2_leaf_mapping_allowed() would clarify? Yes it would. Thanks, /fuad _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel