[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Xen-devel] Re: [PATCH] change acquire/release_console_sem() to console_lock/unlock()
- To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
- From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
- Date: Fri, 21 Jan 2011 09:10:06 +0100
- Cc: linux-fbdev@xxxxxxxxxxxxxxx, Greg KH <gregkh@xxxxxxx>, Lars-Peter Clausen <lars@xxxxxxxxxx>, James Hogan <james@xxxxxxxxxxxxx>, David Airlie <airlied@xxxxxxxx>, Daniel Vetter <daniel.vetter@xxxxxxxx>, linux-omap@xxxxxxxxxxxxxxx, Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>, "James E.J. Bottomley" <jejb@xxxxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Paul Mackerras <paulus@xxxxxxxxx>, Liam Girdwood <lrg@xxxxxxxxxxxxxxx>, Kyle McMartin <kyle@xxxxxxxxxxx>, Jiri Slaby <jslaby@xxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Caglar Akyuz <caglar@xxxxxxxxxxxxxxxxxxxxx>, devel@xxxxxxxxxxxxxxxxxxxx, Alberto Panizzo <maramaopercheseimorto@xxxxxxxxx>, Phil Edworthy <phil.edworthy@xxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, Russell King <linux@xxxxxxxxxxxxxxxx>, Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>, Wu Zhangjin <wuzhangjin@xxxxxxxxx>, Florian Tobias Schandinat <FlorianSchandinat@xxxxxx>, Lionel Debroux <lionel_debroux@xxxxxxxx>, Helge Deller <deller@xxxxxx>, Kay Sievers <kay.sievers@xxxxxxxx>, James Morris <jmorris@xxxxxxxxx>, Kevin Hilman <khilman@xxxxxxxxxxxxxxxxxxx>, Tony Lindgren <tony@xxxxxxxxxxx>, Ben Skeggs <bskeggs@xxxxxxxxxx>, Andres Salomon <dilinger@xxxxxxxxxx>, Julia Lawall <julia@xxxxxxx>, Dave Airlie <airlied@xxxxxxxxxx>, Kees Cook <kees.cook@xxxxxxxxxxxxx>, Francisco Jerez <currojerez@xxxxxxxxxx>, Abhijeet Dharmapurikar <adharmap@xxxxxxxxxxxxxx>, Marcin Slusarz <marcin.slusarz@xxxxxxxxx>, cbe-oss-dev@xxxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, Ondrej Zary <linux@xxxxxxxxxxxxxxxxxxxx>, Denys Vlasenko <vda.linux@xxxxxxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, Namhyung Kim <namhyung@xxxxxxxxx>, Rusty Russell <rusty@xxxxxxxxxxxxxxx>, Werner Fink <werner@xxxxxxx>, linux-geode@xxxxxxxxxxxxxxxxxxx, torbenh <torbenh@xxxxxx>, Jean Delvare <khali@xxxxxxxxxxxx>, Magnus Damm <damm@xxxxxxxxxxxxx>, Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>, dri-devel@xxxxxxxxxxxxxxxxxxxxx, Daniel Mack <daniel@xxxxxxxx>, Nicolas Pitre <nicolas.pitre@xxxxxxxxxxxxx>, Dan Williams <dan.j.williams@xxxxxxxxx>, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, Ingo Molnar <mingo@xxxxxxx>, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, Thomas Gleixner <tglx@xxxxxxx>, Daniel Walker <dwalker@xxxxxxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxxxxxx>, linux-parisc@xxxxxxxxxxxxxxx, Geoff Levand <geoff@xxxxxxxxxxxxx>, Jiri Kosina <jkosina@xxxxxxx>, Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>, Jerome Glisse <jglisse@xxxxxxxxxx>, Ralf Baechle <ralf@xxxxxxxxxxxxxx>, Alexey Dobriyan <adobriyan@xxxxxxxxx>, Guy Martin <gmsoft@xxxxxxxxxxxx>, Ondrej Zajicek <santiago@xxxxxxxxxxxxx>, Paul Mundt <lethal@xxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Takashi Iwai <tiwai@xxxxxxx>, Jason Wessel <jason.wessel@xxxxxxxxxxxxx>, Alex Deucher <alexdeucher@xxxxxxxxx>, Tejun Heo <tj@xxxxxxxxxx>, Antonino Daplas <adaplas@xxxxxxxxx>, Guennadi Liakhovetski <g.liakhovetski@xxxxxx>, Marcin KoÅcielnicki <koriakin@xxxxxxxx>, David Brown <davidb@xxxxxxxxxxxxxx>
- Delivery-date: Fri, 21 Jan 2011 04:50:40 -0800
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=CVehsm/Vb+2x/sAOPXslziqUdtBASJTAtSZpNccRBaULOUF8sEVxPRFFAg9Lk8CGa3 oJDVvKvMkfaF/c2ngmzd7jVUEFavpP6KhjjgpFry6uPukdWC4KLcP4C6p+8LIK1pVZF7 qn0PfWNjB6Yc1ZpX9O5S1LIOOVyHvs2Mq0Zho=
- List-id: Xen developer discussion <xen-devel.lists.xensource.com>
On Thu, Jan 20, 2011 at 21:35, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Thu, 20 Jan 2011 17:55:02 +0100
> torbenh <torbenh@xxxxxx> wrote:
>
>> On Thu, Jan 20, 2011 at 08:34:48AM -0800, Greg KH wrote:
>> > On Thu, Jan 20, 2011 at 04:58:13PM +0100, Torben Hohn wrote:
>> > > the -rt patches change the console_semaphore to console_mutex.
>> > > so a quite large chunk of the patches changes all
>> > > acquire/release_console_sem() to acquire/release_console_mutex()
>> >
>> > Why not just change the functionality of the existing function to be a
>> > mutex in the rt patches, instead of having to rename it everywhere?
>>
>> i hope that Thomas already did this in his upcoming -rt series.
>>
>> >
>> > > this commit makes things use more neutral function names
>> > > which dont make implications about the underlying lock.
>> > >
>> > > the only real change is the return value of console_trylock
>> > > which is inverted from try_acquire_console_sem()
>> > >
>> > > Signed-off-by: Torben Hohn <torbenh@xxxxxx>
>> > > CC: Thomas Gleixner <tglx@xxxxxxx>
>> >
>> > I don't mind this rename, but is it really going to help anything out?
>> > What's the odds of the -rt portion of this patch ever making it to
>> > mainline?
>>
>> the -rt portion only changes the semaphore to a mutex.
>> since the console_sem is used with mutex semantics, i dont see any
>> reason, not to merge that portion too.
>>
>> i am just trying to shrink the -rt patch to make it more maintanable :)
>>
>
> Yeah, I think it's a better name and if we can indeed switch that
> semaphore to a mutex then that's a good thing to do.
include/linux/mutex.h:
/*
* NOTE: mutex_trylock() follows the spin_trylock() convention,
* not the down_trylock() convention!
*
* Returns 1 if the mutex has been acquired successfully, and 0 on contention.
*/
extern int mutex_trylock(struct mutex *lock);
So that's why the return value was inverted (when treating it as a boolean).
I can understand that.
However:
+/**
+ * console_trylock - try to lock the console system for exclusive use.
+ *
+ * Tried to acquire a lock which guarantees that the caller has
+ * exclusive access to the console system and the console_drivers list.
+ *
+ * returns -1 on success, and 0 on failure to acquire the lock.
+ */
+int console_trylock(void)
So this one returns -1 on success, not 1? Why?
Gr{oetje,eeting}s,
            Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
             Â Â -- Linus Torvalds
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|