linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Christoph Hellwig <hch@lst.de>
Cc: "Linux regression tracking (Thorsten Leemhuis)"
	<regressions@leemhuis.info>, John Garry <john.g.garry@oracle.com>,
	Jens Axboe <axboe@kernel.dk>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Damien Le Moal <dlemoal@kernel.org>,
	Niklas Cassel <cassel@kernel.org>,
	linux-block@vger.kernel.org, linux-ide@vger.kernel.org,
	linux-scsi@vger.kernel.org, benh@kernel.crashing.org,
	linuxppc-dev@lists.ozlabs.org, Guenter Roeck <linux@roeck-us.net>,
	Christoph Hellwig <hch@lst.de>,
	Linux kernel regressions list <regressions@lists.linux.dev>,
	doru.iorgulescu1@gmail.com
Subject: Re: [PATCH 04/23] scsi: initialize scsi midlayer limits before allocating the queue
Date: Wed, 05 Jun 2024 22:37:53 +1000	[thread overview]
Message-ID: <87wmn3pntq.fsf@mail.lhotse> (raw)
In-Reply-To: <87sexy2yny.fsf@mail.lhotse>

Michael Ellerman <mpe@ellerman.id.au> writes:
> Christoph Hellwig <hch@lst.de> writes:
>> On Fri, May 31, 2024 at 12:28:21AM +1000, Michael Ellerman wrote:
>>> No that's wrong. The actual hardware page size is 4K, but
>>> CONFIG_PAGE_SIZE and PAGE_SHIFT etc. is 64K.
>>> 
>>> So at least for this user the driver used to work with 64K pages, and
>>> now doesn't.
>>
>> Which suggested that the communicated max_hw_sectors is wrong, and
>> previously we were saved by the block layer increasing it to
>> PAGE_SIZE after a warning.  Should we just increment it to 64k?
>
> It looks like that user actually only has the CDROM hanging off
> pata_macio, so it's possible it has been broken previously and they
> didn't notice. I'll see if they can confirm the CDROM has been working
> up until now.
>
> I can test the CDROM on my G5 next week.

I can confirm that the driver does work with 64K pages prior to the
recent changes. I'm able to boot and read CDs with no errors.

However AFAICS that's because the driver splits large requests in
pata_macio_qc_prep():

static enum ata_completion_errors pata_macio_qc_prep(struct ata_queued_cmd *qc)
{
       ...
       for_each_sg(qc->sg, sg, qc->n_elem, si) {
              u32 addr, sg_len, len;
              ...
              addr = (u32) sg_dma_address(sg);
              sg_len = sg_dma_len(sg);

              while (sg_len) {
                     ...
                     len = (sg_len < MAX_DBDMA_SEG) ? sg_len : MAX_DBDMA_SEG;
                     table->command = cpu_to_le16(write ? OUTPUT_MORE: INPUT_MORE);
                     table->req_count = cpu_to_le16(len);
                     ...
                     addr += len;
                     sg_len -= len;
                     ++table;
              }
  }

 
If I increase MAX_DBMA_SEG from 0xff00 to 64K I see IO errors at boot:

