Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2263122lqo; Mon, 13 May 2024 12:40:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVLb0fJ/lt5LpVaLp7V5SaP8G9xN8gIYJw7Ykx++dYe7/DL3U72ffUBnLjOK+QVTcz0UdYV6fgveh3Xt5tqhbRQSKOyNkE73DrtXeAMwQ== X-Google-Smtp-Source: AGHT+IHPgmwbgQB0oKYKdpJdTdQbZkWa93fIR5XZZUUAyRHvBvMoXnfVA3Ax2f+GUqY59lk3vjgF X-Received: by 2002:ac8:574d:0:b0:43a:c84f:938e with SMTP id d75a77b69052e-43dfdabdc20mr124527541cf.12.1715629258825; Mon, 13 May 2024 12:40:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715629258; cv=pass; d=google.com; s=arc-20160816; b=g+8xCFvtkUppO3Q0IseWOpeibKSTmJFv74CoZco5iup9BQyQqCg+7IO5Hvm68DfNAA 9FnHc3JpbyvTCG1C+bFdz5VUJ94Ne5l+PNjQYiRdcFjOjB0MYFI5MJAsiMpoMrTYbfxN iLpXevN86dcvlq3idjLzD1+cgYG9A+Qr0AW8pOBucFv3JSARCOoGZZoHMqZQQJQENDJ1 syzUBAYr+rqUAWTRJB41iUshjrJzn3kuBZEAWp8V6V48OX0NfCd5/PrM5/fPrIcWvQcP TTkBWtjYvyNn4E5s++sXgf+TEXZw00LFHYZsdSln9R2T9Ffk4Y++7Owg6a5T4wnnapEH qxHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=oVao59+8SWn5R7wq1a2EyacHCsnmokQY3DXiYJQLN0I=; fh=HlT1174mStSeXwqupsolsr5MJh9yn8t5SdIacczTKLo=; b=Eioymv/6rs7dgWTqjBxnfZiDW9Mw6ggGd3sw8ovBq/r0gNNoh4yD7nec4T+g6sixlE XjvQuXQNKXRGCL5kXw/sFs6xjFJ/j7uInhAoKyqxqq/DzOlJHxDv2QyNPKmp1FqpGNSu scKFaMjJwmivUR4QciV44FyZy7bzO8q8z0Qr0gZQLegCCOzANSOSbK2dITt6LXXC93Ci keJfNgQd+EzBt4iQM/7Q/aX689UqKgI3muk11T/2HvHV34CtvXRcJCB9vI5F//Y0AC/d aFbtpMRSxqY/rjTm+XDioSsPNu8fbYwBZewYIGOinLkfbd5YPnnQVC4aJCer5WvkkkBd 0CXw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="X2/HHKJh"; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-178036-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178036-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43e0f3e65e6si48322511cf.182.2024.05.13.12.40.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 12:40:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178036-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="X2/HHKJh"; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-178036-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178036-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8A0331C23066 for ; Mon, 13 May 2024 19:40:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D12777106; Mon, 13 May 2024 19:40:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="X2/HHKJh" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E6D239FD8 for ; Mon, 13 May 2024 19:40:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715629249; cv=none; b=UazzRmTvUmjeHlbzD6TLBDgBjCiDYlnVp8GMHIht5fW2PveQ36htgNir0kuOrO2bQDR83qGk63QENZVXWOHjlL7f7qDKDCQr8hgHYARuXLoydoP/3CFoXhSzLEPtr7AywYZlY4LJzU0W9/H98tzya8/YPeRm5DvigwDyTGVylVs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715629249; c=relaxed/simple; bh=//NGOHTIP6HghHGerT7/lK4Uz6RPwCBltXnXUwVGkvM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=PcuwHcSwnDhrR2gKqdQuJhxz41H+KP2tx/wwEMWgbqALz6RJBWkqNLnxFo+A+dfv1gsvM8iN2W8CStkzqy/cR2Jwo8nN0jUN7pXvBvLFNICATIi7s6h9SCubX6jvba+dIUNN2RGHDfCjMELUdBe6M2w7voBz5k84eNBgFWeuT1Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=X2/HHKJh; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-61bea0c36bbso95296617b3.2 for ; Mon, 13 May 2024 12:40:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715629247; x=1716234047; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=oVao59+8SWn5R7wq1a2EyacHCsnmokQY3DXiYJQLN0I=; b=X2/HHKJh35SGbbfoCeEwrVgbdwXvMBSLfp0FDriUHjM33U+VBxcfE6aMi2QLaBCYk6 vqD6MIixzDIe9vqYGlrY4bNC8eDBcRtYr/pQwOq3pgW+pUsd8tBXqLRwhdfn7AF+uW8x k7Qm75uQHgLcwCI/RiIy0MhufQUyUaY6NtlaflBU7Z8wmKOKSUUr795y5z9IuejnyS4o vZsx9HDhwxl3z+lWVrJOlD3AHpBhup07by/z2/KwAF1aFaaYxbxt8NqcDvUivJuDrT/0 NmVPvAIuH4/RLJvhXkpR3fGMjHqnBjGilIFGo+2Iv+abbAyQHnGljcHON9N3TjdWzz38 GwHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715629247; x=1716234047; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oVao59+8SWn5R7wq1a2EyacHCsnmokQY3DXiYJQLN0I=; b=UQzbNB+RLYq/sCy6oBbDVWGIt+w0eTtgOxtqr3KRRDbLXUiiWNAmfNAT6o6OpR9E+w Qvx5nXRW3yl75X/hh+pXJ1ZxZb5R6sK9FlRBYzTC9C2Vu8ccnNkLiYMQpdShFTH7dpzp Q+ZPkYfDvZEEqzLylLTAQzZW1iX6M97TqkMX9ECRgFRQtPemupo/7L2uic4CjSvNALBT PuGCCGSYr176A98xYOFDH9CvqtMrgI3TItJHuVi3nYHHdCadR4W7a5XmtIwGxOGAXoDL J1D0h3t18T7U0loCjoAn1OV56BgBQygJVcE2ejtVu1N8kDuXhFDf0Coyini4MLHHwFAq v1Vw== X-Forwarded-Encrypted: i=1; AJvYcCU47qZwr867SeDi/aOjZu6SiATGXQECRajwq2D73PJp9v6Kkg2Qsux3HFjk1mt+a76VyVFjeohCsLS1SjV29iYedLexoOD/5IjvS+JS X-Gm-Message-State: AOJu0YwtN1xnGktbMJnUPI578T5+vGuHAb2NcRVD0GNbdb+UnE06rgIg xKPTLm2O+fBSRu/vDLzUSh+guKHKbW17SX2tvcetN0eXel7ObRuMspjOv212bByo2nHCrCXNi9S HTQ== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:120f:b0:dcb:e982:4e40 with SMTP id 3f1490d57ef6-dee4f38b7cbmr3058891276.12.1715629247216; Mon, 13 May 2024 12:40:47 -0700 (PDT) Date: Mon, 13 May 2024 12:40:45 -0700 In-Reply-To: <20240511020557.1198200-1-leobras@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240511020557.1198200-1-leobras@redhat.com> Message-ID: Subject: Re: [RFC PATCH 1/1] kvm: Note an RCU quiescent state on guest exit From: Sean Christopherson To: Leonardo Bras Cc: Frederic Weisbecker , "Paul E. McKenney" , Paolo Bonzini , Marcelo Tosatti , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="us-ascii" On Fri, May 10, 2024, Leonardo Bras wrote: > As of today, KVM notes a quiescent state only in guest entry, which is good > as it avoids the guest being interrupted for current RCU operations. > > While the guest vcpu runs, it can be interrupted by a timer IRQ that will > check for any RCU operations waiting for this CPU. In case there are any of > such, it invokes rcu_core() in order to sched-out the current thread and > note a quiescent state. > > This occasional schedule work will introduce tens of microsseconds of > latency, which is really bad for vcpus running latency-sensitive > applications, such as real-time workloads. > > So, note a quiescent state in guest exit, so the interrupted guests is able > to deal with any pending RCU operations before being required to invoke > rcu_core(), and thus avoid the overhead of related scheduler work. Are there any downsides to this? E.g. extra latency or anything? KVM will note a context switch on the next VM-Enter, so even if there is extra latency or something, KVM will eventually take the hit in the common case no matter what. But I know some setups are sensitive to handling select VM-Exits as soon as possible. I ask mainly because it seems like a no brainer to me to have both VM-Entry and VM-Exit note the context switch, which begs the question of why KVM isn't already doing that. I assume it was just oversight when commit 126a6a542446 ("kvm,rcu,nohz: use RCU extended quiescent state when running KVM guest") handled the VM-Entry case?