linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jens Axboe <axboe@kernel.dk>, Tejun Heo <tj@kernel.org>,
	linux-ide@vger.kernel.org,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH 04/40] libata: move ata_{port,link,dev}_dbg to standard dev_XXX() macros
Date: Wed, 25 Mar 2020 17:54:07 +0100	[thread overview]
Message-ID: <0dc64715-b3c1-c208-c032-6f1e10715757@suse.de> (raw)
In-Reply-To: <787989d3-b969-df37-3da2-f4405476bd55@samsung.com>

On 3/25/20 4:45 PM, Bartlomiej Zolnierkiewicz wrote:
> 
> On 3/25/20 4:34 PM, Geert Uytterhoeven wrote:
>> Hi Bartl,
>>
>> On Wed, Mar 25, 2020 at 3:56 PM Bartlomiej Zolnierkiewicz
>> <b.zolnierkie@samsung.com> wrote:
>>> On 3/24/20 2:26 PM, Geert Uytterhoeven wrote:
>>>> On Tue, 3 Mar 2020, Hannes Reinecke wrote:
>>>>> Use standard dev_{dbg,info,notice,warn,err} macros instead of the
>>>>> hand-crafted printk helpers.
>>>>>
>>>>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>>>>> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
>>>>
>>>> This is now commit ad9f23bd12e1d721 ("libata: move
>>>> ata_{port,link,dev}_dbg to standard dev_XXX() macros") in
>>>> linux-block/for-next.
>>>>
>>>> This patch causes an intriguing change in boot messages, adding a space
>>>> at the beginning of each printed line:
>>>>
>>>>       scsi host0: sata_rcar
>>>>      -ata1: SATA max UDMA/133 irq 117
>>>>      + ata1: SATA max UDMA/133 irq 117
>>>>
>>>>      -ata1: link resume succeeded after 1 retries
>>>>      + link1: link resume succeeded after 1 retries
>>>>
>>>>      -ata1: SATA link down (SStatus 0 SControl 300)
>>>>      + link1: SATA link down (SStatus 0 SControl 300)
>>>>
>>>> It turns out dev_driver_string(&link->tdev) returns an empty string, as
>>>> its driver field is NULL, so __dev_printk() prints the empty string and
>>>> the device name, separated by a space.
>>>>
>>>> At first I thought this was a bug in rcar-sata, lacking some setup that
>>>> was harmless before, but it turns out other drivers (e.g. pata-falcon)
>>>> show the same issue:
>>>>
>>>>       scsi host0: pata_falcon
>>>>      -ata1: PATA max PIO4 cmd 0xfff00000 ctl 0xfff00039
>>>>      + ata1: PATA max PIO4 cmd 0xfff00000 ctl 0xfff00039
>>>>
>>>>      -ata1.01: NODEV after polling detection
>>>>      -ata1.00: ATA-2: Sarge m68k, , max PIO2
>>>>      -ata1.00: 2118816 sectors, multi 0: LBA
>>>>      -ata1.00: configured for PIO
>>>>      + dev1.0: ATA-2: Sarge m68k, , max PIO2
>>>>      + dev1.0: 2118816 sectors, multi 0: LBA
>>>>      + dev1.0: configured for PIO
>>>
>>> I'm more worried about change of ATA devices and ATA links names
>>> (unfortunately we cannot change the ones used in libata-transport.c
>>> as they are a part of ABI exposed through sysfs).
>>
>> True.
>>
>>> One way to improve the situation is to use transport classes names
>>> for dev_printk() when no other means are available, please see/try
>>> the patch below (compile tested only). It also includes fixup for
>>> extra space issue (change to __dev_printk()).
>>
>> Thanks for the suggestion!
>>
Well, the space can (should?) be fixed with a simple patch to 
__dev_printk() but just checking if 'dev_driver_string()' returns a 
value or not:

diff --git a/drivers/base/core.c b/drivers/base/core.c
index dbb0f9130f42..a84f170a1a1f 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -3635,10 +3635,15 @@ EXPORT_SYMBOL(dev_printk_emit);
  static void __dev_printk(const char *level, const struct device *dev,
                         struct va_format *vaf)
  {
-       if (dev)
-               dev_printk_emit(level[1] - '0', dev, "%s %s: %pV",
-                               dev_driver_string(dev), dev_name(dev), vaf);
-       else
+       if (dev) {
+               if (dev_string_string(dev))
+                       dev_printk_emit(level[1] - '0', dev, "%s %s: %pV",
+                                       dev_driver_string(dev), 
dev_name(dev),
+                                       vaf);
+               else
+                       dev_printk_emit(level[1] - '0', dev, "%s: %pV",
+                                       dev_name(dev), vaf);
+       } else
                 printk("%s(NULL device *): %pV", level, vaf);
  }

which actually makes sense on its own.
As for the name change, yes, I'm not that happy with it, either.

I'll see if we can do some transport class magic such that the
names do not change.

(And no-one is to mention 'cake' and 'eat it' ...)

Cheers,

Hannes
-- 
Dr. Hannes Reinecke            Teamlead Storage & Networking
hare@suse.de                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

  reply	other threads:[~2020-03-25 16:54 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03  9:37 [PATCHv3 00/40] ata: kill ATA_DEBUG Hannes Reinecke
2020-03-03  9:37 ` [PATCH 01/40] libata: drop BPRINTK() Hannes Reinecke
2020-03-03  9:37 ` [PATCH 02/40] libata.h: whitespace and indentation fixes Hannes Reinecke
2020-03-03  9:37 ` [PATCH 03/40] libata-transport: Whitespace cleanup Hannes Reinecke
2020-03-03  9:37 ` [PATCH 04/40] libata: move ata_{port,link,dev}_dbg to standard dev_XXX() macros Hannes Reinecke
2020-03-24 13:26   ` Geert Uytterhoeven
2020-03-25 14:56     ` Bartlomiej Zolnierkiewicz
2020-03-25 15:34       ` Geert Uytterhoeven
2020-03-25 15:45         ` Bartlomiej Zolnierkiewicz
2020-03-25 16:54           ` Hannes Reinecke [this message]
2020-03-03  9:37 ` [PATCH 05/40] libata: move __func__ into ata_{port,link,dev}_dbg() helper Hannes Reinecke
2020-03-03  9:37 ` [PATCH 06/40] libata: remove pointless debugging messages Hannes Reinecke
2020-03-03  9:37 ` [PATCH 07/40] ata_piix: remove " Hannes Reinecke
2020-03-03  9:37 ` [PATCH 08/40] libata-core: remove pointless " Hannes Reinecke
2020-03-03  9:37 ` [PATCH 09/40] libata: Add ata_port_classify() helper Hannes Reinecke
2020-03-03  9:37 ` [PATCH 10/40] libata: move ata_dump_id() to dynamic debugging Hannes Reinecke
2020-03-03  9:37 ` [PATCH 11/40] libata: sanitize ATA_HORKAGE_DUMP_ID Hannes Reinecke
2020-03-03  9:37 ` [PATCH 12/40] sata_mv: replace DPRINTK with 'pci_dump' module parameter Hannes Reinecke
2020-03-03  9:37 ` [PATCH 13/40] sata_mv: kill 'port' argument in mv_dump_all_regs() Hannes Reinecke
2020-03-03  9:37 ` [PATCH 14/40] sata_sx4: move DPRINTK to VPRINTK Hannes Reinecke
2020-03-03  9:37 ` [PATCH 15/40] libata: add reset tracepoints Hannes Reinecke
2020-03-03  9:37 ` [PATCH 16/40] libata: drop DPRINTK() calls in reset Hannes Reinecke
2020-03-03  9:37 ` [PATCH 17/40] libata: tracepoints for bus-master DMA Hannes Reinecke
2020-03-03  9:37 ` [PATCH 18/40] libata: drop debugging statements " Hannes Reinecke
2020-03-03  9:37 ` [PATCH 19/40] pata_octeon_cf: add bmdma tracepoints and drop DPRINTK() calls Hannes Reinecke
2020-03-03  9:37 ` [PATCH 20/40] pata_arasan_cf: use generic tracepoints Hannes Reinecke
2020-03-03  9:37 ` [PATCH 21/40] sata_dwc_460ex: " Hannes Reinecke
2020-03-03  9:37 ` [PATCH 22/40] sata_nv: " Hannes Reinecke
2020-03-03  9:37 ` [PATCH 23/40] libata-sff: tracepoints for HSM state machine Hannes Reinecke
2020-03-03  9:37 ` [PATCH 24/40] libata-sff: add tracepoints for ata_sff_flush_pio_task() Hannes Reinecke
2020-03-03  9:37 ` [PATCH 25/40] libata-scsi: drop DPRINTK calls for cdb translation Hannes Reinecke
2020-03-03  9:37 ` [PATCH 26/40] libata: add tracepoints for ATA error handling Hannes Reinecke
2020-03-03  9:38 ` [PATCH 27/40] libata: drop DPRINTK() calls during " Hannes Reinecke
2020-03-03  9:38 ` [PATCH 28/40] libata-eh: remove DPRINTK() calls for request sense Hannes Reinecke
2020-03-03  9:38 ` [PATCH 29/40] pata_octeon_cf: move DPRINTK to VPRINTK Hannes Reinecke
2020-03-03  9:38 ` [PATCH 30/40] pdc_adma: " Hannes Reinecke
2020-03-03  9:38 ` [PATCH 31/40] sata_rcar: " Hannes Reinecke
2020-03-03  9:38 ` [PATCH 32/40] sata_qstor: " Hannes Reinecke
2020-03-03  9:38 ` [PATCH 33/40] pata_pdc2027x: Replace PDPRINTK() with standard ata logging Hannes Reinecke
2020-03-03  9:38 ` [PATCH 34/40] sata_nv: move DPRINTK to ata debugging Hannes Reinecke
2020-03-03  9:38 ` [PATCH 35/40] sata_fsl: " Hannes Reinecke
2020-03-13 14:43   ` Guenter Roeck
2020-03-03  9:38 ` [PATCH 36/40] libata-core: " Hannes Reinecke
2020-03-03  9:38 ` [PATCH 37/40] libata: remove DPRINTK() macro Hannes Reinecke
2020-03-03  9:38 ` [PATCH 38/40] libata: kill ATA_MSG_INFO Hannes Reinecke
2020-03-03  9:38 ` [PATCH 39/40] libata: kill ATA_MSG_CTL Hannes Reinecke
2020-03-03  9:38 ` [PATCH 40/40] libata: remove references to ATA_DEBUG Hannes Reinecke
2020-03-12 14:04 ` [PATCHv3 00/40] ata: kill ATA_DEBUG Jens Axboe

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=0dc64715-b3c1-c208-c032-6f1e10715757@suse.de \
    --to=hare@suse.de \
    --cc=axboe@kernel.dk \
    --cc=b.zolnierkie@samsung.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=tj@kernel.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).