[Qemu-devel] [PATCH v3 0/9] IDE: replace printfs with tracing

John Snow posted 9 patches 6 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170901001502.29915-1-jsnow@redhat.com
Test FreeBSD passed
Test checkpatch failed
Test docker passed
Test s390x passed
Makefile.objs             |   1 +
hw/ide/ahci.c             | 243 +++++++++++++++++++++++-----------------------
hw/ide/ahci_internal.h    |  44 +++++++--
hw/ide/atapi.c            |  69 +++++--------
hw/ide/cmd646.c           |  10 +-
hw/ide/core.c             | 185 ++++++++++++++++++++++-------------
hw/ide/pci.c              |  17 +---
hw/ide/piix.c             |  11 +--
hw/ide/trace-events       | 111 +++++++++++++++++++++
hw/ide/via.c              |  10 +-
include/hw/ide/internal.h |   8 +-
11 files changed, 437 insertions(+), 272 deletions(-)
create mode 100644 hw/ide/trace-events
[Qemu-devel] [PATCH v3 0/9] IDE: replace printfs with tracing
Posted by John Snow 6 years, 8 months ago
Wherever possible, replace all printfs with proper tracing.
In most places I've tried to do a straight replacement, but
forthcoming patches may calibrate the tracing to be a little nicer.

For now, it's nice to just remove the all-or-nothing tracing.

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/9:[----] [--] 'IDE: replace DEBUG_IDE with tracing system'
002/9:[----] [--] 'IDE: Add register hints to tracing'
003/9:[----] [--] 'IDE: add tracing for data ports'
004/9:[0002] [FC] 'ATAPI: Replace DEBUG_IDE_ATAPI with tracing events'
005/9:[0011] [FC] 'IDE: replace DEBUG_AIO with trace events'
006/9:[----] [--] 'AHCI: Replace DPRINTF with trace-events'
007/9:[0004] [FC] 'AHCI: Rework IRQ constants'
008/9:[0052] [FC] 'AHCI: pretty-print FIS to buffer instead of stderr'
009/9:[----] [--] 'AHCI: remove DPRINTF macro'

===
v3:
===

04: Change preprocessor gate mechanism for building cmd
           packet buffer dumps (Stefan)
05: Add getter for IDE_DMA_CMD enumeration (Philippe)
07: Changed AHCI enumeration to match changes in 05,
    (But leave assert in place to guard lookup table instead
         of adding getter.)
08: Replace FIS buffer printer with something simpler (Stefan)
    Change preprocessor gate mechanism for building AHCI buffer dumps (Stefan)
    enconstify char parameters in trace-events file (Stefan)

===
v2:
===

01: Rehabilitate commit message.
    Fix switch () statement spacing. (Eric)
    Adjust spacing in ide-tracing file to maintain columns.
    Change filename orderings in trace-events. (Eric)
    Fixed newline issue in trace-events. (Eric)

02: Context / Added R-B.

03: Added trace-events items to appropriate patch (removed from 04) (Eric)
    Added a verbose warning for data tracers (Eric)

04: Shifted items to 03 (Eric)
    Fixed newline issue (Eric)

05: Changed __END to __COUNT (Philippe)
    Removed __BEGIN enumerator (Philippe)

06: Added more information to unknown write (Philippe)

08: Context (Entropy)

John Snow (9):
  IDE: replace DEBUG_IDE with tracing system
  IDE: Add register hints to tracing
  IDE: add tracing for data ports
  ATAPI: Replace DEBUG_IDE_ATAPI with tracing events
  IDE: replace DEBUG_AIO with trace events
  AHCI: Replace DPRINTF with trace-events
  AHCI: Rework IRQ constants
  AHCI: pretty-print FIS to buffer instead of stderr
  AHCI: remove DPRINTF macro

 Makefile.objs             |   1 +
 hw/ide/ahci.c             | 243 +++++++++++++++++++++++-----------------------
 hw/ide/ahci_internal.h    |  44 +++++++--
 hw/ide/atapi.c            |  69 +++++--------
 hw/ide/cmd646.c           |  10 +-
 hw/ide/core.c             | 185 ++++++++++++++++++++++-------------
 hw/ide/pci.c              |  17 +---
 hw/ide/piix.c             |  11 +--
 hw/ide/trace-events       | 111 +++++++++++++++++++++
 hw/ide/via.c              |  10 +-
 include/hw/ide/internal.h |   8 +-
 11 files changed, 437 insertions(+), 272 deletions(-)
 create mode 100644 hw/ide/trace-events

