• Bean Huo's avatar
    scsi: ufs: Use __print_symbolic() for UFS trace string print · 28fa68fc
    Bean Huo authored
    __print_symbolic() is designed for exporting the print formatting table to
    userspace and allows parsing tool, such as trace-cmd and perf, to analyze
    trace log according to this print formatting table, meanwhile, by using
    __print_symbolic()s, save space in the trace ring buffer.
    
    original print format:
    
    print fmt: "%s: %s: HDR:%s, CDB:%s", __get_str(str), __get_str(dev_name),
                __print_hex(REC->hdr, sizeof(REC->hdr)),
                __print_hex(REC->tsf, sizeof(REC->tsf))
    
    after this change:
    
    print fmt: "%s: %s: HDR:%s, CDB:%s",
          print_symbolic(REC->str_t, {0, "send"},
                                     {1, "complete"},
                                     {2, "dev_complete"},
                                     {3, "query_send"},
                                     {4, "query_complete"},
                                     {5, "query_complete_err"},
                                     {6, "tm_send"},
                                     {7, "tm_complete"},
                                     {8, "tm_complete_err"}),
          __get_str(dev_name), __print_hex(REC->hdr, sizeof(REC->hdr)),
          __print_hex(REC->tsf, sizeof(REC->tsf))
    
    Note: This patch just converts current __get_str(str) to __print_symbolic(),
          the original tracing log will not be affected by this change, so it
          doesn't break what current parsers expect.
    
    Link: https://lore.kernel.org/r/20210105113446.16027-3-huobean@gmail.comAcked-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: default avatarBean Huo <beanhuo@micron.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    28fa68fc
ufshcd.c 251 KB