This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] Re: [PATCH] change acquire/release_console_sem() to console_

To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] change acquire/release_console_sem() to console_lock/unlock()
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
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=GJkgTaGsKirW3n0hVnqrhH1LhExXXIptCW05OAHdG9w=; b=pC9xwwolGV8XVXS/04x8a7c07Jq+fuKTMtLtCBbgVj4zEB9eKHPFw1G1B5TYbUEDb5 N/zljBCm2+D3vYhoqSw1ekg5ta8qGfH15iuBnDUF8hoejh+6hGLmsauqeab/S7kgxzmL eCcJUewjNtRiEdeuGeCFnrovIuYVQGHjlD7Nk=
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=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20110120123507.ac89c034.akpm@xxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1295539104-13210-1-git-send-email-torbenh@xxxxxx> <20110120163448.GA30588@xxxxxxx> <20110120165502.GA10832@xxxxxx> <20110120123507.ac89c034.akpm@xxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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.


 * 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.


+ * 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?



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