[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <84ed35rkir.fsf@jogness.linutronix.de>
Date: Wed, 20 Nov 2024 16:35:32 +0106
From: John Ogness <john.ogness@...utronix.de>
To: Petr Mladek <pmladek@...e.com>
Cc: Chris Down <chris@...isdown.name>, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>, 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, Petr Mladek <pmladek@...e.com> 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));
>
> Honestly, it seems that everyone agrees that the READ_ONCE() makes
> some sense. I do not understand why some many people wants to remove
> it. I personally prefer to be on the safe side.
OK, then please also annotate the data race to keep KCSAN happy:
data_race(READ_ONCE(con->level));
>From the data_race kerneldoc:
If the access must be atomic *and* KCSAN should ignore the access,
use both data_race() and READ_ONCE(), for example,
data_race(READ_ONCE(x)).
John
Powered by blists - more mailing lists