-- 
2.9.5


Re: [Qemu-devel] [PATCH v3 0/9] IDE: replace printfs with tracing
Posted by no-reply@patchew.org 6 years, 8 months ago
Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20170901001502.29915-1-jsnow@redhat.com
Subject: [Qemu-devel] [PATCH v3 0/9] IDE: replace printfs with tracing
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/1503938283-12404-1-git-send-email-sundeep.lkml@gmail.com -> patchew/1503938283-12404-1-git-send-email-sundeep.lkml@gmail.com
 t [tag update]            patchew/1504190408-11143-1-git-send-email-thuth@redhat.com -> patchew/1504190408-11143-1-git-send-email-thuth@redhat.com
 * [new tag]               patchew/20170901001502.29915-1-jsnow@redhat.com -> patchew/20170901001502.29915-1-jsnow@redhat.com
Switched to a new branch 'test'
b45bc7135d AHCI: remove DPRINTF macro
52a114ea94 AHCI: pretty-print FIS to buffer instead of stderr
dc1fb9df07 AHCI: Rework IRQ constants
01eb2629b7 AHCI: Replace DPRINTF with trace-events
b64224c313 IDE: replace DEBUG_AIO with trace events
0a54222e15 ATAPI: Replace DEBUG_IDE_ATAPI with tracing events
1c976d454b IDE: add tracing for data ports
b46b3c2141 IDE: Add register hints to tracing
1da9fe67ec IDE: replace DEBUG_IDE with tracing system

=== OUTPUT BEGIN ===
Checking PATCH 1/9: IDE: replace DEBUG_IDE with tracing system...
ERROR: spaces required around that '|' (ctx:VxV)
#143: FILE: hw/ide/core.c:1197:
+    if (reg_num != 7 && (s->status & (BUSY_STAT|DRQ_STAT))) {
                                                ^

total: 1 errors, 0 warnings, 337 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 2/9: IDE: Add register hints to tracing...
Checking PATCH 3/9: IDE: add tracing for data ports...
Checking PATCH 4/9: ATAPI: Replace DEBUG_IDE_ATAPI with tracing events...
Checking PATCH 5/9: IDE: replace DEBUG_AIO with trace events...
Checking PATCH 6/9: AHCI: Replace DPRINTF with trace-events...
ERROR: Hex numbers must be prefixed with '0x'
#544: FILE: hw/ide/trace-events:91:
+handle_reg_h2d_fis_pmp(void *s, int port, char b0, char b1, char b2) "ahci(%p)[%d]: Port Multiplier not supported, FIS: 0x%02x-%02x-%02x"

ERROR: Hex numbers must be prefixed with '0x'
#545: FILE: hw/ide/trace-events:92:
+handle_reg_h2d_fis_res(void *s, int port, char b0, char b1, char b2) "ahci(%p)[%d]: Reserved flags set in H2D Register FIS, FIS: 0x%02x-%02x-%02x"

ERROR: Hex numbers must be prefixed with '0x'
#551: FILE: hw/ide/trace-events:98:
+handle_cmd_unhandled_fis(void *s, int port, uint8_t b0, uint8_t b1, uint8_t b2) "ahci(%p)[%d]: unhandled FIS type. cmd_fis: 0x%02x-%02x-%02x"

total: 3 errors, 0 warnings, 496 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 7/9: AHCI: Rework IRQ constants...
Checking PATCH 8/9: AHCI: pretty-print FIS to buffer instead of stderr...
WARNING: line over 80 characters
#52: FILE: hw/ide/ahci.c:1206:
+            char *pretty_fis = ahci_pretty_buffer_fis(ide_state->io_buffer, 0x10);

total: 0 errors, 1 warnings, 60 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 9/9: AHCI: remove DPRINTF macro...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
Re: [Qemu-devel] [PATCH v3 0/9] IDE: replace printfs with tracing
Posted by John Snow 6 years, 8 months ago

On 08/31/2017 08:27 PM, no-reply@patchew.org wrote:
> Hi,
> 
> This series seems to have some coding style problems. See output below for
> more information:
> 
> Message-id: 20170901001502.29915-1-jsnow@redhat.com
> Subject: [Qemu-devel] [PATCH v3 0/9] IDE: replace printfs with tracing
> Type: series
> 
> === TEST SCRIPT BEGIN ===
> #!/bin/bash
> 
> BASE=base
> n=1
> total=$(git log --oneline $BASE.. | wc -l)
> failed=0
> 
> git config --local diff.renamelimit 0
> git config --local diff.renames True
> 
> commits="$(git log --format=%H --reverse $BASE..)"
> for c in $commits; do
>     echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
>     if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
>         failed=1
>         echo
>     fi
>     n=$((n+1))
> done
> 
> exit $failed
> === TEST SCRIPT END ===
> 
> Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
> From https://github.com/patchew-project/qemu
>  t [tag update]            patchew/1503938283-12404-1-git-send-email-sundeep.lkml@gmail.com -> patchew/1503938283-12404-1-git-send-email-sundeep.lkml@gmail.com
>  t [tag update]            patchew/1504190408-11143-1-git-send-email-thuth@redhat.com -> patchew/1504190408-11143-1-git-send-email-thuth@redhat.com
>  * [new tag]               patchew/20170901001502.29915-1-jsnow@redhat.com -> patchew/20170901001502.29915-1-jsnow@redhat.com
> Switched to a new branch 'test'
> b45bc7135d AHCI: remove DPRINTF macro
> 52a114ea94 AHCI: pretty-print FIS to buffer instead of stderr
> dc1fb9df07 AHCI: Rework IRQ constants
> 01eb2629b7 AHCI: Replace DPRINTF with trace-events
> b64224c313 IDE: replace DEBUG_AIO with trace events
> 0a54222e15 ATAPI: Replace DEBUG_IDE_ATAPI with tracing events
> 1c976d454b IDE: add tracing for data ports
> b46b3c2141 IDE: Add register hints to tracing
> 1da9fe67ec IDE: replace DEBUG_IDE with tracing system
> 
> === OUTPUT BEGIN ===
> Checking PATCH 1/9: IDE: replace DEBUG_IDE with tracing system...
> ERROR: spaces required around that '|' (ctx:VxV)
> #143: FILE: hw/ide/core.c:1197:
> +    if (reg_num != 7 && (s->status & (BUSY_STAT|DRQ_STAT))) {

Existing damage, but I suppose I'll fix it since I'm here.

>                                                 ^
> 
> total: 1 errors, 0 warnings, 337 lines checked
> 
> Your patch has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 
> Checking PATCH 2/9: IDE: Add register hints to tracing...
> Checking PATCH 3/9: IDE: add tracing for data ports...
> Checking PATCH 4/9: ATAPI: Replace DEBUG_IDE_ATAPI with tracing events...
> Checking PATCH 5/9: IDE: replace DEBUG_AIO with trace events...
> Checking PATCH 6/9: AHCI: Replace DPRINTF with trace-events...
> ERROR: Hex numbers must be prefixed with '0x'
> #544: FILE: hw/ide/trace-events:91:
> +handle_reg_h2d_fis_pmp(void *s, int port, char b0, char b1, char b2) "ahci(%p)[%d]: Port Multiplier not supported, FIS: 0x%02x-%02x-%02x"
> 

False positive, it's part of a hex sequence so the context is obvious.

> ERROR: Hex numbers must be prefixed with '0x'
> #545: FILE: hw/ide/trace-events:92:
> +handle_reg_h2d_fis_res(void *s, int port, char b0, char b1, char b2) "ahci(%p)[%d]: Reserved flags set in H2D Register FIS, FIS: 0x%02x-%02x-%02x"
> 

Same

> ERROR: Hex numbers must be prefixed with '0x'
> #551: FILE: hw/ide/trace-events:98:
> +handle_cmd_unhandled_fis(void *s, int port, uint8_t b0, uint8_t b1, uint8_t b2) "ahci(%p)[%d]: unhandled FIS type. cmd_fis: 0x%02x-%02x-%02x"
> 

Same

> total: 3 errors, 0 warnings, 496 lines checked
> 
> Your patch has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 
> Checking PATCH 7/9: AHCI: Rework IRQ constants...
> Checking PATCH 8/9: AHCI: pretty-print FIS to buffer instead of stderr...
> WARNING: line over 80 characters
> #52: FILE: hw/ide/ahci.c:1206:
> +            char *pretty_fis = ahci_pretty_buffer_fis(ide_state->io_buffer, 0x10);
> 

Will adjust.

> total: 0 errors, 1 warnings, 60 lines checked
> 
> Your patch has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> Checking PATCH 9/9: AHCI: remove DPRINTF macro...
> === OUTPUT END ===
> 
> Test command exited with code: 1
> 
> 
> ---
> Email generated automatically by Patchew [http://patchew.org/].
> Please send your feedback to patchew-devel@freelists.org
> 

Re: [Qemu-devel] [Qemu-block] [PATCH v3 0/9] IDE: replace printfs with tracing
Posted by Stefan Hajnoczi 6 years, 8 months ago
On Thu, Aug 31, 2017 at 08:14:53PM -0400, John Snow wrote:
> Wherever possible, replace all printfs with proper tracing.
> In most places I've tried to do a straight replacement, but
> forthcoming patches may calibrate the tracing to be a little nicer.
> 
> For now, it's nice to just remove the all-or-nothing tracing.
> 
> Key:
> [----] : patches are identical
> [####] : number of functional differences between upstream/downstream patch
> [down] : patch is downstream-only
> The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively
> 
> 001/9:[----] [--] 'IDE: replace DEBUG_IDE with tracing system'
> 002/9:[----] [--] 'IDE: Add register hints to tracing'
> 003/9:[----] [--] 'IDE: add tracing for data ports'
> 004/9:[0002] [FC] 'ATAPI: Replace DEBUG_IDE_ATAPI with tracing events'
> 005/9:[0011] [FC] 'IDE: replace DEBUG_AIO with trace events'
> 006/9:[----] [--] 'AHCI: Replace DPRINTF with trace-events'
> 007/9:[0004] [FC] 'AHCI: Rework IRQ constants'
> 008/9:[0052] [FC] 'AHCI: pretty-print FIS to buffer instead of stderr'
> 009/9:[----] [--] 'AHCI: remove DPRINTF macro'
> 
> ===
> v3:
> ===
> 
> 04: Change preprocessor gate mechanism for building cmd
>            packet buffer dumps (Stefan)
> 05: Add getter for IDE_DMA_CMD enumeration (Philippe)
> 07: Changed AHCI enumeration to match changes in 05,
>     (But leave assert in place to guard lookup table instead
>          of adding getter.)
> 08: Replace FIS buffer printer with something simpler (Stefan)
>     Change preprocessor gate mechanism for building AHCI buffer dumps (Stefan)
>     enconstify char parameters in trace-events file (Stefan)
> 
> ===
> v2:
> ===
> 
> 01: Rehabilitate commit message.
>     Fix switch () statement spacing. (Eric)
>     Adjust spacing in ide-tracing file to maintain columns.
>     Change filename orderings in trace-events. (Eric)
>     Fixed newline issue in trace-events. (Eric)
> 
> 02: Context / Added R-B.
> 
> 03: Added trace-events items to appropriate patch (removed from 04) (Eric)
>     Added a verbose warning for data tracers (Eric)
> 
> 04: Shifted items to 03 (Eric)
>     Fixed newline issue (Eric)
> 
> 05: Changed __END to __COUNT (Philippe)
>     Removed __BEGIN enumerator (Philippe)
> 
> 06: Added more information to unknown write (Philippe)
> 
> 08: Context (Entropy)
> 
> John Snow (9):
>   IDE: replace DEBUG_IDE with tracing system
>   IDE: Add register hints to tracing
>   IDE: add tracing for data ports
>   ATAPI: Replace DEBUG_IDE_ATAPI with tracing events
>   IDE: replace DEBUG_AIO with trace events
>   AHCI: Replace DPRINTF with trace-events
>   AHCI: Rework IRQ constants
>   AHCI: pretty-print FIS to buffer instead of stderr
>   AHCI: remove DPRINTF macro
> 
>  Makefile.objs             |   1 +
>  hw/ide/ahci.c             | 243 +++++++++++++++++++++++-----------------------
>  hw/ide/ahci_internal.h    |  44 +++++++--
>  hw/ide/atapi.c            |  69 +++++--------
>  hw/ide/cmd646.c           |  10 +-
>  hw/ide/core.c             | 185 ++++++++++++++++++++++-------------
>  hw/ide/pci.c              |  17 +---
>  hw/ide/piix.c             |  11 +--
>  hw/ide/trace-events       | 111 +++++++++++++++++++++
>  hw/ide/via.c              |  10 +-
>  include/hw/ide/internal.h |   8 +-
>  11 files changed, 437 insertions(+), 272 deletions(-)
>  create mode 100644 hw/ide/trace-events
> 
> -- 
> 2.9.5
> 
> 

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

Re: [Qemu-devel] [Qemu-block] [PATCH v3 0/9] IDE: replace printfs with tracing
Posted by John Snow 6 years, 8 months ago

On 09/01/2017 06:56 AM, Stefan Hajnoczi wrote:
> On Thu, Aug 31, 2017 at 08:14:53PM -0400, John Snow wrote:
>> Wherever possible, replace all printfs with proper tracing.
>> In most places I've tried to do a straight replacement, but
>> forthcoming patches may calibrate the tracing to be a little nicer.
>>
>> For now, it's nice to just remove the all-or-nothing tracing.
>>
>> Key:
>> [----] : patches are identical
>> [####] : number of functional differences between upstream/downstream patch
>> [down] : patch is downstream-only
>> The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively
>>
>> 001/9:[----] [--] 'IDE: replace DEBUG_IDE with tracing system'
>> 002/9:[----] [--] 'IDE: Add register hints to tracing'
>> 003/9:[----] [--] 'IDE: add tracing for data ports'
>> 004/9:[0002] [FC] 'ATAPI: Replace DEBUG_IDE_ATAPI with tracing events'
>> 005/9:[0011] [FC] 'IDE: replace DEBUG_AIO with trace events'
>> 006/9:[----] [--] 'AHCI: Replace DPRINTF with trace-events'
>> 007/9:[0004] [FC] 'AHCI: Rework IRQ constants'
>> 008/9:[0052] [FC] 'AHCI: pretty-print FIS to buffer instead of stderr'
>> 009/9:[----] [--] 'AHCI: remove DPRINTF macro'
>>
>> ===
>> v3:
>> ===
>>
>> 04: Change preprocessor gate mechanism for building cmd
>>            packet buffer dumps (Stefan)
>> 05: Add getter for IDE_DMA_CMD enumeration (Philippe)
>> 07: Changed AHCI enumeration to match changes in 05,
>>     (But leave assert in place to guard lookup table instead
>>          of adding getter.)
>> 08: Replace FIS buffer printer with something simpler (Stefan)
>>     Change preprocessor gate mechanism for building AHCI buffer dumps (Stefan)
>>     enconstify char parameters in trace-events file (Stefan)
>>
>> ===
>> v2:
>> ===
>>
>> 01: Rehabilitate commit message.
>>     Fix switch () statement spacing. (Eric)
>>     Adjust spacing in ide-tracing file to maintain columns.
>>     Change filename orderings in trace-events. (Eric)
>>     Fixed newline issue in trace-events. (Eric)
>>
>> 02: Context / Added R-B.
>>
>> 03: Added trace-events items to appropriate patch (removed from 04) (Eric)
>>     Added a verbose warning for data tracers (Eric)
>>
>> 04: Shifted items to 03 (Eric)
>>     Fixed newline issue (Eric)
>>
>> 05: Changed __END to __COUNT (Philippe)
>>     Removed __BEGIN enumerator (Philippe)
>>
>> 06: Added more information to unknown write (Philippe)
>>
>> 08: Context (Entropy)
>>
>> John Snow (9):
>>   IDE: replace DEBUG_IDE with tracing system
>>   IDE: Add register hints to tracing
>>   IDE: add tracing for data ports
>>   ATAPI: Replace DEBUG_IDE_ATAPI with tracing events
>>   IDE: replace DEBUG_AIO with trace events
>>   AHCI: Replace DPRINTF with trace-events
>>   AHCI: Rework IRQ constants
>>   AHCI: pretty-print FIS to buffer instead of stderr
>>   AHCI: remove DPRINTF macro
>>
>>  Makefile.objs             |   1 +
>>  hw/ide/ahci.c             | 243 +++++++++++++++++++++++-----------------------
>>  hw/ide/ahci_internal.h    |  44 +++++++--
>>  hw/ide/atapi.c            |  69 +++++--------
>>  hw/ide/cmd646.c           |  10 +-
>>  hw/ide/core.c             | 185 ++++++++++++++++++++++-------------
>>  hw/ide/pci.c              |  17 +---
>>  hw/ide/piix.c             |  11 +--
>>  hw/ide/trace-events       | 111 +++++++++++++++++++++
>>  hw/ide/via.c              |  10 +-
>>  include/hw/ide/internal.h |   8 +-
>>  11 files changed, 437 insertions(+), 272 deletions(-)
>>  create mode 100644 hw/ide/trace-events
>>
>> -- 
>> 2.9.5
>>
>>
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> 

Thank you Philippe, Eric, and Stefan.

Thanks, applied to my IDE tree:

https://github.com/jnsnow/qemu/commits/ide
https://github.com/jnsnow/qemu.git

--js