linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
	Steven Rostedt <rostedt@goodmis.org>
Cc: Petr Mladek <pmladek@suse.com>,
	linux-fbdev@vger.kernel.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [PATCH v5 2/3] fbcon: Call WARN_CONSOLE_UNLOCKED() where applicable
Date: Wed, 11 Jul 2018 15:14:20 +0000	[thread overview]
Message-ID: <d528a539-255c-f019-eb6f-63f0585e0de3@redhat.com> (raw)
In-Reply-To: <7ec11c96-7dd5-ec12-548e-7c1fa9b883e8@suse.de>

Hi,

On 11-07-18 17:07, Thomas Zimmermann wrote:
> Hi
> 
> Am 11.07.2018 um 16:52 schrieb Steven Rostedt:
>>
>> What if you make lockless_register_fb visible to fbcon, and then we can
>> have a macro:
> 
> There are more of these macro invocations under drivers/tty/vt, which
> also mess up the log during debugging.

Hmm, so this option is already broken (in a way) then, my first reaction
to your mail was that we should just remove that option. But that seemed
a bit harsh to me so I've been working on a fix for the last 10 minutes
or so.

But if it is already broken I'm tempted to just remove the option and
be done with it.  We really need less cruft in the fbdev/fbcon code not
more.

> WARN_CONSOLE_UNLOCKED is already protected by an '#ifdef 1 ... #else
> ...' construct [1]. I thought about turning this into a config option.

Ah I noticed the #if but I did not notice that it was a "#if 1".

If you want to fix lockless_register_fb it really should be replaced
with a runtime check, not a Kconfig option. This would require having
some lockless variable in the console code itself, which then gets
set by the fbdev code during init based on its lockless_register_fb
setting.

But as said I think we should seriously consider just removing
lockless_register_fb.

Regards,

Hans






> 
> Best regards
> Thomas
> 
> [1]
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/console.h#n203
> 
>>
>> #define WARN_FB_CONSOLE_UNLOCKED() 			\
>> 	do {						\
>> 		if (unlikely(!lockless_register_fb))	\
>> 			WARN_CONSOLE_UNLOCKED();	\
>> 	} while (0)
>>
>> And use that instead?
>>
>> -- Steve
>>
>>
>>> Best regards
>>> Thomas
>>>
>>>> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
>>>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>>> Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>>> ---
>>>> Changes in v3:
>>>> -New patch in v3 of this patchset
>>>>
>>>> Changes in v4:
>>>> -Keep the comments about which fbcon functions need locks in place
>>>> ---
>>>>   drivers/video/fbdev/core/fbcon.c | 11 +++++++++++
>>>>   1 file changed, 11 insertions(+)
>>>>
>>>> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
>>>> index c910e74d46ff..cd8d52a967aa 100644
>>>> --- a/drivers/video/fbdev/core/fbcon.c
>>>> +++ b/drivers/video/fbdev/core/fbcon.c
>>>> @@ -828,6 +828,8 @@ static int set_con2fb_map(int unit, int newidx, int user)
>>>>   	struct fb_info *oldinfo = NULL;
>>>>    	int found, err = 0;
>>>>   
>>>> +	WARN_CONSOLE_UNLOCKED();
>>>> +
>>>>   	if (oldidx = newidx)
>>>>   		return 0;
>>>>   
>>>> @@ -3044,6 +3046,8 @@ static int fbcon_fb_unbind(int idx)
>>>>   {
>>>>   	int i, new_idx = -1, ret = 0;
>>>>   
>>>> +	WARN_CONSOLE_UNLOCKED();
>>>> +
>>>>   	if (!fbcon_has_console_bind)
>>>>   		return 0;
>>>>   
>>>> @@ -3094,6 +3098,8 @@ static int fbcon_fb_unregistered(struct fb_info *info)
>>>>   {
>>>>   	int i, idx;
>>>>   
>>>> +	WARN_CONSOLE_UNLOCKED();
>>>> +
>>>>   	idx = info->node;
>>>>   	for (i = first_fb_vc; i <= last_fb_vc; i++) {
>>>>   		if (con2fb_map[i] = idx)
>>>> @@ -3131,6 +3137,9 @@ static int fbcon_fb_unregistered(struct fb_info *info)
>>>>   static void fbcon_remap_all(int idx)
>>>>   {
>>>>   	int i;
>>>> +
>>>> +	WARN_CONSOLE_UNLOCKED();
>>>> +
>>>>   	for (i = first_fb_vc; i <= last_fb_vc; i++)
>>>>   		set_con2fb_map(i, idx, 0);
>>>>   
>>>> @@ -3177,6 +3186,8 @@ static int fbcon_fb_registered(struct fb_info *info)
>>>>   {
>>>>   	int ret = 0, i, idx;
>>>>   
>>>> +	WARN_CONSOLE_UNLOCKED();
>>>> +
>>>>   	idx = info->node;
>>>>   	fbcon_select_primary(info);
>>>>     
>>>
>>
> 

  reply	other threads:[~2018-07-11 15:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180628090357epcas5p28361ab4b3ce11c179a167548f4851983@epcas5p2.samsung.com>
2018-06-28  9:03 ` [PATCH v5 0/3] console/fbcon: Add support for deferred console takeover Hans de Goede
2018-06-28  9:03   ` [PATCH v5 1/3] printk: Export is_console_locked Hans de Goede
2018-06-28  9:03   ` [PATCH v5 2/3] fbcon: Call WARN_CONSOLE_UNLOCKED() where applicable Hans de Goede
2018-07-11 14:46     ` Thomas Zimmermann
2018-07-11 14:52       ` Steven Rostedt
2018-07-11 15:01         ` Hans de Goede
2018-07-11 15:07           ` Daniel Vetter
2018-07-11 15:07         ` Thomas Zimmermann
2018-07-11 15:14           ` Hans de Goede [this message]
2018-07-11 15:28             ` Daniel Vetter
2018-07-11 15:35               ` Hans de Goede
2018-07-11 15:41                 ` Steven Rostedt
2018-07-11 15:42                 ` Daniel Vetter
2018-07-11 17:35                   ` Hans de Goede
2018-07-11 17:56                     ` Daniel Vetter
2018-07-11 19:19                       ` Steven Rostedt
2018-07-11 19:41                         ` Hans de Goede
2018-07-12 10:16                         ` Thomas Zimmermann
2018-07-11 23:59       ` Sergey Senozhatsky
2018-06-28  9:03   ` [PATCH v5 3/3] console/fbcon: Add support for deferred console takeover Hans de Goede
2018-07-03 16:13     ` Sergey Senozhatsky
2018-07-03 16:14       ` Steven Rostedt
2018-07-03 16:36         ` Sergey Senozhatsky
2018-06-28 13:50   ` [PATCH v5 0/3] " Bartlomiej Zolnierkiewicz
2018-06-28 15:24     ` Hans de Goede
2018-06-28 22:44     ` Gustavo Padovan
2018-06-29 10:08       ` Bartlomiej Zolnierkiewicz
2018-06-29 12:51         ` Gustavo Padovan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d528a539-255c-f019-eb6f-63f0585e0de3@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).