public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Igor Pylypiv <ipylypiv@google.com>, Niklas Cassel <cassel@kernel.org>
Cc: Jack Wang <jinpu.wang@cloud.ionos.com>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Terrence Adams <tadamsjr@google.com>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH] Revert "scsi: pm80xx: Do not use libsas port ID"
Date: Fri, 18 Jul 2025 13:35:13 +0900	[thread overview]
Message-ID: <a09dea31-0de3-4859-95d9-2d83fc1ccc73@kernel.org> (raw)
In-Reply-To: <aHlpNRsPbmrTgv0O@google.com>

On 2025/07/18 6:20, Igor Pylypiv wrote:
> On Thu, Jul 17, 2025 at 06:56:07PM +0200, Niklas Cassel wrote:
>> This reverts commit 0f630c58e31afb3dc2373bc1126b555f4b480bb2.
>>
>> Commit 0f630c58e31a ("scsi: pm80xx: Do not use libsas port ID") causes
>> drives behind a SAS enclosure (which is connected to one of the ports
>> on the HBA) to no longer be detected.
>>
>> Connecting the drives directly to the HBA still works. Thus, the commit
>> only broke the detection of drives behind a SAS enclosure.
>>
>> Reverting the commit makes the drives behind the SAS enclosure to be
>> detected once again.
>>
>> The commit log of the offending commit is quite vague, but mentions that:
>> "Remove sas_find_local_port_id(). We can use pm8001_ha->phy[phy_id].port
>> to get the port ID."
>>
>> This assumption appears false, thus revert the offending commit.
> 
> Thanks for bisecting and reverting the commit, Niklas!
> 
> Let me review the changes and send a proper fix that takes into account
> drives behind a SAS enclosure. I would appretiate if you could test that
> new fix since I don't have a setup with a SAS enclosure.

s/enclosure/expander
(the important point here is if there is an expander between the HBA and the
devices, not how the devices are installed. E.g. a simple enclosure may not have
any expander and act similar to a fan-out cable connection)

I think the issue is that if you do not have an expander and use fan-out cables
to connect drives directly to the HBA, you essentially get HBA SAS port ==
device port and it works (My setup is like this with an -8e model, so 8 ports, 0
to 7). That is the case for "if (!pdev)" in sas_find_local_port.

But if there is an expander, you can have multiple devices per HBA port, so you
need to search backward using the parent device until you hit the HBA device
itself, which gives you the port to use to communicate with the device.

So not sure if we can simplify/remove the loop in sas_find_local_port(). Maybe
if we add "local_port" field to struct domain_device ? But then any topology
change event would potentially need to update this.


-- 
Damien Le Moal
Western Digital Research

  parent reply	other threads:[~2025-07-18  4:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17 16:56 [PATCH] Revert "scsi: pm80xx: Do not use libsas port ID" Niklas Cassel
2025-07-17 21:20 ` Igor Pylypiv
2025-07-17 21:29   ` Niklas Cassel
2025-07-18  4:35   ` Damien Le Moal [this message]
2025-07-18 22:30     ` Igor Pylypiv
2025-07-22  1:28       ` Damien Le Moal
2025-07-22  4:25         ` Damien Le Moal
2025-07-22 21:36           ` Igor Pylypiv
2025-07-23  1:38             ` Damien Le Moal
2025-08-02 18:31               ` Igor Pylypiv
2025-08-04  0:03                 ` Damien Le Moal
2025-07-18  4:36 ` Damien Le Moal

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=a09dea31-0de3-4859-95d9-2d83fc1ccc73@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=cassel@kernel.org \
    --cc=ipylypiv@google.com \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=tadamsjr@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox