Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: Tony Asleson <tasleson@redhat.com>
Cc: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
	linux-ide@vger.kernel.org
Subject: Re: [RFC PATCH v3 5/8] ata_dev_printk: Use dev_printk
Date: Wed, 24 Jun 2020 12:35:31 +0200
Message-ID: <d817c9dd-6852-9233-5f61-1c0bc0f65ca4@samsung.com> (raw)
In-Reply-To: <20200623191749.115200-6-tasleson@redhat.com>


[ added linux-ide ML to Cc: ]

Hi,

On 6/23/20 9:17 PM, Tony Asleson wrote:
> Utilize the dev_printk function which will add structured data
> to the log message.
> 
> Signed-off-by: Tony Asleson <tasleson@redhat.com>
> ---
>  drivers/ata/libata-core.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index beca5f91bb4c..44c874367fe3 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -6475,6 +6475,7 @@ EXPORT_SYMBOL(ata_link_printk);
>  void ata_dev_printk(const struct ata_device *dev, const char *level,
>  		    const char *fmt, ...)
>  {
> +	const struct device *gendev;
>  	struct va_format vaf;
>  	va_list args;
>  
> @@ -6483,9 +6484,12 @@ void ata_dev_printk(const struct ata_device *dev, const char *level,
>  	vaf.fmt = fmt;
>  	vaf.va = &args;
>  
> -	printk("%sata%u.%02u: %pV",
> -	       level, dev->link->ap->print_id, dev->link->pmp + dev->devno,
> -	       &vaf);
> +	gendev = (dev->sdev) ? &dev->sdev->sdev_gendev : &dev->tdev;
> +
> +	dev_printk(level, gendev, "ata%u.%02u: %pV",
> +			dev->link->ap->print_id,

This duplicates the device information and breaks integrity of
libata logging functionality (ata_{dev,link,port}_printk() should
be all converted to use dev_printk() at the same time).

The root source of problem is that libata transport uses different
naming scheme for ->tdev devices (please see dev_set_name() in
ata_t{dev,link,port}_add()) than libata core for its logging
functionality (ata_{dev,link,port}_printk()).

Since libata transport is part of sysfs ABI we should be careful
to not break it so one idea for solving the issue is to convert
ata_t{dev,link,port}_add() to use libata logging naming scheme and
at the same time add sysfs symlinks for the old libata transport
naming scheme.

dev->sdev usage is not required for dev_printk() conversion and
should be considered as a separate change (since it also breaks
integrity of libata logging and can be considered as a mild
"layering violation" I don't think that it should be applied).

> +			dev->link->pmp + dev->devno,
> +			&vaf);
>  
>  	va_end(args);
>  }
> 

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

  parent reply index

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23 19:17 [RFC PATCH v3 0/8] Add persistent durable identifier to storage log messages Tony Asleson
2020-06-23 19:17 ` [RFC PATCH v3 1/8] struct device: Add function callback durable_name Tony Asleson
2020-06-23 19:17 ` [RFC PATCH v3 2/8] create_syslog_header: Add durable name Tony Asleson
2020-06-23 19:17 ` [RFC PATCH v3 3/8] print_req_error: Use dev_printk Tony Asleson
2020-06-23 19:17 ` [RFC PATCH v3 4/8] buffer_io_error: " Tony Asleson
2020-06-23 19:17 ` [RFC PATCH v3 5/8] ata_dev_printk: " Tony Asleson
     [not found]   ` <CGME20200624103532eucas1p2c0988207e4dfc2f992d309b75deac3ee@eucas1p2.samsung.com>
2020-06-24 10:35     ` Bartlomiej Zolnierkiewicz [this message]
2020-06-24 15:15       ` Tony Asleson
2020-06-26 12:45         ` Bartlomiej Zolnierkiewicz
2020-06-26 13:54           ` Tony Asleson
     [not found]       ` <7ed08b94-755f-baab-0555-b4e454405729@redhat.com>
2020-07-14  8:06         ` Bartlomiej Zolnierkiewicz
2020-07-14  8:17           ` Greg Kroah-Hartman
2020-07-14  8:50             ` Bartlomiej Zolnierkiewicz
2020-07-17 10:06               ` Greg Kroah-Hartman
2020-07-17 10:17                 ` Hannes Reinecke
2020-07-17 10:27                 ` Bartlomiej Zolnierkiewicz
2020-07-17 19:47                   ` Tony Asleson
2020-07-24  8:50                     ` Bartlomiej Zolnierkiewicz
2020-06-23 19:17 ` [RFC PATCH v3 6/8] scsi: Add durable_name for dev_printk Tony Asleson
2020-06-23 19:17 ` [RFC PATCH v3 7/8] nvme: Add durable name " Tony Asleson
2020-06-23 20:04   ` Chaitanya Kulkarni
2020-06-23 20:32     ` Tony Asleson
2020-06-23 19:17 ` [RFC PATCH v3 8/8] dev_vprintk_emit: Increase hdr size Tony Asleson

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=d817c9dd-6852-9233-5f61-1c0bc0f65ca4@samsung.com \
    --to=b.zolnierkie@samsung.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tasleson@redhat.com \
    /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

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git