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=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 68194C4338F for ; Fri, 30 Jul 2021 17:52:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4128560EE6 for ; Fri, 30 Jul 2021 17:52:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230273AbhG3Rwg (ORCPT ); Fri, 30 Jul 2021 13:52:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhG3Rwf (ORCPT ); Fri, 30 Jul 2021 13:52:35 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EBF6C0613C1 for ; Fri, 30 Jul 2021 10:52:30 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id u3so19438656lff.9 for ; Fri, 30 Jul 2021 10:52:30 -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=w74FCyABGqlKztmmT/szhNY9h5zAocpT2ax3CC8sfng=; b=DMrMZW03lBg/IWAb0IutYWMvCcEgS9xE5oJAt+jb+XBSyYmWnF1bbfCrZjz7dswIwD 3v09mJ2EWLLHzJdjDf1awDYZg7EXnIFc+cImRm3dt9ORzBzqc6NkD+G5XTaI0Zcen3XU 4cCh5vSyAZ7M/7ch8OPmEQSoGVBqGVkmlSuoAz2i+3aMHhE16KOplP7P7310dJvFMc7r 473AiUM6s5r/ikkrJBXsLg/dLLccX9P/NPC+CEdOheJvLrqF2WWEkzYeBpo55NGME49y 5MFHPpccGBKyttRw8SZHiN1GNbFcg1Rwcwr0J/jQi6dJrksfxK2UQM3qkKKIKTimvKSi 4mKg== 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=w74FCyABGqlKztmmT/szhNY9h5zAocpT2ax3CC8sfng=; b=fcQEQiQ1RDj8zzlowbBz2ubqq7eew6rh5L2oHVm09gKcf7V+w82m4NoGQpMOsb9Exz wRIl+qCNoIiC+K95XWQya0M6pdcH4RJzYMLm6VwmD25Y8tS4f4v9EzAJby0qTswI3e2P iz/MaH2dVpm46wu06NVH8OmftuXKCWCZ6odMoL9TeL+z/0GyNUrjr5xkrq50pJR+c9wZ bJfvhYKX1BIEwsqttX5EP+ttXps17igyPSOpzyKWujCp4kfm0CA4MEyb5OEoEiw+8FVF qScSVrQ8Ntu6oWtFArjXGk6kUwKG9RuPljO90MFADvtVyslUcKe9ZpC+QjYmzvjWKokz BeRw== X-Gm-Message-State: AOAM5308icvBNh63Nnbff4j3gehDfvNo5eTpC3FKdYroYbxm6Xlfip6S CPAh8S2VTOk9KFPi1TkFYJHzHVkfsJj7Ewzk49J59/DBuSDCKQ== X-Google-Smtp-Source: ABdhPJz0PS/v5uJNj45dAFVPDlHbQva1oT/iA2HWlKW9EoPtntJYtcQmwoF/lTYfoxBt8w02Z4/+/RsU10oVF052rmE= X-Received: by 2002:a05:6512:3d26:: with SMTP id d38mr2541587lfv.411.1627667548598; Fri, 30 Jul 2021 10:52:28 -0700 (PDT) MIME-Version: 1.0 References: <20210729220916.1672875-1-oupton@google.com> <20210729220916.1672875-4-oupton@google.com> <878s1o2l6j.wl-maz@kernel.org> In-Reply-To: From: Oliver Upton Date: Fri, 30 Jul 2021 10:52:17 -0700 Message-ID: Subject: Re: [PATCH v2 3/3] KVM: arm64: Use generic KVM xfer to guest work function To: Sean Christopherson 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 30, 2021 at 9:56 AM Sean Christopherson wrote: > > 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(). Yep, the same is true for ARM as well, doing it the way it appears in this patch allows for the recycling of the block to enable irqs and preemption. -- Thanks, Oliver 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=-8.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 A8635C4338F for ; Fri, 30 Jul 2021 17:52:35 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 371C860F48 for ; Fri, 30 Jul 2021 17:52:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 371C860F48 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 927F84B0DF; Fri, 30 Jul 2021 13:52:34 -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 F5fUgQIdXTze; Fri, 30 Jul 2021 13:52:33 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 89A514B0C7; Fri, 30 Jul 2021 13:52:33 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 48C5C4B0B6 for ; Fri, 30 Jul 2021 13:52:32 -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 rc2Q0LUdnh00 for ; Fri, 30 Jul 2021 13:52:30 -0400 (EDT) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 5123A4A51D for ; Fri, 30 Jul 2021 13:52:30 -0400 (EDT) Received: by mail-lf1-f54.google.com with SMTP id h14so19432862lfv.7 for ; Fri, 30 Jul 2021 10:52:30 -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=w74FCyABGqlKztmmT/szhNY9h5zAocpT2ax3CC8sfng=; b=DMrMZW03lBg/IWAb0IutYWMvCcEgS9xE5oJAt+jb+XBSyYmWnF1bbfCrZjz7dswIwD 3v09mJ2EWLLHzJdjDf1awDYZg7EXnIFc+cImRm3dt9ORzBzqc6NkD+G5XTaI0Zcen3XU 4cCh5vSyAZ7M/7ch8OPmEQSoGVBqGVkmlSuoAz2i+3aMHhE16KOplP7P7310dJvFMc7r 473AiUM6s5r/ikkrJBXsLg/dLLccX9P/NPC+CEdOheJvLrqF2WWEkzYeBpo55NGME49y 5MFHPpccGBKyttRw8SZHiN1GNbFcg1Rwcwr0J/jQi6dJrksfxK2UQM3qkKKIKTimvKSi 4mKg== 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=w74FCyABGqlKztmmT/szhNY9h5zAocpT2ax3CC8sfng=; b=HJxwQFW/qLn3G76u7298zVJuoyLX5Z8YHbVffwkFm5jHSJj8YRie5RqcuQ0BYzXyQC j0zTAA6k8xYkCxayFbMXDuUDM7vPT50xhxTctv9dPsgoNBnSEyOPy2yOql21Fmq3iXjh FGxuNwW4kzYChqXKMuevu0rbG0xk2RgReD9Vb8kDYi/Xb6+JK79Ai5GBP9dXPNwx1Efc fmDNp4ZMKxEH49uLFZMeynGtYp+3p95O4qA6DRuxhJipwJzHfRvle9xyR+2DqL1z15vd w/ARZOk+8BJtYVIQQr/jygY7YYaISRpRbsAYdMsuzyUN7kQvamic1FFRAmo1BnvfZ7pl hlrA== X-Gm-Message-State: AOAM533bqVFQBPseuUTVs6pN2t7yVPSggkULxe5T54mdnEdC/rVHQIXi JYDB6LwZwvstZsHTe4BwEceoTBS6of46dhoIueDDXw== X-Google-Smtp-Source: ABdhPJz0PS/v5uJNj45dAFVPDlHbQva1oT/iA2HWlKW9EoPtntJYtcQmwoF/lTYfoxBt8w02Z4/+/RsU10oVF052rmE= X-Received: by 2002:a05:6512:3d26:: with SMTP id d38mr2541587lfv.411.1627667548598; Fri, 30 Jul 2021 10:52:28 -0700 (PDT) MIME-Version: 1.0 References: <20210729220916.1672875-1-oupton@google.com> <20210729220916.1672875-4-oupton@google.com> <878s1o2l6j.wl-maz@kernel.org> In-Reply-To: From: Oliver Upton Date: Fri, 30 Jul 2021 10:52:17 -0700 Message-ID: Subject: Re: [PATCH v2 3/3] KVM: arm64: Use generic KVM xfer to guest work function To: Sean Christopherson 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 at 9:56 AM Sean Christopherson wrote: > > 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(). Yep, the same is true for ARM as well, doing it the way it appears in this patch allows for the recycling of the block to enable irqs and preemption. -- Thanks, Oliver _______________________________________________ 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=-9.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 63BC6C4338F for ; Fri, 30 Jul 2021 17:54:23 +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 29E8560EE6 for ; Fri, 30 Jul 2021 17:54:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 29E8560EE6 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=apDV8Ymm/N9tR2cXBGeHPyK3QcHH1mT1PQXrYzaOky4=; b=0FoVIHQL0WvJL9 YS1gkEeeODC8dPbWDb88HvcatJ5tcn+O7DXNDrAHDQwRtbWYz+zyG/BcFvw6isrtPy0plS8HgpPSk gEGzzkv2Ted97xDD3dhuf3tkLFDVjKWNsnETni6Le+vDXYgQz6nceAu/q0nD6FwqOSx8X+MhBaAlS cKjBgapMzByMRyMH4mHisFbzrQUw8sbArRyBgTpJcizOYFZvwphVjrZLftw7mYSHUNE/yYnyqks2P tAeG9SSYr6VYM1E6Rn5QT0KZeTIAOwAi7oSgaH2pXHCraVLVx1mlMkSWegEWd29Ocn3PI+DQGLt2z BM51DA26o3UX+IfyF2JQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9WgX-009maH-LA; Fri, 30 Jul 2021 17:52:37 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9WgT-009mY2-T0 for linux-arm-kernel@lists.infradead.org; Fri, 30 Jul 2021 17:52:35 +0000 Received: by mail-lf1-x132.google.com with SMTP id h2so19485408lfu.4 for ; Fri, 30 Jul 2021 10:52:30 -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=w74FCyABGqlKztmmT/szhNY9h5zAocpT2ax3CC8sfng=; b=DMrMZW03lBg/IWAb0IutYWMvCcEgS9xE5oJAt+jb+XBSyYmWnF1bbfCrZjz7dswIwD 3v09mJ2EWLLHzJdjDf1awDYZg7EXnIFc+cImRm3dt9ORzBzqc6NkD+G5XTaI0Zcen3XU 4cCh5vSyAZ7M/7ch8OPmEQSoGVBqGVkmlSuoAz2i+3aMHhE16KOplP7P7310dJvFMc7r 473AiUM6s5r/ikkrJBXsLg/dLLccX9P/NPC+CEdOheJvLrqF2WWEkzYeBpo55NGME49y 5MFHPpccGBKyttRw8SZHiN1GNbFcg1Rwcwr0J/jQi6dJrksfxK2UQM3qkKKIKTimvKSi 4mKg== 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=w74FCyABGqlKztmmT/szhNY9h5zAocpT2ax3CC8sfng=; b=KkyoDhIMHEeEww28TVjcPOPUJGO4Zz4+IKq7oIpXtth9cD4RUloQA/jkSJ/Zd794a1 fW/exNnLnreD4cTmHvasYe2wKc1EKwtLbvwjsYsl9voSb9uNjMSFM3+XXvR3/iuEb/kE x7Q53gPeFXQtX31SLYq6yV6PXkony4FLzU8oQ5aqeoSgxJyjjUsXj/VS4L7IqLaOHjOm vBkb0nd6IZ/SwFAvGHZE8h0NCptA8Tz3rHU6a84Ft7SVtLS6uRAuUIusz+kyawcikJWh dPy1UNwaJ+0qYtxTyovdHVUbRHpM1E6yFbo93m56y8CDDFPqHBuKnPeZJNWs1rcM/CMt 1t/Q== X-Gm-Message-State: AOAM532JKmJB7rDJycVJKuNFoTw8b8bGUfO+gVyvnwqUAj97KxjR2Wbk EkRGPsf1viTQhB9ZUNolJBO1AUfrv8EOnmlW+Qxe1g== X-Google-Smtp-Source: ABdhPJz0PS/v5uJNj45dAFVPDlHbQva1oT/iA2HWlKW9EoPtntJYtcQmwoF/lTYfoxBt8w02Z4/+/RsU10oVF052rmE= X-Received: by 2002:a05:6512:3d26:: with SMTP id d38mr2541587lfv.411.1627667548598; Fri, 30 Jul 2021 10:52:28 -0700 (PDT) MIME-Version: 1.0 References: <20210729220916.1672875-1-oupton@google.com> <20210729220916.1672875-4-oupton@google.com> <878s1o2l6j.wl-maz@kernel.org> In-Reply-To: From: Oliver Upton Date: Fri, 30 Jul 2021 10:52:17 -0700 Message-ID: Subject: Re: [PATCH v2 3/3] KVM: arm64: Use generic KVM xfer to guest work function To: Sean Christopherson 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210730_105233_965067_0F57B566 X-CRM114-Status: GOOD ( 21.30 ) 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 at 9:56 AM Sean Christopherson wrote: > > 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(). Yep, the same is true for ARM as well, doing it the way it appears in this patch allows for the recycling of the block to enable irqs and preemption. -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel