* PREEMPT_RT vs bcache
@ 2013-08-07 20:28 Ben Hutchings
2013-08-07 20:53 ` Kent Overstreet
2013-08-08 7:26 ` Christoph Hellwig
0 siblings, 2 replies; 9+ messages in thread
From: Ben Hutchings @ 2013-08-07 20:28 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: linux-kernel, Kent Overstreet, Uwe Kleine-König
[-- Attachment #1: Type: text/plain, Size: 347 bytes --]
As Kent said back in 2011 (commit 84759c6d18c5), bcache needs
{down,up}_read_non_owner(). But these are not implemented by the -rt
patchset when PREEMPT_RT_FULL is enabled. Can they be added, or is
there a fundamental conflict here?
Ben.
--
Ben Hutchings
Experience is what causes a person to make new mistakes instead of old ones.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: PREEMPT_RT vs bcache
2013-08-07 20:28 PREEMPT_RT vs bcache Ben Hutchings
@ 2013-08-07 20:53 ` Kent Overstreet
2013-08-07 21:08 ` Ben Hutchings
2013-08-07 21:12 ` Uwe Kleine-König
2013-08-08 7:26 ` Christoph Hellwig
1 sibling, 2 replies; 9+ messages in thread
From: Kent Overstreet @ 2013-08-07 20:53 UTC (permalink / raw)
To: Ben Hutchings; +Cc: Thomas Gleixner, linux-kernel, Uwe Kleine-König
On Wed, Aug 07, 2013 at 10:28:18PM +0200, Ben Hutchings wrote:
> As Kent said back in 2011 (commit 84759c6d18c5), bcache needs
> {down,up}_read_non_owner(). But these are not implemented by the -rt
> patchset when PREEMPT_RT_FULL is enabled. Can they be added, or is
> there a fundamental conflict here?
You should be able to cherry pick
84759c6d18c5144432781ddca037d929ee9db8a5 (Revert "rw_semaphore: remove
up/down_read_non_owner") - that went in when bcache was merged.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: PREEMPT_RT vs bcache
2013-08-07 20:53 ` Kent Overstreet
@ 2013-08-07 21:08 ` Ben Hutchings
2013-08-07 21:09 ` Kent Overstreet
2013-08-07 21:12 ` Uwe Kleine-König
1 sibling, 1 reply; 9+ messages in thread
From: Ben Hutchings @ 2013-08-07 21:08 UTC (permalink / raw)
To: Kent Overstreet; +Cc: Thomas Gleixner, linux-kernel, Uwe Kleine-König
[-- Attachment #1: Type: text/plain, Size: 799 bytes --]
On Wed, 2013-08-07 at 13:53 -0700, Kent Overstreet wrote:
> On Wed, Aug 07, 2013 at 10:28:18PM +0200, Ben Hutchings wrote:
> > As Kent said back in 2011 (commit 84759c6d18c5), bcache needs
> > {down,up}_read_non_owner(). But these are not implemented by the -rt
> > patchset when PREEMPT_RT_FULL is enabled. Can they be added, or is
> > there a fundamental conflict here?
>
> You should be able to cherry pick
> 84759c6d18c5144432781ddca037d929ee9db8a5 (Revert "rw_semaphore: remove
> up/down_read_non_owner") - that went in when bcache was merged.
That's the commit I was referring to. But the -rt patchset has a
separate implementation of semaphores for PREEMPT_RT_FULL.
Ben.
--
Ben Hutchings
Experience is what causes a person to make new mistakes instead of old ones.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: PREEMPT_RT vs bcache
2013-08-07 21:08 ` Ben Hutchings
@ 2013-08-07 21:09 ` Kent Overstreet
0 siblings, 0 replies; 9+ messages in thread
From: Kent Overstreet @ 2013-08-07 21:09 UTC (permalink / raw)
To: Ben Hutchings; +Cc: Thomas Gleixner, linux-kernel, Uwe Kleine-König
On Wed, Aug 07, 2013 at 11:08:42PM +0200, Ben Hutchings wrote:
> On Wed, 2013-08-07 at 13:53 -0700, Kent Overstreet wrote:
> > On Wed, Aug 07, 2013 at 10:28:18PM +0200, Ben Hutchings wrote:
> > > As Kent said back in 2011 (commit 84759c6d18c5), bcache needs
> > > {down,up}_read_non_owner(). But these are not implemented by the -rt
> > > patchset when PREEMPT_RT_FULL is enabled. Can they be added, or is
> > > there a fundamental conflict here?
> >
> > You should be able to cherry pick
> > 84759c6d18c5144432781ddca037d929ee9db8a5 (Revert "rw_semaphore: remove
> > up/down_read_non_owner") - that went in when bcache was merged.
>
> That's the commit I was referring to. But the -rt patchset has a
> separate implementation of semaphores for PREEMPT_RT_FULL.
Ahh - that makes more sense...
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: PREEMPT_RT vs bcache
2013-08-07 20:53 ` Kent Overstreet
2013-08-07 21:08 ` Ben Hutchings
@ 2013-08-07 21:12 ` Uwe Kleine-König
1 sibling, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2013-08-07 21:12 UTC (permalink / raw)
To: Kent Overstreet; +Cc: Ben Hutchings, Thomas Gleixner, linux-kernel
On Wed, Aug 07, 2013 at 01:53:57PM -0700, Kent Overstreet wrote:
> On Wed, Aug 07, 2013 at 10:28:18PM +0200, Ben Hutchings wrote:
> > As Kent said back in 2011 (commit 84759c6d18c5), bcache needs
> > {down,up}_read_non_owner(). But these are not implemented by the -rt
> > patchset when PREEMPT_RT_FULL is enabled. Can they be added, or is
> > there a fundamental conflict here?
>
> You should be able to cherry pick
> 84759c6d18c5144432781ddca037d929ee9db8a5 (Revert "rw_semaphore: remove
> up/down_read_non_owner") - that went in when bcache was merged.
That doesn't help with PREEMPT_RT_FULL because include/linux/rwsem.h
looks like:
[ ... some includes ... ]
#ifdef CONFIG_PREEMPT_RT_FULL
#include <linux/rwsem_rt.h>
#else /* PREEMPT_RT_FULL */
[ ... vanilla content including definitions of {down,up}_read_non_owner]
#endif
So Ben's question was how (if at all) we should implement
{down,up}_read_non_owner for PREEMPT_RT_FULL.
Is it save to just use the vanilla implementation on RT?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: PREEMPT_RT vs bcache
2013-08-07 20:28 PREEMPT_RT vs bcache Ben Hutchings
2013-08-07 20:53 ` Kent Overstreet
@ 2013-08-08 7:26 ` Christoph Hellwig
2013-08-08 7:43 ` Kent Overstreet
1 sibling, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2013-08-08 7:26 UTC (permalink / raw)
To: Ben Hutchings
Cc: Thomas Gleixner, linux-kernel, Kent Overstreet, Uwe Kleine-K?nig
On Wed, Aug 07, 2013 at 10:28:18PM +0200, Ben Hutchings wrote:
> As Kent said back in 2011 (commit 84759c6d18c5), bcache needs
> {down,up}_read_non_owner(). But these are not implemented by the -rt
> patchset when PREEMPT_RT_FULL is enabled. Can they be added, or is
> there a fundamental conflict here?
How did they get back in at all? I'm pretty sure I removed them for
good reason.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: PREEMPT_RT vs bcache
2013-08-08 7:26 ` Christoph Hellwig
@ 2013-08-08 7:43 ` Kent Overstreet
2013-08-08 12:11 ` Christoph Hellwig
0 siblings, 1 reply; 9+ messages in thread
From: Kent Overstreet @ 2013-08-08 7:43 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Ben Hutchings, Thomas Gleixner, linux-kernel, Uwe Kleine-K?nig
On Thu, Aug 08, 2013 at 12:26:23AM -0700, Christoph Hellwig wrote:
> On Wed, Aug 07, 2013 at 10:28:18PM +0200, Ben Hutchings wrote:
> > As Kent said back in 2011 (commit 84759c6d18c5), bcache needs
> > {down,up}_read_non_owner(). But these are not implemented by the -rt
> > patchset when PREEMPT_RT_FULL is enabled. Can they be added, or is
> > there a fundamental conflict here?
>
> How did they get back in at all? I'm pretty sure I removed them for
> good reason.
I seem to recall from looking at the logs that you just removed them
because all the old users could be and were converted to something
saner, for what they were doing (using them as completions, I want to
say?)
Bcache isn't using the rw sem as a completion though, it really is a
read/write lock that protects a specific data structure, and where
we're taking a read lock for the duration of write IOs - and since bios
are asynchronous, that's why we need the non_owner() bit.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: PREEMPT_RT vs bcache
2013-08-08 7:43 ` Kent Overstreet
@ 2013-08-08 12:11 ` Christoph Hellwig
2013-09-12 15:01 ` Thomas Gleixner
0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2013-08-08 12:11 UTC (permalink / raw)
To: Kent Overstreet
Cc: Christoph Hellwig, Ben Hutchings, Thomas Gleixner, linux-kernel,
Uwe Kleine-K?nig
On Thu, Aug 08, 2013 at 12:43:26AM -0700, Kent Overstreet wrote:
> I seem to recall from looking at the logs that you just removed them
> because all the old users could be and were converted to something
> saner, for what they were doing (using them as completions, I want to
> say?)
We explicitly converted them away so that we could kill it. This was
a joint project with Thomas.
> Bcache isn't using the rw sem as a completion though, it really is a
> read/write lock that protects a specific data structure, and where
> we're taking a read lock for the duration of write IOs - and since bios
> are asynchronous, that's why we need the non_owner() bit.
Part of this commit was to make the rw_semaphore behaviour similar to
plain mutex, that is making sure there is exactly one owner and not
different processes locking/unlocking it. This is useful for PI (that's
why the rt folks care), lock debugging and kinds of other use cases.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: PREEMPT_RT vs bcache
2013-08-08 12:11 ` Christoph Hellwig
@ 2013-09-12 15:01 ` Thomas Gleixner
0 siblings, 0 replies; 9+ messages in thread
From: Thomas Gleixner @ 2013-09-12 15:01 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Kent Overstreet, Ben Hutchings, linux-kernel, Uwe Kleine-K?nig
On Thu, 8 Aug 2013, Christoph Hellwig wrote:
> On Thu, Aug 08, 2013 at 12:43:26AM -0700, Kent Overstreet wrote:
> > I seem to recall from looking at the logs that you just removed them
> > because all the old users could be and were converted to something
> > saner, for what they were doing (using them as completions, I want to
> > say?)
>
> We explicitly converted them away so that we could kill it. This was
> a joint project with Thomas.
>
> > Bcache isn't using the rw sem as a completion though, it really is a
> > read/write lock that protects a specific data structure, and where
> > we're taking a read lock for the duration of write IOs - and since bios
> > are asynchronous, that's why we need the non_owner() bit.
>
> Part of this commit was to make the rw_semaphore behaviour similar to
> plain mutex, that is making sure there is exactly one owner and not
> different processes locking/unlocking it. This is useful for PI (that's
> why the rt folks care), lock debugging and kinds of other use cases.
Right. We had to implement an anon_rw_semaphore version, which caused
more headache than it was worth the trouble.
The solution for one of the non owner use cases was something like the
below:
read_lock(x->lock);
atomic_inc(x->io_active);
launch_io();
read_unlock(x->lock);
On the writer side:
write_lock(x->lock);
while (atomic_read(x->io_active) {
write_unlock(x->lock);
wait_event(x->wait_for_io, !atomic_read(x->io_active));
write_lock(x->io_active);
}
....
On the io side:
complete_io()
if (atomic_dec_and_test(x->io_active) &&
waitqueue_active(x->wait_for_io))
wake_up(x->wait_for_io);
That would fit into the bcache use case afacit.
Thanks,
tglx
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-09-12 15:01 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-07 20:28 PREEMPT_RT vs bcache Ben Hutchings
2013-08-07 20:53 ` Kent Overstreet
2013-08-07 21:08 ` Ben Hutchings
2013-08-07 21:09 ` Kent Overstreet
2013-08-07 21:12 ` Uwe Kleine-König
2013-08-08 7:26 ` Christoph Hellwig
2013-08-08 7:43 ` Kent Overstreet
2013-08-08 12:11 ` Christoph Hellwig
2013-09-12 15:01 ` Thomas Gleixner
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.