[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84frnms3c3.fsf@jogness.linutronix.de>
Date: Wed, 20 Nov 2024 09:49:08 +0106
From: John Ogness <john.ogness@...utronix.de>
To: Chris Down <chris@...isdown.name>, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>
Cc: Petr Mladek <pmladek@...e.com>, linux-kernel@...r.kernel.org, Sergey
Senozhatsky <senozhatsky@...omium.org>, Steven Rostedt
<rostedt@...dmis.org>, Geert Uytterhoeven <geert@...ux-m68k.org>, Tony
Lindgren <tony.lindgren@...ux.intel.com>, kernel-team@...com
Subject: Re: [PATCH v6 06/11] printk: console: Introduce sysfs interface for
per-console loglevels
On 2024-11-20, Chris Down <chris@...isdown.name> wrote:
>>> +static ssize_t loglevel_show(struct device *dev, struct device_attribute *attr,
>>> + char *buf)
>>> +{
>>> + struct console *con = dev_get_drvdata(dev);
>>> +
>>> + return sysfs_emit(buf, "%d\n", READ_ONCE(con->level));
>>
>>While I admire the use of READ_ONCE() properly, it really doesn't matter
>>for sysfs as it could change right afterwards and no one cares. So no
>>need for that here, right?
>
> From my reading of the code it looks like we need this to avoid
> tearing.
I cannot imagine that any compiler would perform multiple reads to read
an aligned field of 4-bytes. Particularly since this function only reads
this one field.
At most it is kind of annotating lockless access to con->level. But
since it is not using data_race(), it would still trigger KCSAN with a
warning. I recommend removing it.
John Ogness
Powered by blists - more mailing lists