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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6C46C433EF for ; Mon, 7 Feb 2022 15:53:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355878AbiBGPvg (ORCPT ); Mon, 7 Feb 2022 10:51:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386614AbiBGPrN (ORCPT ); Mon, 7 Feb 2022 10:47:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57565C0401C1 for ; Mon, 7 Feb 2022 07:47:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CEAAFB8105D for ; Mon, 7 Feb 2022 15:47:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA01DC340EF; Mon, 7 Feb 2022 15:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644248830; bh=LdSadHOKGFFrAfu0I2Qkry7wLCE2PrwoIGXW+wZTZtY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T7B0mK+u3e3kI992aSXF6HWThT+Dt14mr2tDh4CXWp1dCLGuRisy8vuaTrVo8C2t6 yAzOMTKry8iNg9WpcQt0GiLfK3hAyjvJlm+3DGXeogx469hSnGlUMWyCE3zjQ+foNJ uhJo4s75lP6YiLkqAbmV+s9H6cBQkg8TLJB+1Ca+OQ52B/cL8Aa/klLVpBYnmuBQUk MjAl+VSE7AP1HRlKpJ9S7f0OhzIV1sZuyIJ7E0m3NA+TV+ufPiqBFxVtsvwaeyqOb7 LBjmaGCRXqhkiO8vwEpKM2uk0TjkVgZ+YR4AK8YoZnw+7U93mJOsVFlCD4z7lgdyTL NVsCMO51oVh9g== Date: Mon, 7 Feb 2022 16:47:07 +0100 From: Frederic Weisbecker To: Marcelo Tosatti Cc: linux-kernel@vger.kernel.org, Nitesh Lal , Nicolas Saenz Julienne , Christoph Lameter , Juri Lelli , Peter Zijlstra , Alex Belits , Peter Xu , Thomas Gleixner , Daniel Bristot de Oliveira , Oscar Shiang Subject: Re: [patch v11 10/13] KVM: x86: process isolation work from VM-entry code path Message-ID: <20220207154707.GC526451@lothringen> References: <20220204173537.429902988@fedora.localdomain> <20220204173554.897857855@fedora.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220204173554.897857855@fedora.localdomain> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 04, 2022 at 02:35:47PM -0300, Marcelo Tosatti wrote: > VM-entry code path is an entry point similar to userspace return > when task isolation is concerned. > > Call isolation_exit_to_user_mode before VM-enter. > > Signed-off-by: Marcelo Tosatti > > --- > v11 > - Add TIF_TASK_ISOL bit to thread info flags and use it > to decide whether to perform task isolation work on > return to userspace (Frederic W. Weisbecker) > > include/linux/entry-kvm.h | 4 +++- > kernel/entry/kvm.c | 18 ++++++++++++++---- > 2 files changed, 17 insertions(+), 5 deletions(-) > > Index: linux-2.6/kernel/entry/kvm.c > =================================================================== > --- linux-2.6.orig/kernel/entry/kvm.c > +++ linux-2.6/kernel/entry/kvm.c > @@ -2,6 +2,7 @@ > > #include > #include > +#include > > static int xfer_to_guest_mode_work(struct kvm_vcpu *vcpu, unsigned long ti_work) > { > @@ -22,6 +23,9 @@ static int xfer_to_guest_mode_work(struc > if (ti_work & _TIF_NOTIFY_RESUME) > tracehook_notify_resume(NULL); > > + if (ti_work & _TIF_TASK_ISOL) > + task_isol_exit_to_user_mode(); > + > ret = arch_xfer_to_guest_mode_handle_work(vcpu, ti_work); > if (ret) > return ret; > > Do you need this? diff --git a/include/linux/entry-kvm.h b/include/linux/entry-kvm.h index 07c878d6e323..3588d6071caf 100644 --- a/include/linux/entry-kvm.h +++ b/include/linux/entry-kvm.h @@ -18,7 +18,7 @@ #define XFER_TO_GUEST_MODE_WORK \ (_TIF_NEED_RESCHED | _TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL | \ - _TIF_NOTIFY_RESUME | ARCH_XFER_TO_GUEST_MODE_WORK) + _TIF_NOTIFY_RESUME | _TIF_TASK_ISOL | ARCH_XFER_TO_GUEST_MODE_WORK) struct kvm_vcpu;