The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Alexander Kuleshov <kuleshovmail@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Borislav Petkov <bp@suse.de>,
	Andy Lutomirski <luto@kernel.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Wang Nan <wangnan0@huawei.com>,
	linux-kernel@vger.kernel.org,
	Alexander Kuleshov <kuleshovmail@gmail.com>
Subject: [PATCH] x86/traps: use conditional_{cli,sti} in preempt_conditinal_{cli_sti}
Date: Sat, 16 Jan 2016 18:58:07 +0600	[thread overview]
Message-ID: <1452949087-14855-1-git-send-email-kuleshovmail@gmail.com> (raw)

The 3d2a71a596bd9 commit (x86, traps: converge do_debug handlers by
Alexander van Heukelum <heukelum@fastmail.fm>) introduces two functions:
preempt_conditional_sti/cli() which are enables/disables interrupts
depends on state of the interrupt enable flag and increments/decrements
the preempt counter.

In the same time arch/x86/kernel/traps.c defines two similar inline
functions: conditional_{sti,cli} which are do the same, but without
touch of the preempt counter. Let's use these functions in the
preempt_conditional_{sti,cli} instead of duplication of 'if' statemets.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 arch/x86/kernel/traps.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index ade185a..30ec8fa 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -92,8 +92,7 @@ static inline void conditional_sti(struct pt_regs *regs)
 static inline void preempt_conditional_sti(struct pt_regs *regs)
 {
 	preempt_count_inc();
-	if (regs->flags & X86_EFLAGS_IF)
-		local_irq_enable();
+	conditional_sti(regs);
 }
 
 static inline void conditional_cli(struct pt_regs *regs)
@@ -104,8 +103,7 @@ static inline void conditional_cli(struct pt_regs *regs)
 
 static inline void preempt_conditional_cli(struct pt_regs *regs)
 {
-	if (regs->flags & X86_EFLAGS_IF)
-		local_irq_disable();
+	conditional_cli(regs);
 	preempt_count_dec();
 }
 
-- 
2.7.0.25.gfc10eb5

             reply	other threads:[~2016-01-16 13:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-16 12:58 Alexander Kuleshov [this message]
2016-01-16 19:06 ` [PATCH] x86/traps: use conditional_{cli,sti} in preempt_conditinal_{cli_sti} Borislav Petkov
2016-01-16 22:46   ` Andy Lutomirski

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=1452949087-14855-1-git-send-email-kuleshovmail@gmail.com \
    --to=kuleshovmail@gmail.com \
    --cc=bp@suse.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=wangnan0@huawei.com \
    --cc=x86@kernel.org \
    /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