diff mbox

[1/1] fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set

Message ID 20180718083633.24182-2-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Zimmermann July 18, 2018, 8:36 a.m. UTC
If the console is unlocked during registration, the console subsystem
generates significant amounts of warnings, which obfuscate actual
debugging messages. Setting ignore_console_lock_warning while debugging
console registration avoid the noise.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/video/fbdev/core/fbmem.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Hans de Goede July 18, 2018, 8:44 a.m. UTC | #1
Hi,

On 18-07-18 10:36, Thomas Zimmermann wrote:
> If the console is unlocked during registration, the console subsystem
> generates significant amounts of warnings, which obfuscate actual
> debugging messages. Setting ignore_console_lock_warning while debugging
> console registration avoid the noise.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Thank you for doing this, but there are multiple console_unlock exit
paths in do_register_framebuffer(), you missed the one in:

         if (!lock_fb_info(fb_info)) {
                 if (!lockless_register_fb)
                         console_unlock();
                 return -ENODEV;
         }

I would change this to:

         if (!lock_fb_info(fb_info)) {
                 ret = -ENODEV;
		goto unlock_console;
         }

	ret = 0;

And put a "unlock_console:" label here:

unlock_console:
    	if (!lockless_register_fb)
    		console_unlock();
	else
		ignore_console_lock_warning =
			saved_ignore_console_lock_warning;

And change the final return to:

	return ret;

Otherwise this looks good to me.

Regards,

Hans





> ---
>   drivers/video/fbdev/core/fbmem.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> index 9e2f9d3c760e..79b489ad603d 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1627,6 +1627,7 @@ static int do_register_framebuffer(struct fb_info *fb_info)
>   	int i, ret;
>   	struct fb_event event;
>   	struct fb_videomode mode;
> +	bool saved_ignore_console_lock_warning = ignore_console_lock_warning;
>   
>   	if (fb_check_foreignness(fb_info))
>   		return -ENOSYS;
> @@ -1691,6 +1692,8 @@ static int do_register_framebuffer(struct fb_info *fb_info)
>   	event.info = fb_info;
>   	if (!lockless_register_fb)
>   		console_lock();
> +	else
> +		ignore_console_lock_warning = true;
>   	if (!lock_fb_info(fb_info)) {
>   		if (!lockless_register_fb)
>   			console_unlock();
> @@ -1701,6 +1704,9 @@ static int do_register_framebuffer(struct fb_info *fb_info)
>   	unlock_fb_info(fb_info);
>   	if (!lockless_register_fb)
>   		console_unlock();
> +	else
> +		ignore_console_lock_warning =
> +			saved_ignore_console_lock_warning;
>   	return 0;
>   }
>   
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thomas Zimmermann July 18, 2018, 9:13 a.m. UTC | #2
Am 18.07.2018 um 10:44 schrieb Hans de Goede:
> Hi,
> 
> On 18-07-18 10:36, Thomas Zimmermann wrote:
>> If the console is unlocked during registration, the console subsystem
>> generates significant amounts of warnings, which obfuscate actual
>> debugging messages. Setting ignore_console_lock_warning while debugging
>> console registration avoid the noise.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> Thank you for doing this, but there are multiple console_unlock exit
> paths in do_register_framebuffer(), you missed the one in:

Sorry for this half-baked patch and thanks for the review. I'll provide
an update.

Best regards
Thomas


