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.4 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=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 5B8D9C4338F for ; Fri, 30 Jul 2021 16:56:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 41C5A60F26 for ; Fri, 30 Jul 2021 16:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230046AbhG3Q5B (ORCPT ); Fri, 30 Jul 2021 12:57:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229938AbhG3Q5A (ORCPT ); Fri, 30 Jul 2021 12:57:00 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC855C06175F for ; Fri, 30 Jul 2021 09:56:52 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id ds11-20020a17090b08cbb0290172f971883bso21713682pjb.1 for ; Fri, 30 Jul 2021 09:56:52 -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=NHmczmIzJufSB3Li/LucyxkDOJfl+luasFO2GMfh3i8=; b=EwcggOYo/KbZsqbv7CnLQji1AaGLnOh5sUY2NEpMi13aXZro2JK54VQT6EA0LGqEhp 1dUrc+sHK5QUBLJMqWCOkVhRORDMasbGc+TOD24B7tNkfpzuGSMo8PWaKmEy1U7xtHUx q2Tra7+g6UGs9nC/2zTwsRW3ZjjJMQUqLUuu86eJdfpsqEdwAhNF1wbUviE7h7v3e4No ZhEeZbFW48Wecy/exed5zVehY2v7yXNhQFiz7UAWuLehu8RXOsgutb5gJvvx4xh51f0m ch4nma24ljAdFeNIidkVIV4YCjh9zTv7Sz9NEIs3gib/XxkJ9DakVPEgZNpUgkRMS3f3 pmpQ== 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=NHmczmIzJufSB3Li/LucyxkDOJfl+luasFO2GMfh3i8=; b=R1IEbU2xepsuM6JzdIS4K0p9zAGAIqsJnnq+bi25XVJ8NcssPqg6qLEdk8Vkya1/CP XDvwSCAVqJxNYyFkxtU4xrVW2QiptXkgPzeN+GUcteCBnIofKGTcYOszOO3a9felKTdY IK2Vx6fWarCdRC2w6Hof6+dq5egb66A1AfGD8DpnfJrx50NelCc8hiyBnVtWWLEEXIQz Xb3YnQqCn2xFcepndo8ArRePqly3N2+voSIF+ifBQXCtS6CLepbcJ2GHAeSQg5onisT5 nRS4NASlNWdDZhdW7RZWko533w0c0Ym7ZE7ajMjsA+Fmd5nJhe8BY+5xIPhgxVYbz5o8 ryMA== X-Gm-Message-State: AOAM530QpHrLDL+GrAWCIPMsM5zH2ATXXqNEivlAi5lBhr9SABUoYPfM fdcN30jWEjKdbTGYKig6Ub/eog== X-Google-Smtp-Source: ABdhPJzWI6FoTcaZNj62M9u9nn73qB7KjElQlQVRB3Sn9a2CCf11QZlLRjOgsi/YapsBA2ELYgUCvw== X-Received: by 2002:a63:4e11:: with SMTP id c17mr3123982pgb.54.1627664212050; Fri, 30 Jul 2021 09:56:52 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id f3sm2904882pfe.123.2021.07.30.09.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jul 2021 09:56:51 -0700 (PDT) Date: Fri, 30 Jul 2021 16:56:47 +0000 From: Sean Christopherson To: Oliver Upton Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , Thomas Gleixner , Peter Zijlstra , Andy Lutomirski , linux-arm-kernel@lists.infradead.org, Peter Shier , Shakeel Butt , Guangyu Shi Subject: Re: [PATCH v2 3/3] KVM: arm64: Use generic KVM xfer to guest work function Message-ID: References: <20210729220916.1672875-1-oupton@google.com> <20210729220916.1672875-4-oupton@google.com> <878s1o2l6j.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 30, 2021, Oliver Upton wrote: > > On Fri, Jul 30, 2021 at 2:41 AM Marc Zyngier wrote: > > > > On Thu, 29 Jul 2021 23:09:16 +0100, Oliver Upton wrote: > > > @@ -714,6 +715,13 @@ static bool vcpu_mode_is_bad_32bit(struct kvm_vcpu *vcpu) > > > static_branch_unlikely(&arm64_mismatched_32bit_el0); > > > } > > > > > > +static bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu) > > > +{ > > > + return kvm_request_pending(vcpu) || > > > + need_new_vmid_gen(&vcpu->arch.hw_mmu->vmid) || > > > + xfer_to_guest_mode_work_pending(); > > > > Here's what xfer_to_guest_mode_work_pending() says: > > > > > > * Has to be invoked with interrupts disabled before the transition to > > * guest mode. > > > > > > At the point where you call this, we already are in guest mode, at > > least in the KVM sense. > > I believe the comment is suggestive of guest mode in the hardware > sense, not KVM's vcpu->mode designation. I got this from > arch/x86/kvm/x86.c:vcpu_enter_guest() to infer the author's > intentions. Yeah, the comment is referring to hardware guest mode. The intent is to verify there is no work to be done before making the expensive world switch. There's no meaningful interaction with vcpu->mode, on x86 it's simply more convenient from a code perspective to throw it into kvm_vcpu_exit_request(). 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.6 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 EE515C4338F for ; Fri, 30 Jul 2021 16:58:58 +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 BD73D60F01 for ; Fri, 30 Jul 2021 16:58:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BD73D60F01 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: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=q8aIQL8Be10CeuthRDIz/6B8aM7v7qEy84knHRScoho=; b=uEhxeEnuZ/qRYT ZFfX3iomJ6uz3fxhh3DAFO95KvNzKRtTTyVcuio4CiSbJlERN4eC5ans2F0XhidjoiRCabTet7apS L6/bG8TFyNMpOb6WILQhcbyl9VxmRnfpA7WyydAJrp0eKnrgK99B7xZn/68rSYl8C9lPXkVTYLAYF c2PZCkDIzNEyNQxIoiIerlP8Pqk0OPPqRreMPYvLiNdGFEcBVbOi4PEQ3/0Dtat2tnofPI//eS/zy CWFpUroLEEgfAEdzkSZOKMgCuMfZRK47jAMaL+rNdO46U6fUePH6j4VbeqjITZRu7qpmHuRIuRTTQ YanBKolJ0t4Ohcq7GSwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9Voj-009ahj-7B; Fri, 30 Jul 2021 16:57:01 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9Voe-009afB-8b for linux-arm-kernel@lists.infradead.org; Fri, 30 Jul 2021 16:56:57 +0000 Received: by mail-pj1-x1032.google.com with SMTP id l19so16179610pjz.0 for ; Fri, 30 Jul 2021 09:56:52 -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=NHmczmIzJufSB3Li/LucyxkDOJfl+luasFO2GMfh3i8=; b=EwcggOYo/KbZsqbv7CnLQji1AaGLnOh5sUY2NEpMi13aXZro2JK54VQT6EA0LGqEhp 1dUrc+sHK5QUBLJMqWCOkVhRORDMasbGc+TOD24B7tNkfpzuGSMo8PWaKmEy1U7xtHUx q2Tra7+g6UGs9nC/2zTwsRW3ZjjJMQUqLUuu86eJdfpsqEdwAhNF1wbUviE7h7v3e4No ZhEeZbFW48Wecy/exed5zVehY2v7yXNhQFiz7UAWuLehu8RXOsgutb5gJvvx4xh51f0m ch4nma24ljAdFeNIidkVIV4YCjh9zTv7Sz9NEIs3gib/XxkJ9DakVPEgZNpUgkRMS3f3 pmpQ== 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=NHmczmIzJufSB3Li/LucyxkDOJfl+luasFO2GMfh3i8=; b=LwoyAdniVRhRAnNYkAsPT/MYevdNLw2OyYu4qg9fkL2LfLZuvcHiNOLJ17tu7YAduX SKwq3wkqyNTzMWXUF77AsBqpLBnHCQjnG9quioG2MRj3oyq69EzCroqJFGT7cZ0E0wBw zcRm57+Nry7a2jq5bwCYCH51+/S9QvbO0zNgE3xnp29ldz4whha3RkFAU83yjz+f82Li E2WDgYAl3J7uCQopXBXpAqsQDbvPrbCaHXYtlDUp+G0oUil1XDsg3W8tL3pjOKNdN5Wi VvidkdbYzN7DlaxtH19IENT82F/Z5OGWOcz2jv9RpqwsymDKVPat3U0n6TVVNoqWxYj1 wynA== X-Gm-Message-State: AOAM530bp5mW3WdvfqhugMM0bUWIoZEXRbrr72g33rO3yTIs0L2pNtcp 8DgEFfQTTpD4GEnwH62aK84DEw== X-Google-Smtp-Source: ABdhPJzWI6FoTcaZNj62M9u9nn73qB7KjElQlQVRB3Sn9a2CCf11QZlLRjOgsi/YapsBA2ELYgUCvw== X-Received: by 2002:a63:4e11:: with SMTP id c17mr3123982pgb.54.1627664212050; Fri, 30 Jul 2021 09:56:52 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id f3sm2904882pfe.123.2021.07.30.09.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jul 2021 09:56:51 -0700 (PDT) Date: Fri, 30 Jul 2021 16:56:47 +0000 From: Sean Christopherson To: Oliver Upton Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , Thomas Gleixner , Peter Zijlstra , Andy Lutomirski , linux-arm-kernel@lists.infradead.org, Peter Shier , Shakeel Butt , Guangyu Shi Subject: Re: [PATCH v2 3/3] KVM: arm64: Use generic KVM xfer to guest work function Message-ID: References: <20210729220916.1672875-1-oupton@google.com> <20210729220916.1672875-4-oupton@google.com> <878s1o2l6j.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210730_095656_371161_9E381C24 X-CRM114-Status: GOOD ( 18.46 ) 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 Fri, Jul 30, 2021, Oliver Upton wrote: > > On Fri, Jul 30, 2021 at 2:41 AM Marc Zyngier wrote: > > > > On Thu, 29 Jul 2021 23:09:16 +0100, Oliver Upton wrote: > > > @@ -714,6 +715,13 @@ static bool vcpu_mode_is_bad_32bit(struct kvm_vcpu *vcpu) > > > static_branch_unlikely(&arm64_mismatched_32bit_el0); > > > } > > > > > > +static bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu) > > > +{ > > > + return kvm_request_pending(vcpu) || > > > + need_new_vmid_gen(&vcpu->arch.hw_mmu->vmid) || > > > + xfer_to_guest_mode_work_pending(); > > > > Here's what xfer_to_guest_mode_work_pending() says: > > > > > > * Has to be invoked with interrupts disabled before the transition to > > * guest mode. > > > > > > At the point where you call this, we already are in guest mode, at > > least in the KVM sense. > > I believe the comment is suggestive of guest mode in the hardware > sense, not KVM's vcpu->mode designation. I got this from > arch/x86/kvm/x86.c:vcpu_enter_guest() to infer the author's > intentions. Yeah, the comment is referring to hardware guest mode. The intent is to verify there is no work to be done before making the expensive world switch. There's no meaningful interaction with vcpu->mode, on x86 it's simply more convenient from a code perspective to throw it into kvm_vcpu_exit_request(). _______________________________________________ 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=-5.6 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 DB956C432BE for ; Sat, 31 Jul 2021 09:33:56 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 5AD5A61042 for ; Sat, 31 Jul 2021 09:33:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5AD5A61042 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 0D53B4A524; Sat, 31 Jul 2021 05:33:56 -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 fZ9MTHF6r-mv; Sat, 31 Jul 2021 05:33:54 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 01B0F4B08C; Sat, 31 Jul 2021 05:33:53 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 320804B0BA for ; Fri, 30 Jul 2021 12:56:54 -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 qjrWvKGNWbql for ; Fri, 30 Jul 2021 12:56:53 -0400 (EDT) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 2D38D4B0B3 for ; Fri, 30 Jul 2021 12:56:53 -0400 (EDT) Received: by mail-pj1-f54.google.com with SMTP id mt6so16140353pjb.1 for ; Fri, 30 Jul 2021 09:56:53 -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=NHmczmIzJufSB3Li/LucyxkDOJfl+luasFO2GMfh3i8=; b=EwcggOYo/KbZsqbv7CnLQji1AaGLnOh5sUY2NEpMi13aXZro2JK54VQT6EA0LGqEhp 1dUrc+sHK5QUBLJMqWCOkVhRORDMasbGc+TOD24B7tNkfpzuGSMo8PWaKmEy1U7xtHUx q2Tra7+g6UGs9nC/2zTwsRW3ZjjJMQUqLUuu86eJdfpsqEdwAhNF1wbUviE7h7v3e4No ZhEeZbFW48Wecy/exed5zVehY2v7yXNhQFiz7UAWuLehu8RXOsgutb5gJvvx4xh51f0m ch4nma24ljAdFeNIidkVIV4YCjh9zTv7Sz9NEIs3gib/XxkJ9DakVPEgZNpUgkRMS3f3 pmpQ== 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=NHmczmIzJufSB3Li/LucyxkDOJfl+luasFO2GMfh3i8=; b=PMGetXih5+807YJ58qoibodQy1gBfczs65zsLFx7oF2Wa0uhZ3ZVbJCkIMry3z2YCW SBTpkGl/jtIo7oDww2jjwyz+HHlP8yss25mR/xf9yvHv5Twhp2pe7QFpmfIbxWo1m3sQ dHwQnilrLBmcKnjsyXn2K9kl3vueByPR+RI2NGPVHKrFpbLvzeKhmaOrXdZ39KWFvZbT GSSZ6a7QdTQbdaaLGbY7DF/Kl2mJITZYGRb8tX5rhocPRgkArG4+k98kg4EEUa6j7QXr i83qeRzU1OpPsjSjPttyfsuUIhE+mlmJFz1pc1l0mH5crLlwxKnOHKhuP90ZHmEs4LOz A+mw== X-Gm-Message-State: AOAM531LBzvhLlkMcTK6ar4IbCAdQ4ZnKQgEhVWwzmBtjBgOK6MynHsD ihDfVZVMt+ctHG3ssqIPZNmRTA== X-Google-Smtp-Source: ABdhPJzWI6FoTcaZNj62M9u9nn73qB7KjElQlQVRB3Sn9a2CCf11QZlLRjOgsi/YapsBA2ELYgUCvw== X-Received: by 2002:a63:4e11:: with SMTP id c17mr3123982pgb.54.1627664212050; Fri, 30 Jul 2021 09:56:52 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id f3sm2904882pfe.123.2021.07.30.09.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jul 2021 09:56:51 -0700 (PDT) Date: Fri, 30 Jul 2021 16:56:47 +0000 From: Sean Christopherson To: Oliver Upton Subject: Re: [PATCH v2 3/3] KVM: arm64: Use generic KVM xfer to guest work function Message-ID: References: <20210729220916.1672875-1-oupton@google.com> <20210729220916.1672875-4-oupton@google.com> <878s1o2l6j.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailman-Approved-At: Sat, 31 Jul 2021 05:33:51 -0400 Cc: Shakeel Butt , kvm@vger.kernel.org, Peter Zijlstra , Marc Zyngier , Peter Shier , linux-kernel@vger.kernel.org, Guangyu Shi , Will Deacon , Andy Lutomirski , Catalin Marinas , Paolo Bonzini , Thomas Gleixner , 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 Fri, Jul 30, 2021, Oliver Upton wrote: > > On Fri, Jul 30, 2021 at 2:41 AM Marc Zyngier wrote: > > > > On Thu, 29 Jul 2021 23:09:16 +0100, Oliver Upton wrote: > > > @@ -714,6 +715,13 @@ static bool vcpu_mode_is_bad_32bit(struct kvm_vcpu *vcpu) > > > static_branch_unlikely(&arm64_mismatched_32bit_el0); > > > } > > > > > > +static bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu) > > > +{ > > > + return kvm_request_pending(vcpu) || > > > + need_new_vmid_gen(&vcpu->arch.hw_mmu->vmid) || > > > + xfer_to_guest_mode_work_pending(); > > > > Here's what xfer_to_guest_mode_work_pending() says: > > > > > > * Has to be invoked with interrupts disabled before the transition to > > * guest mode. > > > > > > At the point where you call this, we already are in guest mode, at > > least in the KVM sense. > > I believe the comment is suggestive of guest mode in the hardware > sense, not KVM's vcpu->mode designation. I got this from > arch/x86/kvm/x86.c:vcpu_enter_guest() to infer the author's > intentions. Yeah, the comment is referring to hardware guest mode. The intent is to verify there is no work to be done before making the expensive world switch. There's no meaningful interaction with vcpu->mode, on x86 it's simply more convenient from a code perspective to throw it into kvm_vcpu_exit_request(). _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm