qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/display/omap_dss: Replace fprintf() call by qemu_log_mask(LOG_UNIMP)
@ 2020-05-24 10:38 Philippe Mathieu-Daudé
  2020-05-24 12:41 ` Alexander Bulekov
  2020-05-26  7:23 ` Thomas Huth
  0 siblings, 2 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-24 10:38 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Alexander Bulekov, qemu-arm,
	Philippe Mathieu-Daudé,
	Peter Maydell

Replace fprintf() call by qemu_log_mask(LOG_UNIMP), which is
disabled by default. This avoid flooding the terminal when
fuzzing the device.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/display/omap_dss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/omap_dss.c b/hw/display/omap_dss.c
index 32dc0d6aa7..21fde58a26 100644
--- a/hw/display/omap_dss.c
+++ b/hw/display/omap_dss.c
@@ -619,7 +619,7 @@ static void omap_rfbi_transfer_start(struct omap_dss_s *s)
     if (s->rfbi.control & (1 << 1)) {				/* BYPASS */
         /* TODO: in non-Bypass mode we probably need to just assert the
          * DRQ and wait for DMA to write the pixels.  */
-        fprintf(stderr, "%s: Bypass mode unimplemented\n", __func__);
+        qemu_log_mask(LOG_UNIMP, "%s: Bypass mode unimplemented\n", __func__);
         return;
     }
 
-- 
2.21.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] hw/display/omap_dss: Replace fprintf() call by qemu_log_mask(LOG_UNIMP)
  2020-05-24 10:38 [PATCH] hw/display/omap_dss: Replace fprintf() call by qemu_log_mask(LOG_UNIMP) Philippe Mathieu-Daudé
@ 2020-05-24 12:41 ` Alexander Bulekov
  2020-05-24 13:53   ` Philippe Mathieu-Daudé
  2020-05-26  7:23 ` Thomas Huth
  1 sibling, 1 reply; 4+ messages in thread
From: Alexander Bulekov @ 2020-05-24 12:41 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-trivial, Peter Maydell, qemu-arm, qemu-devel

On 200524 1238, Philippe Mathieu-Daudé wrote:
> Replace fprintf() call by qemu_log_mask(LOG_UNIMP), which is
> disabled by default. This avoid flooding the terminal when
> fuzzing the device.
> 
Hi Philippe,
libfuzzer also lets you pass -close_fd_mask=[1,2,3] to close stdout,
stderr or both. As a side-effect, In this mode, libfuzzer will write the
crashing stacktraces to individual files ./.$PID, instead of to the
terminal's output. As far as I know, closing the FDs doesn't bypass all
of printf's allocation/formatting code, so getting rid of calls can
still be a good idea for performance, sometimes.
-Alex

> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/display/omap_dss.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/display/omap_dss.c b/hw/display/omap_dss.c
> index 32dc0d6aa7..21fde58a26 100644
> --- a/hw/display/omap_dss.c
> +++ b/hw/display/omap_dss.c
> @@ -619,7 +619,7 @@ static void omap_rfbi_transfer_start(struct omap_dss_s *s)
>      if (s->rfbi.control & (1 << 1)) {				/* BYPASS */
>          /* TODO: in non-Bypass mode we probably need to just assert the
>           * DRQ and wait for DMA to write the pixels.  */
> -        fprintf(stderr, "%s: Bypass mode unimplemented\n", __func__);
> +        qemu_log_mask(LOG_UNIMP, "%s: Bypass mode unimplemented\n", __func__);
>          return;
>      }
>  
> -- 
> 2.21.3
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hw/display/omap_dss: Replace fprintf() call by qemu_log_mask(LOG_UNIMP)
  2020-05-24 12:41 ` Alexander Bulekov
@ 2020-05-24 13:53   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-24 13:53 UTC (permalink / raw)
  To: Alexander Bulekov; +Cc: qemu-trivial, Peter Maydell, qemu-arm, qemu-devel

On 5/24/20 2:41 PM, Alexander Bulekov wrote:
> On 200524 1238, Philippe Mathieu-Daudé wrote:
>> Replace fprintf() call by qemu_log_mask(LOG_UNIMP), which is
>> disabled by default. This avoid flooding the terminal when
>> fuzzing the device.
>>
> Hi Philippe,
> libfuzzer also lets you pass -close_fd_mask=[1,2,3] to close stdout,
> stderr or both. As a side-effect, In this mode, libfuzzer will write the
> crashing stacktraces to individual files ./.$PID, instead of to the
> terminal's output.

Thanks, good to know.

This information is worth adding in docs/devel/fuzzing.txt :P

> As far as I know, closing the FDs doesn't bypass all
> of printf's allocation/formatting code, so getting rid of calls can
> still be a good idea for performance, sometimes.

Certainly.

> -Alex
> 
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  hw/display/omap_dss.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/display/omap_dss.c b/hw/display/omap_dss.c
>> index 32dc0d6aa7..21fde58a26 100644
>> --- a/hw/display/omap_dss.c
>> +++ b/hw/display/omap_dss.c
>> @@ -619,7 +619,7 @@ static void omap_rfbi_transfer_start(struct omap_dss_s *s)
>>      if (s->rfbi.control & (1 << 1)) {				/* BYPASS */
>>          /* TODO: in non-Bypass mode we probably need to just assert the
>>           * DRQ and wait for DMA to write the pixels.  */
>> -        fprintf(stderr, "%s: Bypass mode unimplemented\n", __func__);
>> +        qemu_log_mask(LOG_UNIMP, "%s: Bypass mode unimplemented\n", __func__);
>>          return;
>>      }
>>  
>> -- 
>> 2.21.3
>>
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hw/display/omap_dss: Replace fprintf() call by qemu_log_mask(LOG_UNIMP)
  2020-05-24 10:38 [PATCH] hw/display/omap_dss: Replace fprintf() call by qemu_log_mask(LOG_UNIMP) Philippe Mathieu-Daudé
  2020-05-24 12:41 ` Alexander Bulekov
@ 2020-05-26  7:23 ` Thomas Huth
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2020-05-26  7:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-trivial, Alexander Bulekov, qemu-arm, Peter Maydell

On 24/05/2020 12.38, Philippe Mathieu-Daudé wrote:
> Replace fprintf() call by qemu_log_mask(LOG_UNIMP), which is
> disabled by default. This avoid flooding the terminal when
> fuzzing the device.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/display/omap_dss.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/display/omap_dss.c b/hw/display/omap_dss.c
> index 32dc0d6aa7..21fde58a26 100644
> --- a/hw/display/omap_dss.c
> +++ b/hw/display/omap_dss.c
> @@ -619,7 +619,7 @@ static void omap_rfbi_transfer_start(struct omap_dss_s *s)
>      if (s->rfbi.control & (1 << 1)) {				/* BYPASS */
>          /* TODO: in non-Bypass mode we probably need to just assert the
>           * DRQ and wait for DMA to write the pixels.  */
> -        fprintf(stderr, "%s: Bypass mode unimplemented\n", __func__);
> +        qemu_log_mask(LOG_UNIMP, "%s: Bypass mode unimplemented\n", __func__);
>          return;
>      }

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-26  7:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-24 10:38 [PATCH] hw/display/omap_dss: Replace fprintf() call by qemu_log_mask(LOG_UNIMP) Philippe Mathieu-Daudé
2020-05-24 12:41 ` Alexander Bulekov
2020-05-24 13:53   ` Philippe Mathieu-Daudé
2020-05-26  7:23 ` Thomas Huth

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).