> 
>         if (!lock_fb_info(fb_info)) {
>                 if (!lockless_register_fb)
>                         console_unlock();
>                 return -ENODEV;
>         }
> 
> I would change this to:
> 
>         if (!lock_fb_info(fb_info)) {
>                 ret = -ENODEV;
>         goto unlock_console;
>         }
> 
>     ret = 0;
> 
> And put a "unlock_console:" label here:
> 
> unlock_console:
>        if (!lockless_register_fb)
>            console_unlock();
>     else
>         ignore_console_lock_warning =
>             saved_ignore_console_lock_warning;
> 
> And change the final return to:
> 
>     return ret;
> 
> Otherwise this looks good to me.
> 
> Regards,
> 
> Hans
> 
> 
> 
> 
> 
>> ---
>>   drivers/video/fbdev/core/fbmem.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/video/fbdev/core/fbmem.c
>> b/drivers/video/fbdev/core/fbmem.c
>> index 9e2f9d3c760e..79b489ad603d 100644
>> --- a/drivers/video/fbdev/core/fbmem.c
>> +++ b/drivers/video/fbdev/core/fbmem.c
>> @@ -1627,6 +1627,7 @@ static int do_register_framebuffer(struct
>> fb_info *fb_info)
>>       int i, ret;
>>       struct fb_event event;
>>       struct fb_videomode mode;
>> +    bool saved_ignore_console_lock_warning =
>> ignore_console_lock_warning;
>>         if (fb_check_foreignness(fb_info))
>>           return -ENOSYS;
>> @@ -1691,6 +1692,8 @@ static int do_register_framebuffer(struct
>> fb_info *fb_info)
>>       event.info = fb_info;
>>       if (!lockless_register_fb)
>>           console_lock();
>> +    else
>> +        ignore_console_lock_warning = true;
>>       if (!lock_fb_info(fb_info)) {
>>           if (!lockless_register_fb)
>>               console_unlock();
>> @@ -1701,6 +1704,9 @@ static int do_register_framebuffer(struct
>> fb_info *fb_info)
>>       unlock_fb_info(fb_info);
>>       if (!lockless_register_fb)
>>           console_unlock();
>> +    else
>> +        ignore_console_lock_warning =
>> +            saved_ignore_console_lock_warning;
>>       return 0;
>>   }
>>
kernel test robot July 18, 2018, 7:21 p.m. UTC | #3
Hi Thomas,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on sof-driver-fuweitax/master]
[also build test ERROR on v4.18-rc5 next-20180718]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/fbdev-core-Disable-console-lock-warnings-when-fb-lockless_register_fb-is-set/20180719-023035
base:   https://github.com/fuweitax/linux master
config: x86_64-randconfig-x018-201828 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/video/fbdev/core/fbmem.c: In function 'do_register_framebuffer':
>> drivers/video/fbdev/core/fbmem.c:1642:43: error: 'ignore_console_lock_warning' undeclared (first use in this function); did you mean 'saved_ignore_console_lock_warning'?
     bool saved_ignore_console_lock_warning = ignore_console_lock_warning;
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                              saved_ignore_console_lock_warning
   drivers/video/fbdev/core/fbmem.c:1642:43: note: each undeclared identifier is reported only once for each function it appears in

