All of lore.kernel.org
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
	zackr@vmware.com, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, airlied@linux.ie, daniel@ffwll.ch,
	deller@gmx.de, hdegoede@redhat.com
Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/5] fbdev: Hot-unplug firmware fb devices on forced removal
Date: Mon, 24 Jan 2022 14:56:45 +0100	[thread overview]
Message-ID: <b88309c2-7c22-3bcb-3f37-ade3e7d89617@redhat.com> (raw)
In-Reply-To: <508e6735-d5f0-610c-d4ca-b1abc093f63c@redhat.com>

On 1/24/22 14:52, Javier Martinez Canillas wrote:

[snip]

>> @@ -1898,9 +1917,13 @@ EXPORT_SYMBOL(register_framebuffer);
>>  void
>>  unregister_framebuffer(struct fb_info *fb_info)
>>  {
>> -	mutex_lock(&registration_lock);
>> +	bool forced_out = fb_info->forced_out;
>> +
>> +	if (!forced_out)
>> +		mutex_lock(&registration_lock);
>>  	do_unregister_framebuffer(fb_info);
>> -	mutex_unlock(&registration_lock);
>> +	if (!forced_out)
>> +		mutex_unlock(&registration_lock);
>>  }
> 
> I'm not sure to follow the logic here. The forced_out bool is set when the
> platform device is unregistered in do_remove_conflicting_framebuffers(),
> but shouldn't the struct platform_driver .remove callback be executed even
> in this case ?
> 
> That is, the platform_device_unregister() will trigger the call to the
> .remove callback that in turn will call unregister_framebuffer().
> 
> Shouldn't we always hold the mutex when calling do_unregister_framebuffer() ?
> 

Scratch that, I got it now. That's exactly the reason why you skip the
mutext_lock(). After adding the check for dev, feel free to add:

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Best regards,
-- 
Javier Martinez Canillas
Linux Engineering
Red Hat


WARNING: multiple messages have this Message-ID (diff)
From: Javier Martinez Canillas <javierm@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
	zackr@vmware.com, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, airlied@linux.ie, daniel@ffwll.ch,
	deller@gmx.de, hdegoede@redhat.com
Cc: linux-fbdev@vger.kernel.org, stable@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/5] fbdev: Hot-unplug firmware fb devices on forced removal
Date: Mon, 24 Jan 2022 14:56:45 +0100	[thread overview]
Message-ID: <b88309c2-7c22-3bcb-3f37-ade3e7d89617@redhat.com> (raw)
In-Reply-To: <508e6735-d5f0-610c-d4ca-b1abc093f63c@redhat.com>

On 1/24/22 14:52, Javier Martinez Canillas wrote:

[snip]

>> @@ -1898,9 +1917,13 @@ EXPORT_SYMBOL(register_framebuffer);
>>  void
>>  unregister_framebuffer(struct fb_info *fb_info)
>>  {
>> -	mutex_lock(&registration_lock);
>> +	bool forced_out = fb_info->forced_out;
>> +
>> +	if (!forced_out)
>> +		mutex_lock(&registration_lock);
>>  	do_unregister_framebuffer(fb_info);
>> -	mutex_unlock(&registration_lock);
>> +	if (!forced_out)
>> +		mutex_unlock(&registration_lock);
>>  }
> 
> I'm not sure to follow the logic here. The forced_out bool is set when the
> platform device is unregistered in do_remove_conflicting_framebuffers(),
> but shouldn't the struct platform_driver .remove callback be executed even
> in this case ?
> 
> That is, the platform_device_unregister() will trigger the call to the
> .remove callback that in turn will call unregister_framebuffer().
> 
> Shouldn't we always hold the mutex when calling do_unregister_framebuffer() ?
> 

Scratch that, I got it now. That's exactly the reason why you skip the
mutext_lock(). After adding the check for dev, feel free to add:

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Best regards,
-- 
Javier Martinez Canillas
Linux Engineering
Red Hat


  reply	other threads:[~2022-01-24 13:56 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 12:36 [PATCH 0/5] sysfb: Fix memory-region management Thomas Zimmermann
2022-01-24 12:36 ` Thomas Zimmermann
2022-01-24 12:36 ` [PATCH 1/5] fbdev: Hot-unplug firmware fb devices on forced removal Thomas Zimmermann
2022-01-24 12:36   ` Thomas Zimmermann
2022-01-24 13:52   ` Javier Martinez Canillas
2022-01-24 13:52     ` Javier Martinez Canillas
2022-01-24 13:56     ` Javier Martinez Canillas [this message]
2022-01-24 13:56       ` Javier Martinez Canillas
2022-01-24 14:19     ` Thomas Zimmermann
2022-01-24 14:19       ` Thomas Zimmermann
2022-01-24 14:31       ` Javier Martinez Canillas
2022-01-24 14:31         ` Javier Martinez Canillas
2022-01-24 15:59   ` Zack Rusin
2022-01-24 15:59     ` Zack Rusin
2022-01-24 12:36 ` [PATCH 2/5] drivers/firmware: Don't mark as busy the simple-framebuffer IO resource Thomas Zimmermann
2022-01-24 12:36   ` Thomas Zimmermann
2022-01-24 15:59   ` Zack Rusin
2022-01-24 15:59     ` Zack Rusin
2022-01-24 12:36 ` [PATCH 3/5] drm/simpledrm: Request memory region in driver Thomas Zimmermann
2022-01-24 12:36   ` Thomas Zimmermann
2022-01-24 14:00   ` Javier Martinez Canillas
2022-01-24 14:00     ` Javier Martinez Canillas
2022-01-24 14:23   ` Jocelyn Falempe
2022-01-25  8:31     ` Thomas Zimmermann
2022-01-24 12:36 ` [PATCH 4/5] fbdev/simplefb: " Thomas Zimmermann
2022-01-24 12:36   ` Thomas Zimmermann
2022-01-24 14:24   ` Javier Martinez Canillas
2022-01-24 14:24     ` Javier Martinez Canillas
2022-01-24 12:36 ` [PATCH 5/5] drm: Add TODO item for requesting memory regions Thomas Zimmermann
2022-01-24 12:36   ` Thomas Zimmermann
2022-01-24 14:25   ` Javier Martinez Canillas
2022-01-24 14:25     ` Javier Martinez Canillas
2022-01-25  9:12 [PATCH 0/5] sysfb: Fix memory-region management Thomas Zimmermann
2022-01-25  9:12 ` [PATCH 1/5] fbdev: Hot-unplug firmware fb devices on forced removal Thomas Zimmermann
2022-01-25  9:12   ` Thomas Zimmermann

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=b88309c2-7c22-3bcb-3f37-ade3e7d89617@redhat.com \
    --to=javierm@redhat.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    --cc=zackr@vmware.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.