From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Andy Lutomirski <luto@kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Rik van Riel <riel@redhat.com>,
Paul McKenney <paulmck@linux.vnet.ibm.com>
Subject: [PATCH 1/3] context_tracking: remove duplicate enabled check
Date: Wed, 28 Oct 2015 02:39:55 +0100 [thread overview]
Message-ID: <1445996397-32703-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1445996397-32703-1-git-send-email-pbonzini@redhat.com>
All calls to context_tracking_enter and context_tracking_exit
are already checking context_tracking_is_enabled, except the
context_tracking_user_enter and context_tracking_user_exit
functions left in for the benefit of assembly calls.
Pull the check up to those functions, by making them simple
wrappers around the user_enter and user_exit inline functions.
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/linux/context_tracking.h | 4 ++--
kernel/context_tracking.c | 16 ++--------------
2 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 008fc67d0d96..6ef136ff0897 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -18,13 +18,13 @@ extern void context_tracking_user_exit(void);
static inline void user_enter(void)
{
if (context_tracking_is_enabled())
- context_tracking_user_enter();
+ context_tracking_enter(CONTEXT_USER);
}
static inline void user_exit(void)
{
if (context_tracking_is_enabled())
- context_tracking_user_exit();
+ context_tracking_exit(CONTEXT_USER);
}
static inline enum ctx_state exception_enter(void)
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
index 0a495ab35bc7..6d4c6ce21275 100644
--- a/kernel/context_tracking.c
+++ b/kernel/context_tracking.c
@@ -63,15 +63,6 @@ void context_tracking_enter(enum ctx_state state)
unsigned long flags;
/*
- * Repeat the user_enter() check here because some archs may be calling
- * this from asm and if no CPU needs context tracking, they shouldn't
- * go further. Repeat the check here until they support the inline static
- * key check.
- */
- if (!context_tracking_is_enabled())
- return;
-
- /*
* Some contexts may involve an exception occuring in an irq,
* leading to that nesting:
* rcu_irq_enter() rcu_user_exit() rcu_user_exit() rcu_irq_exit()
@@ -128,7 +119,7 @@ EXPORT_SYMBOL_GPL(context_tracking_enter);
void context_tracking_user_enter(void)
{
- context_tracking_enter(CONTEXT_USER);
+ user_enter();
}
NOKPROBE_SYMBOL(context_tracking_user_enter);
@@ -148,9 +139,6 @@ void context_tracking_exit(enum ctx_state state)
{
unsigned long flags;
- if (!context_tracking_is_enabled())
- return;
-
if (in_interrupt())
return;
@@ -181,7 +169,7 @@ EXPORT_SYMBOL_GPL(context_tracking_exit);
void context_tracking_user_exit(void)
{
- context_tracking_exit(CONTEXT_USER);
+ user_exit();
}
NOKPROBE_SYMBOL(context_tracking_user_exit);
--
2.5.0
next prev parent reply other threads:[~2015-10-28 1:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-28 1:39 [PATCH 0/3] context_tracking: streamline code, avoid IRQ save/restore Paolo Bonzini
2015-10-28 1:39 ` Paolo Bonzini [this message]
2015-10-28 5:19 ` [PATCH 1/3] context_tracking: remove duplicate enabled check Andy Lutomirski
2015-11-07 9:38 ` Paolo Bonzini
2015-11-09 13:57 ` Rik van Riel
2015-10-28 1:39 ` [PATCH 2/3] context_tracking: avoid irq_save/irq_restore on guest entry and exit Paolo Bonzini
2015-10-28 5:20 ` Andy Lutomirski
2015-11-09 13:58 ` Rik van Riel
2015-10-28 1:39 ` [PATCH 3/3] x86: context_tracking: avoid irq_save/irq_restore on kernel " Paolo Bonzini
2015-10-28 5:22 ` Andy Lutomirski
2015-10-28 14:51 ` Paolo Bonzini
2016-03-14 19:23 ` Andy Lutomirski
2016-03-15 8:51 ` Paolo Bonzini
2015-10-28 2:05 ` [PATCH 0/3] context_tracking: streamline code, avoid IRQ save/restore Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1445996397-32703-2-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=fweisbec@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).