vim +1642 drivers/video/fbdev/core/fbmem.c

  1631	
  1632	static bool lockless_register_fb;
  1633	module_param_named_unsafe(lockless_register_fb, lockless_register_fb, bool, 0400);
  1634	MODULE_PARM_DESC(lockless_register_fb,
  1635		"Lockless framebuffer registration for debugging [default=off]");
  1636	
  1637	static int do_register_framebuffer(struct fb_info *fb_info)
  1638	{
  1639		int i, ret;
  1640		struct fb_event event;
  1641		struct fb_videomode mode;
> 1642		bool saved_ignore_console_lock_warning = ignore_console_lock_warning;
  1643	
  1644		if (fb_check_foreignness(fb_info))
  1645			return -ENOSYS;
  1646	
  1647		ret = do_remove_conflicting_framebuffers(fb_info->apertures,
  1648							 fb_info->fix.id,
  1649							 fb_is_primary_device(fb_info));
  1650		if (ret)
  1651			return ret;
  1652	
  1653		if (num_registered_fb == FB_MAX)
  1654			return -ENXIO;
  1655	
  1656		num_registered_fb++;
  1657		for (i = 0 ; i < FB_MAX; i++)
  1658			if (!registered_fb[i])
  1659				break;
  1660		fb_info->node = i;
  1661		atomic_set(&fb_info->count, 1);
  1662		mutex_init(&fb_info->lock);
  1663		mutex_init(&fb_info->mm_lock);
  1664	
  1665		fb_info->dev = device_create(fb_class, fb_info->device,
  1666					     MKDEV(FB_MAJOR, i), NULL, "fb%d", i);
  1667		if (IS_ERR(fb_info->dev)) {
  1668			/* Not fatal */
  1669			printk(KERN_WARNING "Unable to create device for framebuffer %d; errno = %ld\n", i, PTR_ERR(fb_info->dev));
  1670			fb_info->dev = NULL;
  1671		} else
  1672			fb_init_device(fb_info);
  1673	
  1674		if (fb_info->pixmap.addr == NULL) {
  1675			fb_info->pixmap.addr = kmalloc(FBPIXMAPSIZE, GFP_KERNEL);
  1676			if (fb_info->pixmap.addr) {
  1677				fb_info->pixmap.size = FBPIXMAPSIZE;
  1678				fb_info->pixmap.buf_align = 1;
  1679				fb_info->pixmap.scan_align = 1;
  1680				fb_info->pixmap.access_align = 32;
  1681				fb_info->pixmap.flags = FB_PIXMAP_DEFAULT;
  1682			}
  1683		}	
  1684		fb_info->pixmap.offset = 0;
  1685	
  1686		if (!fb_info->pixmap.blit_x)
  1687			fb_info->pixmap.blit_x = ~(u32)0;
  1688	
  1689		if (!fb_info->pixmap.blit_y)
  1690			fb_info->pixmap.blit_y = ~(u32)0;
  1691	
  1692		if (!fb_info->modelist.prev || !fb_info->modelist.next)
  1693			INIT_LIST_HEAD(&fb_info->modelist);
  1694	
  1695		if (fb_info->skip_vt_switch)
  1696			pm_vt_switch_required(fb_info->dev, false);
  1697		else
  1698			pm_vt_switch_required(fb_info->dev, true);
  1699	
  1700		fb_var_to_videomode(&mode, &fb_info->var);
  1701		fb_add_videomode(&mode, &fb_info->modelist);
  1702		registered_fb[i] = fb_info;
  1703	
  1704		event.info = fb_info;
  1705		if (!lockless_register_fb)
  1706			console_lock();
  1707		else
  1708			ignore_console_lock_warning = true;
  1709		if (!lock_fb_info(fb_info)) {
  1710			if (!lockless_register_fb)
  1711				console_unlock();
  1712			return -ENODEV;
  1713		}
  1714	
  1715		fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
  1716		unlock_fb_info(fb_info);
  1717		if (!lockless_register_fb)
  1718			console_unlock();
  1719		else
  1720			ignore_console_lock_warning =
  1721				saved_ignore_console_lock_warning;
  1722		return 0;
  1723	}
  1724	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 9e2f9d3c760e..79b489ad603d 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1627,6 +1627,7 @@  static int do_register_framebuffer(struct fb_info *fb_info)
 	int i, ret;
 	struct fb_event event;
 	struct fb_videomode mode;
+	bool saved_ignore_console_lock_warning = ignore_console_lock_warning;
 
 	if (fb_check_foreignness(fb_info))
 		return -ENOSYS;
@@ -1691,6 +1692,8 @@  static int do_register_framebuffer(struct fb_info *fb_info)
 	event.info = fb_info;
 	if (!lockless_register_fb)
 		console_lock();
+	else
+		ignore_console_lock_warning = true;
 	if (!lock_fb_info(fb_info)) {
 		if (!lockless_register_fb)
 			console_unlock();
@@ -1701,6 +1704,9 @@  static int do_register_framebuffer(struct fb_info *fb_info)
 	unlock_fb_info(fb_info);
 	if (!lockless_register_fb)
 		console_unlock();
+	else
+		ignore_console_lock_warning =
+			saved_ignore_console_lock_warning;
 	return 0;
 }