Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp567352ybz; Wed, 22 Apr 2020 03:53:36 -0700 (PDT) X-Google-Smtp-Source: APiQypKcVUtHiVzdpywzlKBrrNnnLNJEM9xhYPOwyq45OQK0GOJYjB4Re8HbHMN7A/FlUENksfdW X-Received: by 2002:a17:907:43c2:: with SMTP id i2mr25838275ejs.185.1587552816656; Wed, 22 Apr 2020 03:53:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587552816; cv=none; d=google.com; s=arc-20160816; b=MfWbUPJXdgt3cY59E4I5Mt1H/D/oNjlXCZyLM4hDtW/CL+LHI/RwASYXAgToRGP7Xg pu7p2DpQgjYlZV9as+gVwzvxI6+FB+1SxkG9PcFLTgROsh9SO54X0/r7Ajwh2kl2rKfw FkGHbCu8NlWZTPzLUAMj/WFCiiTmQ4YvmACMfqx0Bi0w71xfDcoaD1G+DzdT0xb1zuuY 2JEOylF2nXzi1PImRnPSIWfnA4Lb/MiTHMEQy+g8PooSpurZELiMWH6pMp/BtgACL3We Dv8T/HKgptAoVs+5SuZsATtYTnGmX5nJ757H+2tj2eQoOAhGtIWJFM7XkKmpI/gTOgtW e/nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version; bh=rVu/OXMZRYivXqbK3uIBYFeyyHaWpTvdO9u+prl4i9Q=; b=eHfFI0Q6t1CMaVSrchwxnHpKXZtCecPNEsnwo4e82tvnm0VMNzCKaT4UXBwNnqngPp V/gsp4xmYecPwWU6IIi2g9Jk9B+wRg/owTjV81jB4UKMZEPBqkDsnGxdwG3jQPPFUbGH 0/099FHwpk2EE9evkS+NoT/X9gWJhRTXJEivLnmcCtVqZCzJGyj96ST49+2/SYce+hO4 uh7ONIUTA+O8UAYi1UkUa3lHsmvgtMI1//vEYxGljdgb9U5a4Ld+4NRBV5m+SQ0i6/jk y3fUDfQnkZD5mADTwujAUaW7IBVQvwkJqp5+hqLlvjceVKPg/Jo0jbDRbY/xiGoX3ZrZ BvcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si3326696edg.380.2020.04.22.03.53.13; Wed, 22 Apr 2020 03:53:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732179AbgDVKvH (ORCPT + 99 others); Wed, 22 Apr 2020 06:51:07 -0400 Received: from disco-boy.misterjones.org ([51.254.78.96]:48482 "EHLO disco-boy.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728702AbgDVKvF (ORCPT ); Wed, 22 Apr 2020 06:51:05 -0400 X-Greylist: delayed 2170 seconds by postgrey-1.27 at vger.kernel.org; Wed, 22 Apr 2020 06:51:03 EDT Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jRCOi-005RP3-VM; Wed, 22 Apr 2020 11:14:29 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 22 Apr 2020 11:14:28 +0100 From: Marc Zyngier To: Davidlohr Bueso Cc: tglx@linutronix.de, pbonzini@redhat.com, kvm@vger.kernel.org, Davidlohr Bueso , peterz@infradead.org, torvalds@linux-foundation.org, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, rostedt@goodmis.org, linux-mips@vger.kernel.org, Paul Mackerras , joel@joelfernandes.org, will@kernel.org, kvmarm@lists.cs.columbia.edu Subject: Re: [PATCH 4/5] kvm: Replace vcpu->swait with rcuwait In-Reply-To: <20200422040739.18601-5-dave@stgolabs.net> References: <20200422040739.18601-1-dave@stgolabs.net> <20200422040739.18601-5-dave@stgolabs.net> Message-ID: X-Sender: maz@misterjones.org User-Agent: Roundcube Webmail/1.3.10 X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: dave@stgolabs.net, tglx@linutronix.de, pbonzini@redhat.com, kvm@vger.kernel.org, dbueso@suse.de, peterz@infradead.org, torvalds@linux-foundation.org, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, rostedt@goodmis.org, linux-mips@vger.kernel.org, paulus@ozlabs.org, joel@joelfernandes.org, will@kernel.org, kvmarm@lists.cs.columbia.edu X-SA-Exim-Mail-From: maz@misterjones.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-04-22 05:07, Davidlohr Bueso wrote: > The use of any sort of waitqueue (simple or regular) for > wait/waking vcpus has always been an overkill and semantically > wrong. Because this is per-vcpu (which is blocked) there is > only ever a single waiting vcpu, thus no need for any sort of > queue. > > As such, make use of the rcuwait primitive, with the following > considerations: > > - rcuwait already provides the proper barriers that serialize > concurrent waiter and waker. > > - Task wakeup is done in rcu read critical region, with a > stable task pointer. > > - Because there is no concurrency among waiters, we need > not worry about rcuwait_wait_event() calls corrupting > the wait->task. As a consequence, this saves the locking > done in swait when modifying the queue. This also applies > to per-vcore wait for powerpc kvm-hv. > > The x86 tscdeadline_latency test mentioned in 8577370fb0cb > ("KVM: Use simple waitqueue for vcpu->wq") shows that, on avg, > latency is reduced by around 15-20% with this change. > > Cc: Paul Mackerras > Cc: kvmarm@lists.cs.columbia.edu > Cc: linux-mips@vger.kernel.org > Signed-off-by: Davidlohr Bueso Reviewed-by: Marc Zyngier Thanks, M. -- Who you jivin' with that Cosmik Debris?