Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp125398lqb; Tue, 28 May 2024 10:32:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX5j3+qvJmoDiSHZilUUgbLfN8P7CjBTPDJ8+SNposo/lOnxeqj7Soqu177RFx3wo19tlliFrqXwMNVLVUQRiEceCv1wwwTvx2ML7FyIA== X-Google-Smtp-Source: AGHT+IHx8aEotAvNpuvO59gKYfWIwBdMHdnOzlMDJCcT596WZTBW5hhIrYEbY30sPSBmFRkT0dFS X-Received: by 2002:a50:aa9b:0:b0:578:59f4:9a29 with SMTP id 4fb4d7f45d1cf-57859f49b4bmr9654610a12.23.1716917569301; Tue, 28 May 2024 10:32:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716917569; cv=pass; d=google.com; s=arc-20160816; b=KB6brqWpVpD4usi1BsdtAAHzmV2s9hoIbm27YhmrKj0988GppPCNbixmPwsKaIk09P PqiCUY0g23elVcYz6ixjuP6rBlYtBRBahNbUtWWazZ5cpce3obubczI+/DE9aIGtLxh3 NVCjFY7210zJoFFkG3wOkrRyEscq/RJ0Wvq/IayiDvxrKzbx+y5E61Dlip1QNQVe0hpO bUd/3LwEQiQQWLsjFAVO30GwvEhaTpTEEx1pyPnNfw2Nwo3k2gQXDQrhDcfWhc7oenNO kBMgKopM8S7JYTeuxJS6tRASKHoyyit7zCyvkiFdXV4ErssQOZhTu5aUJDHjt/9WZOU2 4cdA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1tiyrgoHY2F8Xs8GsHKmBGxrGOp7toPPdDjmM5tv3AI=; fh=ZTUrfckLmljDCnqep7UIXPjAPC99z5NAWHGKMEbwd74=; b=vi2mlkMeaYl23zY8gGV2ySzBA6YtlDOZKAH8K9vG2yXgqKBADbKB2HsTH8JSZOT1il 04sveOlZ6SDHhiHEWVw/U5YW6W94bb87NlDsBLepZgg/ZCG+nA1uGkNQUtvWgKegKEhB VZY69gFOeWxORAwWl8lFjSzSVMHBR7CegLYb4rLj1cIlvPZ67yv4A8vN6+9YCCGYILl7 F3W99WXjNt7NFwAICRfYeTb0ewP2QSTGDDIcnChLSkRyN/eQKCAbHlr6hZqv3EZzZMX7 zi8RBgjDmSibzZh8QQjoJqJIwFQUgQdKQQPAFoDmQtaH0uM8gZaaJjGBFWROAOBurMt4 cB8Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=GU7BQRh1; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-192731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192731-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57863bd94fdsi4331337a12.548.2024.05.28.10.32.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 10:32:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=GU7BQRh1; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-192731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192731-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B784A1F24ADD for ; Tue, 28 May 2024 16:13:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04E09172769; Tue, 28 May 2024 16:13:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="GU7BQRh1" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E16A532C60 for ; Tue, 28 May 2024 16:13:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716912805; cv=none; b=Y9ipoSs9XGmZQ/vq9xqBLjBQNrqXGBym40r1zPTfYxnBYgf0yk8bvkoGWIXNZ3pjqcmjDIr1j/LSJE4MCam4xZmzu7YulrcPksdSC+1QyM/bYbgWNUA/MBMecd1NGKNmTGIHooxomJr/ZGMycAUBeQQ9nkOrQ9omS4b8Ho/3h4s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716912805; c=relaxed/simple; bh=Beqizfh+ua2mk6V35CBh2s+19I3GQaqRn9542pXZKUA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OYvZj16x4DMMfmKHIlmDyCThCmSKBgIa7OMdIiE9ETA5WxJKPJIlN+G8gGc7O8WDynzWW3+rIXelh+00xSDQsVXBIrsAq4/rue0Z1s4ClB+7frZKIJsRPseN5vbyvH/fP2SoqoGRXR1kTxpuPO0x6BstxXouJhrOrVio375egAA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=GU7BQRh1; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=1tiyrgoHY2F8Xs8GsHKmBGxrGOp7toPPdDjmM5tv3AI=; b=GU7BQRh1yiOCp2P7l7nM+KCvWL goan5eSXc2vUB6161vL9NLdjKN11wNo9rjh/hdxA5gXmvEXRHvjGPF+DFICYuO/filDFVpHcHPEzj LZoXKBYfKE+w7Dpyx9PHAzsrb0CnIzCSolNvsZhg5J1comgh2jiPKlN8LlWZgsUlT/RMe1czmm3+/ rzB+ulm0mw5Eh3QVwflL100N/CMQbbrQBL8p2fwqxFRKXPJXWgD99cL99BF99datGJB8GgIrVfubL gA8Ys5ujperOHNnchaYdQMTookMY8qGsYGmazSkTjEbOOYoQ9K7wPuLoeZ0dkU0EJLQJ4+97Y6C+S trCwwMeg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBzRt-00000008oL1-09L4; Tue, 28 May 2024 16:13:17 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id A7E2830058E; Tue, 28 May 2024 18:13:16 +0200 (CEST) Date: Tue, 28 May 2024 18:13:16 +0200 From: Peter Zijlstra To: Ankur Arora Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, paulmck@kernel.org, rostedt@goodmis.org, mark.rutland@arm.com, juri.lelli@redhat.com, joel@joelfernandes.org, raghavendra.kt@amd.com, sshegde@linux.ibm.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, Paolo Bonzini , Andy Lutomirski Subject: Re: [PATCH v2 09/35] entry/kvm: handle lazy rescheduling at guest-entry Message-ID: <20240528161316.GE26599@noisy.programming.kicks-ass.net> References: <20240528003521.979836-1-ankur.a.arora@oracle.com> <20240528003521.979836-10-ankur.a.arora@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240528003521.979836-10-ankur.a.arora@oracle.com> On Mon, May 27, 2024 at 05:34:55PM -0700, Ankur Arora wrote: > Archs defining CONFIG_KVM_XFER_TO_GUEST_WORK call > xfer_to_guest_mode_handle_work() from various KVM vcpu-run > loops to check for any task work including rescheduling. > > Handle TIF_NEED_RESCHED_LAZY alongside TIF_NEED_RESCHED. > > Also, while at it, remove the explicit check for need_resched() in > the exit condition as that is already covered in the loop condition. > > Cc: Paolo Bonzini > Cc: Peter Zijlstra > Cc: Andy Lutomirski > Originally-by: Thomas Gleixner > Link: https://lore.kernel.org/lkml/87jzshhexi.ffs@tglx/ > Signed-off-by: Ankur Arora > --- > include/linux/entry-kvm.h | 2 +- > kernel/entry/kvm.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/linux/entry-kvm.h b/include/linux/entry-kvm.h > index 6813171afccb..674a622c91be 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_NEED_RESCHED_LAZY | ARCH_XFER_TO_GUEST_MODE_WORK) Same as last patch, it seems weird to have both RESCHED flags so far apart.