lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090131175432.GA7635@elte.hu>
Date:	Sat, 31 Jan 2009 18:54:32 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Alexey Zaytsev <alexey.zaytsev@...il.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Nick Piggin <npiggin@...e.de>
Subject: Re: [git pull] scheduler fixes


* Alexey Zaytsev <alexey.zaytsev@...il.com> wrote:

> On Sat, Jan 31, 2009 at 20:23, Peter Zijlstra <peterz@...radead.org> wrote:
> > On Sat, 2009-01-31 at 18:11 +0100, Peter Zijlstra wrote:
> >> > diff --git a/kernel/sched.c b/kernel/sched.c
> >> > index 52bbf1c..5686bb5 100644
> >> > --- a/kernel/sched.c
> >> > +++ b/kernel/sched.c
> >> > @@ -4440,7 +4450,7 @@ void __kprobes sub_preempt_count(int val)
> >> >       /*
> >> >        * Underflow?
> >> >        */
> >> > -     if (DEBUG_LOCKS_WARN_ON(val > preempt_count()))
> >> > +       if (DEBUG_LOCKS_WARN_ON(val > preempt_count() - (!!kernel_locked())))
> >> >               return;
> >> >       /*
> >> >        * Is the spinlock portion underflowing?
> >
> > Since the commit msg of 01e3eb8 says:
> >
> >    kernel_locked() is not a valid test in IRQ context (we update the
> >    BKL's ->lock_depth and the preempt count separately and non-atomicalyy),
> >    so we cannot put it into the generic preempt debugging checks which
> >    can run in IRQ contexts too.
> >
> 
> Is the comment actually valid? From arch/x86/kernel/irq_32.c:
> do_softirq() actually does
>                 curctx = current_thread_info();
>                 irqctx = softirq_ctx[smp_processor_id()];
>                 irqctx->tinfo.task = curctx->task;
> 
> and so does execute_on_irq_stack().
> So kernel_locked() should be valid. It corresponds to the thread
> that is being interrupted.
> 
> And answering an earlier question, this happens only on i386 and only
> with 4K stacks because x86_64 dosn't have a separate softirq stack,
> so the preempt count diring the soft irq is at least IRQ_EXIT_OFFSET.
> 
> (If I understood the things correctly)

Correct, on 64-bit we use the hardirq stack for softirqs too:

ENTRY(call_softirq)
        CFI_STARTPROC
        push %rbp
        CFI_ADJUST_CFA_OFFSET   8
        CFI_REL_OFFSET rbp,0
        mov  %rsp,%rbp
        CFI_DEF_CFA_REGISTER rbp
        incl PER_CPU_VAR(irq_count)
        cmove PER_CPU_VAR(irq_stack_ptr),%rsp
        push  %rbp                      # backlink for old unwinder
        call __do_softirq

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