From: Programmingkid <programmingkidx@gmail.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] hw/audio/sb16.c: Convert file to new logging API
Date: Wed, 31 Jan 2018 17:18:40 -0500 [thread overview]
Message-ID: <AACE3176-56CD-4D56-87F8-752EA8A5360F@gmail.com> (raw)
In-Reply-To: <BCDC8A8F-F8CE-4F71-A11C-CF7078FB6BAF@gmail.com>
> On Jan 31, 2018, at 4:43 PM, Programmingkid <programmingkidx@gmail.com> wrote:
>
>>
>> On Jan 31, 2018, at 4:22 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
>>
>> On Tue, Jan 30, 2018 at 10:30:46AM -0500, Programmingkid wrote:
>>>
>>>> On Jan 30, 2018, at 4:41 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
>>>>
>>>>> @@ -148,15 +142,16 @@ static int irq_of_magic (int magic)
>>>>> #if 0
>>>>> static void log_dsp (SB16State *dsp)
>>>>> {
>>>>> - ldebug ("%s:%s:%d:%s:dmasize=%d:freq=%d:const=%d:speaker=%d\n",
>>>>> - dsp->fmt_stereo ? "Stereo" : "Mono",
>>>>> - dsp->fmt_signed ? "Signed" : "Unsigned",
>>>>> - dsp->fmt_bits,
>>>>> - dsp->dma_auto ? "Auto" : "Single",
>>>>> - dsp->block_size,
>>>>> - dsp->freq,
>>>>> - dsp->time_const,
>>>>> - dsp->speaker);
>>>>> + qemu_log_mask(LOG_UNIMP, "%s:%s:%d:%s:dmasize=%d:freq=%d:const=%d:"
>>>>> + "speaker=%d\n",
>>>>> + dsp->fmt_stereo ? "Stereo" : "Mono",
>>>>> + dsp->fmt_signed ? "Signed" : "Unsigned",
>>>>> + dsp->fmt_bits,
>>>>> + dsp->dma_auto ? "Auto" : "Single",
>>>>> + dsp->block_size,
>>>>> + dsp->freq,
>>>>> + dsp->time_const,
>>>>> + dsp->speaker);
>>>>> }
>>>>> #endif
>>>>
>>>> Hmm, dead code. Any places which call log_dsp() ?
>>>
>>> There are several places but they are all dead code. Do you want this removed?
>>
>> So it is still used but not compiled in by default.
>>
>> Looking at all of this again, I think "qemu_log_mask(LOG_UNIMP, ...)"
>> should only be used in case there *really* is some soundblaster feature
>> unimplemented. Otherwise converting to a tracepoint is probably more
>> useful, so the debug messages can be enabled/disabled individually at
>> runtime.
>>
>> The "#if 0" seems to be there to limit the flood of debug messages. So
>> once they all are converted to trace points this is not needed any more
>> and I think we should just enable all this code.
>>
>> dolog() seems to be mostly cases where the code warns about
>> unimplemented featues or incomplete emulation, so using LOG_UNIMP looks
>> sensible.
>
> Simply replacing dolog() with "qemu_log_mask(LOG_UNIMP," seems like what was desired.
>
>> ldebug() should probably trace points.
>
> I need help with this. I tried replacing ldebug() with "qemu_log_mask(LOG_TRACE,", but that caused a lot of messages to be printed to the terminal. It is odd because I thought I had to use "-d trace" to make it print. Do you have another suggestion on what to replace ldebug() with?
>
>> Probably makes sense to split this patch up into a small series.
>
> The first patch will be the replacing dolog() with qemu_log_mask(LOG_UNIMP. The second patch will be replacing ldebug() with what you suggest.
After doing a little more research I found this code in log.c:
/* enable or disable low levels log */
void qemu_set_log(int log_flags)
{
qemu_loglevel = log_flags;
#ifdef CONFIG_TRACE_LOG
qemu_loglevel |= LOG_TRACE;
#endif
It looks like no matter what the trace level that is set, LOG_TRACE will always be used. I think this might be a mistake. The configure script will set CONFIG_TRACE_LOG if the backend is log. This appears to be the default behavior. This will lead to LOG_TRACE being set in util/log.c.
next prev parent reply other threads:[~2018-01-31 22:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-30 5:18 [Qemu-devel] [PATCH] hw/audio/sb16.c: Convert file to new logging API John Arbuckle
2018-01-30 9:41 ` Gerd Hoffmann
2018-01-30 15:30 ` Programmingkid
2018-01-31 9:22 ` Gerd Hoffmann
2018-01-31 21:43 ` Programmingkid
2018-01-31 22:18 ` Programmingkid [this message]
2018-02-01 8:17 ` Gerd Hoffmann
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=AACE3176-56CD-4D56-87F8-752EA8A5360F@gmail.com \
--to=programmingkidx@gmail.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).