From patchwork Thu Oct 17 10:10:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= X-Patchwork-Id: 3059951 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A5A5A9F2B6 for ; Thu, 17 Oct 2013 10:18:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1AE23203A8 for ; Thu, 17 Oct 2013 10:18:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EE9C320394 for ; Thu, 17 Oct 2013 10:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754659Ab3JQKR5 (ORCPT ); Thu, 17 Oct 2013 06:17:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57581 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754598Ab3JQKRy (ORCPT ); Thu, 17 Oct 2013 06:17:54 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9HAHeVI007366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 17 Oct 2013 06:17:40 -0400 Received: from potion.localdomain (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r9HAHcr4007194; Thu, 17 Oct 2013 06:17:39 -0400 Received: by potion.localdomain (Postfix, from userid 1000) id 39EBE4511E41; Thu, 17 Oct 2013 12:15:13 +0200 (CEST) From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Gleb Natapov , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Peter Zijlstra , Paul Mackerras , Arnaldo Carvalho de Melo , kvm@vger.kernel.org Subject: [PATCH 4/7] static_key: use static_key_slow_inc_deferred() Date: Thu, 17 Oct 2013 12:10:27 +0200 Message-Id: <1382004631-25895-5-git-send-email-rkrcmar@redhat.com> In-Reply-To: <1382004631-25895-1-git-send-email-rkrcmar@redhat.com> References: <1382004631-25895-1-git-send-email-rkrcmar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,HK_RANDOM_FROM, KHOP_BIG_TO_CC,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simple replacement where possible. Saves us problematic access to the structure and allows optimalizations and bug fixes to take place. Signed-off-by: Radim Kr?má? --- arch/x86/kvm/lapic.c | 7 ++++--- kernel/events/core.c | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 5439117..eff85f6 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -121,7 +121,7 @@ static inline void apic_set_spiv(struct kvm_lapic *apic, u32 val) if (val & APIC_SPIV_APIC_ENABLED) static_key_slow_dec_deferred(&apic_sw_disabled); else - static_key_slow_inc(&apic_sw_disabled.key); + static_key_slow_inc_deferred(&apic_sw_disabled); } apic_set_reg(apic, APIC_SPIV, val); } @@ -1351,7 +1351,7 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value) if (value & MSR_IA32_APICBASE_ENABLE) static_key_slow_dec_deferred(&apic_hw_disabled); else - static_key_slow_inc(&apic_hw_disabled.key); + static_key_slow_inc_deferred(&apic_hw_disabled); recalculate_apic_map(vcpu->kvm); } @@ -1546,7 +1546,8 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu) kvm_lapic_set_base(vcpu, APIC_DEFAULT_PHYS_BASE | MSR_IA32_APICBASE_ENABLE); - static_key_slow_inc(&apic_sw_disabled.key); /* sw disabled at reset */ + /* sw disabled at reset */ + static_key_slow_inc_deferred(&apic_sw_disabled); kvm_lapic_reset(vcpu); kvm_iodevice_init(&apic->dev, &apic_mmio_ops); diff --git a/kernel/events/core.c b/kernel/events/core.c index d49a9d2..ade89a1 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -6565,7 +6565,7 @@ static void account_event(struct perf_event *event) return; if (event->attach_state & PERF_ATTACH_TASK) - static_key_slow_inc(&perf_sched_events.key); + static_key_slow_inc_deferred(&perf_sched_events); if (event->attr.mmap || event->attr.mmap_data) atomic_inc(&nr_mmap_events); if (event->attr.comm) @@ -6577,9 +6577,9 @@ static void account_event(struct perf_event *event) tick_nohz_full_kick_all(); } if (has_branch_stack(event)) - static_key_slow_inc(&perf_sched_events.key); + static_key_slow_inc_deferred(&perf_sched_events); if (is_cgroup_event(event)) - static_key_slow_inc(&perf_sched_events.key); + static_key_slow_inc_deferred(&perf_sched_events); account_event_cpu(event, event->cpu); }