From: Niklas Cassel <cassel@kernel.org>
To: John Garry <john.g.garry@oracle.com>
Cc: Damien Le Moal <dlemoal@kernel.org>,
Jason Yan <yanaijie@huawei.com>,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Tejun Heo <htejun@gmail.com>, Jeff Garzik <jeff@garzik.org>,
Colin Ian King <colin.i.king@gmail.com>,
Jens Axboe <axboe@kernel.dk>,
Kai-Heng Feng <kai.heng.feng@canonical.com>,
linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH v2 00/13] ata,libsas: Assign the unique id used for printing earlier
Date: Thu, 27 Jun 2024 17:07:43 +0200 [thread overview]
Message-ID: <Zn2AP6J_RGlYExw9@ryzen.lan> (raw)
In-Reply-To: <cd7ff1a0-c73b-4638-be51-2a6d9de4b324@oracle.com>
On Thu, Jun 27, 2024 at 01:54:34PM +0100, John Garry wrote:
> On 27/06/2024 13:32, Niklas Cassel wrote:
> > On Thu, Jun 27, 2024 at 01:26:04PM +0100, John Garry wrote:
> > > On 26/06/2024 19:00, Niklas Cassel wrote:
> > > > Hello all,
> > > >
> > > > This patch series was orginally meant to simply assign a unique id used
> > > > for printing earlier (ap->print_id), but has since grown to also include
> > > > cleanups related to ata_port_alloc() (since ap->print_id is now assigned
> > > > in ata_port_alloc()).
> > > >
> > >
> > > There's no real problem statement wrt print_id, telling how and why things
> > > are like they are, how it is a problem, and how it is improved in this
> > > series.
> >
> > You are right, it is missing from the cover-letter.
> >
> > It was there in v1:
> > https://lore.kernel.org/linux-ide/20240618153537.2687621-7-cassel@kernel.org/
> >
> > """
> > This series moves the assignment of ap->print_id, which is used as a
> > unique id for each port, earlier, such that we can use the ata_port_*
> > print functions even before the ata_host has been registered.
> > """
>
> OK, fine.
>
> I see code which checks vs ap->print_id, like:
>
> static void ata_force_link_limits(struct ata_link *link)
> {
> ...
> if (fe->port != -1 && fe->port != link->ap->print_id)
> continue;
>
>
> Is this all ok to deal with this print_id assignment change?
>
> To me, it seems natural to assign a valid print_id from the alloc time, so I
> can't help but wonder it was done the current way.
ap->print_id was assigned after calling ata_host_register(), because libata
allowed a driver that did not know how many ports it had, to initially call
ata_alloc_host() with a big number of ports, and then reduce the host->n_ports
variable once it knew the actually number of ports, before calling
ata_host_register(), which would then free the "excess" ports.
This feature has actually never been used by and driver, and I remove support
for this in this series:
https://lore.kernel.org/linux-ide/20240626180031.4050226-22-cassel@kernel.org/
However, you do raise a good point...
ap->print_id is just supposed to be used for printing, but it appears that
ata_force_link_limits() and some other ata_force_*() functions make use of
it for other things... sigh...
Hopefully I can just change them from:
if (fe->port != -1 && fe->port != link->ap->print_id)
to
if (fe->port != -1)
but I will need to look in to this further...
Thank you for noticing this (ab)use of print_id!
Kind regards,
Niklas
next prev parent reply other threads:[~2024-06-27 15:07 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 18:00 [PATCH v2 00/13] ata,libsas: Assign the unique id used for printing earlier Niklas Cassel
2024-06-26 18:00 ` [PATCH v2 01/13] ata: libata-core: Fix null pointer dereference on error Niklas Cassel
2024-06-27 1:00 ` Damien Le Moal
2024-06-27 6:24 ` Hannes Reinecke
2024-06-26 18:00 ` [PATCH v2 02/13] ata: libata-core: Fix double free " Niklas Cassel
2024-06-27 1:02 ` Damien Le Moal
2024-06-27 6:25 ` Hannes Reinecke
2024-06-26 18:00 ` [PATCH v2 03/13] ata: ahci: Clean up sysfs file " Niklas Cassel
2024-06-26 18:34 ` Niklas Cassel
2024-06-27 1:04 ` Damien Le Moal
2024-06-27 6:28 ` Hannes Reinecke
2024-06-26 18:00 ` [PATCH v2 04/13] ata,scsi: Remove useless wrappers ata_sas_tport_{add,delete}() Niklas Cassel
2024-06-27 1:07 ` Damien Le Moal
2024-06-27 6:29 ` Hannes Reinecke
2024-06-26 18:00 ` [PATCH v2 05/13] ata,scsi: libata-core: Add ata_port_free() Niklas Cassel
2024-06-27 1:15 ` Damien Le Moal
2024-06-29 12:09 ` Niklas Cassel
2024-06-27 6:30 ` Hannes Reinecke
2024-06-26 18:00 ` [PATCH v2 06/13] ata: libata: Remove unused function declaration for ata_scsi_detect() Niklas Cassel
2024-06-27 1:16 ` Damien Le Moal
2024-06-27 6:31 ` Hannes Reinecke
2024-06-26 18:00 ` [PATCH v2 07/13] ata: libata-core: Remove support for decreasing the number of ports Niklas Cassel
2024-06-26 19:30 ` Niklas Cassel
2024-06-27 1:30 ` Damien Le Moal
2024-06-27 6:35 ` Hannes Reinecke
2024-06-29 12:24 ` Niklas Cassel
2024-06-26 18:00 ` [PATCH v2 08/13] ata: libata-sata: Remove superfluous assignment in ata_sas_port_alloc() Niklas Cassel
2024-06-27 1:31 ` Damien Le Moal
2024-06-27 6:37 ` Hannes Reinecke
2024-06-26 18:00 ` [PATCH v2 09/13] ata: libata-core: Remove local_port_no struct member Niklas Cassel
2024-06-27 1:33 ` Damien Le Moal
2024-06-27 6:37 ` Hannes Reinecke
2024-06-26 18:00 ` [PATCH v2 10/13] ata: libata: Assign print_id at port allocation time Niklas Cassel
2024-06-27 6:38 ` Hannes Reinecke
2024-06-26 18:00 ` [PATCH v2 11/13] ata: libata-core: Reuse available ata_port print_ids Niklas Cassel
2024-06-27 1:37 ` Damien Le Moal
2024-07-02 15:43 ` Niklas Cassel
2024-06-27 6:39 ` Hannes Reinecke
2024-06-28 16:31 ` kernel test robot
2024-06-28 18:15 ` Niklas Cassel
2024-06-26 18:00 ` [PATCH v2 12/13] ata,scsi: Remove useless ata_sas_port_alloc() wrapper Niklas Cassel
2024-06-27 1:46 ` Damien Le Moal
2024-06-27 9:48 ` Niklas Cassel
2024-06-28 3:46 ` Damien Le Moal
2024-06-27 6:40 ` Hannes Reinecke
2024-06-26 18:00 ` [PATCH v2 13/13] ata: ahci: Add debug print for external port Niklas Cassel
2024-06-27 6:40 ` Hannes Reinecke
2024-06-27 12:26 ` [PATCH v2 00/13] ata,libsas: Assign the unique id used for printing earlier John Garry
2024-06-27 12:32 ` Niklas Cassel
2024-06-27 12:54 ` John Garry
2024-06-27 15:07 ` Niklas Cassel [this message]
2024-07-02 15:43 ` Niklas Cassel
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=Zn2AP6J_RGlYExw9@ryzen.lan \
--to=cassel@kernel.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=axboe@kernel.dk \
--cc=colin.i.king@gmail.com \
--cc=dlemoal@kernel.org \
--cc=htejun@gmail.com \
--cc=jeff@garzik.org \
--cc=john.g.garry@oracle.com \
--cc=kai.heng.feng@canonical.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=yanaijie@huawei.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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.