From: Peter Zijlstra <peterz@infradead.org>
To: Stefan Bader <stefan.bader@canonical.com>
Cc: Borislav Petkov <bp@alien8.de>,
Paolo Bonzini <pbonzini@redhat.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>,
MASAO TAKAHASHI <masao-takahashi@kanno.co.jp>,
Joerg Roedel <joro@8bytes.org>
Subject: Re: Another preempt folding issue?
Date: Fri, 14 Feb 2014 12:49:26 +0100 [thread overview]
Message-ID: <20140214114926.GB15586@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <52FDFCFA.906@canonical.com>
On Fri, Feb 14, 2014 at 12:24:42PM +0100, Stefan Bader wrote:
> Oh and one thing I was wondering. Not sure I do understand it right... When
> initially converting to percpu counts, you changed the 32bit assembly like that:
>
> --- a/arch/x86/kernel/entry_32.S
> +++ b/arch/x86/kernel/entry_32.S
> @@ -362,12 +362,9 @@ END(ret_from_exception)
> #ifdef CONFIG_PREEMPT
> ENTRY(resume_kernel)
> DISABLE_INTERRUPTS(CLBR_ANY)
> - cmpl $0,TI_preempt_count(%ebp) # non-zero preempt_count ?
> - jnz restore_all
> need_resched:
> - movl TI_flags(%ebp), %ecx # need_resched set ?
> - testb $_TIF_NEED_RESCHED, %cl
> - jz restore_all
> + cmpl $0,PER_CPU_VAR(__preempt_count)
> + jnz restore_all
> testl $X86_EFLAGS_IF,PT_EFLAGS(%esp) # interrupts off (exception path
> jz restore_all
> call preempt_schedule_irq
>
> This seems to say if preempt_count was 0 then then if the thread flag was set
> and interrupts were not off(?) it would do a preempt ipi and then come back to
> re-check the thread flag.
No not an IPI; it would reschedule.
So the old code:
if preempt_count != 0; continue out
if !TIF_NEED_RESCHED; continue out
if IRQs-off in calling context; continue out
preempt_schedule_irq
The new code:
if preempt_count != 0; continue out
if IRQs-off in calling context; continue out
preempt_schedule_irq
> This would now be if preempt_count is 0 only... and I wonder whether that would
> change from doing that loop...
We can do away with the TIF_NEED_RESCHED test because that state is
folded into the preempt_count by means of PREEMPT_NEED_RESCHED.
next prev parent reply other threads:[~2014-02-14 11:49 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-11 18:34 Another preempt folding issue? Stefan Bader
2014-02-11 19:45 ` Peter Zijlstra
2014-02-12 8:20 ` Stefan Bader
2014-02-12 10:37 ` Peter Zijlstra
2014-02-12 10:40 ` Borislav Petkov
2014-02-12 11:09 ` Stefan Bader
2014-02-12 11:54 ` Peter Zijlstra
2014-02-13 17:00 ` Stefan Bader
2014-02-13 17:38 ` Peter Zijlstra
2014-02-13 18:03 ` Stefan Bader
2014-02-13 18:26 ` Peter Zijlstra
2014-02-14 13:34 ` Borislav Petkov
2014-02-14 13:40 ` Stefan Bader
2014-02-14 14:24 ` Stefan Bader
2014-02-14 14:47 ` Borislav Petkov
2014-02-14 17:02 ` Stefan Bader
2014-02-14 17:21 ` Peter Zijlstra
2014-02-20 15:38 ` Stefan Bader
2014-02-20 15:50 ` Peter Zijlstra
2014-03-24 17:39 ` Paolo Bonzini
2014-03-25 8:23 ` Stefan Bader
2014-02-14 17:33 ` Borislav Petkov
2014-02-14 18:23 ` Stefan Bader
2014-02-14 19:03 ` Stefan Bader
2014-02-14 15:21 ` Another preempt folding issue? (maybe bisect) Borislav Petkov
2014-02-14 15:28 ` Stefan Bader
2014-02-14 15:44 ` Borislav Petkov
2014-02-14 16:21 ` Peter Zijlstra
2014-02-13 18:25 ` Another preempt folding issue? Peter Zijlstra
2014-02-14 10:55 ` Stefan Bader
2014-02-14 13:17 ` Peter Zijlstra
2014-02-14 11:24 ` Stefan Bader
2014-02-14 11:49 ` Peter Zijlstra [this message]
2014-02-12 11:12 ` Joerg Roedel
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=20140214114926.GB15586@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masao-takahashi@kanno.co.jp \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=stefan.bader@canonical.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.