All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Andrew Vasquez <andrew.vasquez@qlogic.com>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: Using scsi_cmd->request->nr_hw_segments within a LLDD...
Date: Wed, 22 Sep 2004 08:57:27 +0200	[thread overview]
Message-ID: <20040922065727.GB2299@suse.de> (raw)
In-Reply-To: <B179AE41C1147041AA1121F44614F0B0012AD913@AVEXCH02.qlogic.org>

On Tue, Sep 21 2004, Andrew Vasquez wrote:
> 
> All,
> 
> Back in March the qla2xxx driver began to use the value in
> cmd->request->nr_hw_segments as a guestimate during the calucation of
> the number of driver-request-queue entries that would be needed to
> fullfill a given command-request.  Here's an URL to thread which
> prompted the change:
> 
> 	http://marc.theaimsgroup.com/?l=linux-scsi&m=107940832718154&w=2
> 
> Recently we've had a number of problem reports which appear to
> indicate that the value specified within the variable is
> un-initialized and/or set to some bogus value.
> 
> Here's the relevant code the driver uses in qla2x00_start_scsi():
> 
> 	/* Calculate the number of request entries needed. */
> 	req_cnt = (ha->calc_request_entries)(cmd->request->nr_hw_segments);
> 	if (ha->req_q_cnt < (req_cnt + 2)) {
> 		cnt = RD_REG_WORD_RELAXED(ISP_REQ_Q_OUT(ha, reg));
> 		if (ha->req_ring_index < cnt)
> 			ha->req_q_cnt = cnt - ha->req_ring_index;
> 		else
> 			ha->req_q_cnt = ha->request_q_length -
> 			    (ha->req_ring_index - cnt);
> 	}
> 	if (ha->req_q_cnt < (req_cnt + 2))
> 		goto queuing_error;
> 
> The 'req_cnt' derived value in several instances is greater than 4000.
> 
> So, can an LLDD depend on the value being set to a proper value
> during all I/O submission paths -- BIO as well as IOCTL?
> 
> If not, then what should a device driver writer use as an alternative?

Would this by any chance be from request initiated with SG_IO? This
problem should be fixed in 2.6.9-rcX, are you still seeing it?

->nr_hw_segments was not initialized for some paths earlier, so it
contained random crap.

-- 
Jens Axboe


  reply	other threads:[~2004-09-22  6:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-21 21:55 Using scsi_cmd->request->nr_hw_segments within a LLDD Andrew Vasquez
2004-09-22  6:57 ` Jens Axboe [this message]
2004-09-22 15:01   ` Patrick Mansfield
2004-09-22 15:02     ` 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=20040922065727.GB2299@suse.de \
    --to=axboe@suse.de \
    --cc=andrew.vasquez@qlogic.com \
    --cc=linux-scsi@vger.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 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.