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] [day] [month] [year] [list]
Message-ID: <20100514033732.GA2418@linux.vnet.ibm.com>
Date:	Thu, 13 May 2010 20:37:32 -0700
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	ratheesh k <ratheesh.ksz@...il.com>
Cc:	Sven-Thorsten Dietrich <thebigcorporation@...il.com>,
	linux-kernel@...r.kernel.org, linux-rt-users@...r.kernel.org
Subject: Re: preempt_disable and sleep()

On Fri, May 14, 2010 at 08:16:07AM +0530, ratheesh k wrote:
> On Fri, May 14, 2010 at 12:13 AM, Sven-Thorsten Dietrich
> <thebigcorporation@...il.com> wrote:
> 
> > Why would you do this?
> I was reading some linux kernel journel about preempt_disable() . This
> a doubt came to me .
> 
> 
> > If you had tried this code, you would have seen the corresponding stack
> > dump on the console.
> 
> 
> Why it so .? could you explain a little more ? .sleep() will schedule
> () , which inturn give back control to kernel .

Sleeping in the kernel with preemption disabled is considered to be a
bug.  So the scheduler will print an error and a stack dump when this
happens.

In contrast, it is OK to do the following:

	preempt_disable();
	do_something();
	preempt_enable();
	schedule();
	preempt_disable();
	do_something_else();
	preempt_enable();

							Thanx, Paul

> Thank,
> Ratheesh
> 
> On Fri, May 14, 2010 at 12:13 AM, Sven-Thorsten Dietrich
> <thebigcorporation@...il.com> wrote:
> > On Fri, 2010-05-14 at 00:02 +0530, ratheesh k wrote:
> >> I am running RT linux .
> >>
> >> /* code snippet */
> >>
> >> preempt_disable()
> >> ...........
> >> sleep(10);
> >> '............
> >> preempt_enable()
> >>
> >>
> >> will this sleep() will cause reschedule ?.
> >>
> >
> > Why would you do this?
> >
> > If you had tried this code, you would have seen the corresponding stack
> > dump on the console.
> >
> >> if an interrupt comes  while premption is disabled , how it is handled ?.
> >>
> >
> > Depends on the number of (idle) cores, the setting of CONFIG_PREEMPT_[]
> > and the type of interrupt.
> >
> > RT threaded IRQs would not run until preemption is enabled on a single
> > core system.
> >
> >
> >
> >> Thanks,
> >> Ratheesh
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
> >> the body of a message to majordomo@...r.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> >
> >
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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