From patchwork Tue Oct 22 19:12:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 11205223 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4AC9D139A for ; Tue, 22 Oct 2019 19:13:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 29AC921906 for ; Tue, 22 Oct 2019 19:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571771584; bh=R3tHkDCH+7tkl14+AOFmzJTymspPmc+OGB4U1M8uKt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=UTbLTHFQgF6tubiOjQMXM4VHrwYj07c7ZMh3XqnNsgm7vNy4YBAYH+Y/fUWJ609Jp NqyQkiXjcy9tDWFMeoJFWz+LSyWDeN9uJlXLyGDQ2KrxLOcrfZ/2tl9SfGa00k4caK msKgb9Qhc5j0tBP0uUUjZCejBhTw6YLMKn9eRM/Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732930AbfJVTMX (ORCPT ); Tue, 22 Oct 2019 15:12:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:43322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732903AbfJVTMX (ORCPT ); Tue, 22 Oct 2019 15:12:23 -0400 Received: from localhost.localdomain (rrcs-50-75-166-42.nys.biz.rr.com [50.75.166.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BA37621906; Tue, 22 Oct 2019 19:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571771542; bh=R3tHkDCH+7tkl14+AOFmzJTymspPmc+OGB4U1M8uKt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0OLUuUOtRdP0jRyYAWW6w0ldh8KU81QVmuon8dGG0kMSUUYvmJjbSVfLR89zD3gQE 5vj7iWGw2mBo28bqITekuThcLemKYXHga/pRsJ76gOazKfJnea/kPy8+rj+QPOFKIV xoBV4vf7tOVsT1p7GcTghDLLhiFFlRYNn+ZBsBw4= From: paulmck@kernel.org To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org, "Paul E. McKenney" , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, kvm@vger.kernel.org Subject: [PATCH tip/core/rcu 02/10] x86/kvm/pmu: Replace rcu_swap_protected() with rcu_replace() Date: Tue, 22 Oct 2019 12:12:07 -0700 Message-Id: <20191022191215.25781-2-paulmck@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20191022191136.GA25627@paulmck-ThinkPad-P72> References: <20191022191136.GA25627@paulmck-ThinkPad-P72> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: "Paul E. McKenney" This commit replaces the use of rcu_swap_protected() with the more intuitively appealing rcu_replace() as a step towards removing rcu_swap_protected(). Link: https://lore.kernel.org/lkml/CAHk-=wiAsJLw1egFEE=Z7-GGtM6wcvtyytXZA1+BHqta4gg6Hw@mail.gmail.com/ Reported-by: Linus Torvalds [ paulmck: From rcu_replace() to rcu_replace_pointer() per Ingo Molnar. ] Signed-off-by: Paul E. McKenney Acked-by: Paolo Bonzini Cc: "Radim Krčmář" Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: Cc: --- arch/x86/kvm/pmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index 46875bb..5ddb05a 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c @@ -416,8 +416,8 @@ int kvm_vm_ioctl_set_pmu_event_filter(struct kvm *kvm, void __user *argp) *filter = tmp; mutex_lock(&kvm->lock); - rcu_swap_protected(kvm->arch.pmu_event_filter, filter, - mutex_is_locked(&kvm->lock)); + filter = rcu_replace_pointer(kvm->arch.pmu_event_filter, filter, + mutex_is_locked(&kvm->lock)); mutex_unlock(&kvm->lock); synchronize_srcu_expedited(&kvm->srcu);