mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jocelyn Falempe <jfalempe@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	John Ogness <john.ogness@linutronix.de>,
	Javier Martinez Canillas <javierm@redhat.com>,
	"Guilherme G . Piccoli" <gpiccoli@igalia.com>,
	bluescreen_avenger@verizon.net,
	Caleb Connolly <caleb.connolly@linaro.org>,
	Petr Mladek <pmladek@suse.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 4/7] drm/log: Do not draw if drm_master is taken
Date: Fri, 8 Nov 2024 14:51:10 +0100	[thread overview]
Message-ID: <bb6f5ff1-71c1-4b1b-a618-7f72310598f2@redhat.com> (raw)
In-Reply-To: <5e19d9d4-7533-4a59-a665-cfc4a8195293@suse.de>

On 08/11/2024 14:33, Thomas Zimmermann wrote:
> Hi
> 
> Am 08.11.24 um 09:10 schrieb Jocelyn Falempe:
>> When userspace takes drm_master, the drm_client buffer is no more
>> visible, so drm_log shouldn't waste CPU cycle to draw on it.
>>
>> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
>> ---
>>   drivers/gpu/drm/drm_log.c | 10 ++++++++--
>>   1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_log.c b/drivers/gpu/drm/drm_log.c
>> index 376ee173d99d9..226e206e8b6a3 100644
>> --- a/drivers/gpu/drm/drm_log.c
>> +++ b/drivers/gpu/drm/drm_log.c
>> @@ -18,6 +18,7 @@
>>   #include <drm/drm_print.h>
>>   #include "drm_draw.h"
>> +#include "drm_internal.h"
>>   #include "drm_log.h"
>>   MODULE_AUTHOR("Jocelyn Falempe");
>> @@ -308,8 +309,13 @@ static void drm_log_write_thread(struct console 
>> *con, struct nbcon_write_context
>>       if (!dlog->probed)
>>           drm_log_init_client(dlog);
>> -    for (i = 0; i < dlog->n_scanout; i++)
>> -        drm_log_draw_kmsg_record(&dlog->scanout[i], wctxt->outbuf, 
>> wctxt->len);
>> +    /* Check that we are still the master before drawing */
>> +    if (drm_master_internal_acquire(dlog->client.dev)) {
> 
> Just a note: it would be better to track this state in the client code 
> and handle these locks automatically. But it's ok for now. It would 
> require an overhaul of the fbdev helpers as well.
> 
>> +        drm_master_internal_release(dlog->client.dev);
> 
> Don't you have to release after drawing?

I'm not sure, the drawing code will only call 
drm_client_buffer_vmap_local() / unmap
and drm_client_framebuffer_flush(), and they don't require the master 
lock to be taken. I think master lock is needed only for modesetting.

Also the dlog->lock is taken by the console thread, so there are no race 
conditions with the drm_client callbacks (hotplug/suspend/resume).

> 
> Best regards
> Thomas
> 
> 
>> +
>> +        for (i = 0; i < dlog->n_scanout; i++)
>> +            drm_log_draw_kmsg_record(&dlog->scanout[i], wctxt- 
>> >outbuf, wctxt->len);
>> +    }
>>   }
>>   static void drm_log_lock(struct console *con, unsigned long *flags)
> 


  reply	other threads:[~2024-11-08 13:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08  8:10 [PATCH v7 0/7] drm/log: Introduce a new boot logger to draw the kmsg on the screen Jocelyn Falempe
2024-11-08  8:10 ` [PATCH v7 1/7] drm/panic: Move drawing functions to drm_draw Jocelyn Falempe
2024-11-11 13:03   ` Thomas Zimmermann
2024-11-08  8:10 ` [PATCH v7 2/7] drm/client: Always select DRM_CLIENT_LIB Jocelyn Falempe
2024-11-08 11:56   ` kernel test robot
2024-11-08  8:10 ` [PATCH v7 3/7] drm/log: Introduce a new boot logger to draw the kmsg on the screen Jocelyn Falempe
2024-11-08 12:27   ` kernel test robot
2024-11-08 13:08   ` kernel test robot
2024-11-08  8:10 ` [PATCH v7 4/7] drm/log: Do not draw if drm_master is taken Jocelyn Falempe
2024-11-08 13:33   ` Thomas Zimmermann
2024-11-08 13:51     ` Jocelyn Falempe [this message]
2024-11-08  8:10 ` [PATCH v7 5/7] drm/log: Color the timestamp, to improve readability Jocelyn Falempe
2024-11-08  8:10 ` [PATCH v7 6/7] drm/log: Implement suspend/resume Jocelyn Falempe
2024-11-08  8:10 ` [PATCH v7 7/7] drm/log: Add integer scaling support Jocelyn Falempe
2024-11-11 13:06   ` Thomas Zimmermann
2024-11-12  9:51     ` Jocelyn Falempe

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=bb6f5ff1-71c1-4b1b-a618-7f72310598f2@redhat.com \
    --to=jfalempe@redhat.com \
    --cc=airlied@gmail.com \
    --cc=bluescreen_avenger@verizon.net \
    --cc=caleb.connolly@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gpiccoli@igalia.com \
    --cc=javierm@redhat.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=pmladek@suse.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

all inboxes | Powered by JetHome®