  [   24.989755] sr 4:0:0:0: [sr0] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=6s
  [   25.007310] sr 4:0:0:0: [sr0] tag#0 Sense Key : Medium Error [current]
  [   25.020502] sr 4:0:0:0: [sr0] tag#0 ASC=0x10 <<vendor>>ASCQ=0x90
  [   25.032655] sr 4:0:0:0: [sr0] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 20 00
  [   25.047232] I/O error, dev sr0, sector 0 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0


On the other hand increasing max_segment_size to 64K while leaving MAX_DBDMA_SEG
at 0xff00 seems to work fine. And that's effectively what's been happening on
existing kernels until now.

The only question is whether that violates some assumption elsewhere in the
SCSI layer?

Anyway patch below that works for me on v6.10-rc2.

cheers


diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c
index 817838e2f70e..3cb455a32d92 100644
--- a/drivers/ata/pata_macio.c
+++ b/drivers/ata/pata_macio.c
@@ -915,10 +915,13 @@ static const struct scsi_host_template pata_macio_sht = {
 	.sg_tablesize		= MAX_DCMDS,
 	/* We may not need that strict one */
 	.dma_boundary		= ATA_DMA_BOUNDARY,
-	/* Not sure what the real max is but we know it's less than 64K, let's
-	 * use 64K minus 256
+	/*
+	 * The SCSI core requires the segment size to cover at least a page, so
+	 * for 64K page size kernels this must be at least 64K. However the
+	 * hardware can't handle 64K, so pata_macio_qc_prep() will split large
+	 * requests.
 	 */
-	.max_segment_size	= MAX_DBDMA_SEG,
+	.max_segment_size	= SZ_64K,
 	.device_configure	= pata_macio_device_configure,
 	.sdev_groups		= ata_common_sdev_groups,
 	.can_queue		= ATA_DEF_QUEUE,

  reply	other threads:[~2024-06-05 12:38 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09 14:37 convert SCSI to atomic queue limits, part 1 (v3) Christoph Hellwig
2024-04-09 14:37 ` [PATCH 01/23] block: add a helper to cancel atomic queue limit updates Christoph Hellwig
2024-04-09 14:43   ` John Garry
2024-04-09 15:06   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 02/23] bsg: pass queue_limits to bsg_setup_queue Christoph Hellwig
2024-04-09 15:06   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 03/23] mpi3mr: " Christoph Hellwig
2024-04-09 15:06   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 04/23] scsi: initialize scsi midlayer limits before allocating the queue Christoph Hellwig
2024-04-09 15:08   ` Johannes Thumshirn
2024-05-15 21:50   ` Guenter Roeck
2024-05-15 22:16     ` John Garry
2024-05-15 23:52       ` Guenter Roeck
2024-05-16 13:08         ` John Garry
2024-05-16 14:50           ` Guenter Roeck
2024-05-20 15:15         ` Christoph Hellwig
2024-05-29 14:36           ` Linux regression tracking (Thorsten Leemhuis)
2024-05-30  6:25             ` Thorsten Leemhuis
2024-05-30 12:46             ` Michael Ellerman
2024-05-30 14:28               ` Michael Ellerman
2024-05-31  6:08                 ` Christoph Hellwig
2024-05-31  8:06                   ` Michael Ellerman
2024-06-05 12:37                     ` Michael Ellerman [this message]
2024-06-06  5:54                       ` Christoph Hellwig
2024-06-06  8:21                       ` John Garry
2024-06-06 12:33                         ` Michael Ellerman
2024-04-09 14:37 ` [PATCH 05/23] scsi_transport_fc: add a max_bsg_segments field to struct fc_function_template Christoph Hellwig
2024-04-09 15:08   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 06/23] scsi: add a no_highmem flag to struct Scsi_Host Christoph Hellwig
2024-04-09 15:10   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 07/23] scsi: add a dma_alignment field to the host and host template Christoph Hellwig
2024-04-09 15:10   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 08/23] ufs-exynos: move setting the the dma alignment to the init method Christoph Hellwig
2024-04-09 15:11   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 09/23] scsi: use the atomic queue limits API in scsi_add_lun Christoph Hellwig
2024-04-09 15:12   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 10/23] scsi: add a device_configure method to the host template Christoph Hellwig
2024-04-09 15:13   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 11/23] megaraid_sas: switch to using ->device_configure Christoph Hellwig
2024-04-09 15:16   ` Johannes Thumshirn
2024-04-10  5:46   ` Hannes Reinecke
2024-04-09 14:37 ` [PATCH 12/23] mpt3sas: " Christoph Hellwig
2024-04-09 15:16   ` Johannes Thumshirn
2024-04-10  5:48   ` Hannes Reinecke
2024-04-09 14:37 ` [PATCH 13/23] sbp2: " Christoph Hellwig
2024-04-09 15:18   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 14/23] hptiop: " Christoph Hellwig
2024-04-09 15:18   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 15/23] ipr: " Christoph Hellwig
2024-04-09 15:19   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 16/23] pmcraid: " Christoph Hellwig
2024-04-09 15:19   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 17/23] usb-storage: " Christoph Hellwig
2024-04-09 15:20   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 18/23] sata_nv: " Christoph Hellwig
2024-04-09 14:37 ` [PATCH 19/23] pata_macio: " Christoph Hellwig
2024-04-09 14:37 ` [PATCH 20/23] libata: " Christoph Hellwig
2024-04-09 14:37 ` [PATCH 21/23] mpi3mr: " Christoph Hellwig
2024-04-09 15:34   ` Johannes Thumshirn
2024-04-10  4:25     ` Christoph Hellwig
2024-04-10  4:27   ` [PATCH 21/23 v3.1] " Christoph Hellwig
2024-04-10  8:01     ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 22/23] uas: switch to using ->device_configure to configure queue limits Christoph Hellwig
2024-04-09 15:26   ` Johannes Thumshirn
2024-04-09 14:37 ` [PATCH 23/23] block: remove now unused queue limits helpers Christoph Hellwig
2024-04-09 15:26   ` Johannes Thumshirn
2024-04-12  2:04 ` convert SCSI to atomic queue limits, part 1 (v3) Martin K. Petersen
2024-04-25  1:57 ` Martin K. Petersen
  -- strict thread matches above, loose matches on Subject: below --
2024-04-02 13:06 convert SCSI to atomic queue limits, part 1 (v2) Christoph Hellwig
2024-04-02 13:06 ` [PATCH 04/23] scsi: initialize scsi midlayer limits before allocating the queue Christoph Hellwig
2024-04-03  6:49   ` Hannes Reinecke
2024-03-24 23:54 convert SCSI to atomic queue limits, part 1 Christoph Hellwig
2024-03-24 23:54 ` [PATCH 04/23] scsi: initialize scsi midlayer limits before allocating the queue Christoph Hellwig
2024-03-25  7:20   ` Damien Le Moal
2024-03-25 17:43   ` Bart Van Assche
2024-03-27 14:54   ` John Garry

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=87wmn3pntq.fsf@mail.lhotse \
    --to=mpe@ellerman.id.au \
    --cc=axboe@kernel.dk \
    --cc=benh@kernel.crashing.org \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=doru.iorgulescu1@gmail.com \
    --cc=hch@lst.de \
    --cc=john.g.garry@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=martin.petersen@oracle.com \
    --cc=regressions@leemhuis.info \
    --cc=regressions@lists.linux.dev \
    /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).