linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Martin Wilck <martin.wilck@suse.com>
Cc: "bart.vanassche@sandisk.com" <bart.vanassche@sandisk.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"sreekanth.reddy@broadcom.com" <sreekanth.reddy@broadcom.com>,
	"MPT-FusionLinux.pdl@broadcom.com"
	<MPT-FusionLinux.pdl@broadcom.com>,
	"suganath-prabu.subramani@broadcom.com" 
	<suganath-prabu.subramani@broadcom.com>,
	"hare@suse.de" <hare@suse.de>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Subject: Re: mpt3sas fails to allocate budget_map and detects no devices
Date: Fri, 7 Jan 2022 00:33:05 +0800	[thread overview]
Message-ID: <YdcZwVUFGUPgkbLn@T590> (raw)
In-Reply-To: <5fffbc9191d1f1b3db1d51ce991591c9c6d91785.camel@suse.com>

On Thu, Jan 06, 2022 at 04:19:03PM +0000, Martin Wilck wrote:
> On Thu, 2022-01-06 at 23:41 +0800, Ming Lei wrote:
> > On Thu, Jan 06, 2022 at 03:22:53PM +0000, Martin Wilck wrote:
> > > > 
> > > > I'd suggest to fix mpt3sas for avoiding this memory waste.
> > > 
> > > Let's wait for Sreekanth's comment on that.
> > > 
> > > mpt3sas is not the only driver using a low value. Qlogic drivers
> > > set
> > > cmd_per_lun=3, for example (with 3, our logic would use shift=6, so
> > > the
> > > issue I observed wouldn't occur - but it would be prone to cache
> > > line
> > > bouncing).
> > 
> > But qlogic has smaller .can_queue which looks at most 512, .can_queue
> > is
> > the depth for allocating sbitmap, since each sdev->queue_depth is <=
> > .can_queue.
> 
> I'm seeing here (on an old kernel, admittedly) cmd_per_lun=3 and
> can_queue=2038 for qla2xxx and cmd_per_lun=3 and can_queue=5884 for
> lpfc. Both drivers change the queue depth for devices to 64 in their
> slave_configure() methods.
> 
> Many drivers do this, as it's recommended in scsi_host.h. That's quite
> bad in view of the current bitmap allocation logic - we lay out the
> bitmap assuming the depth used will be cmd_per_lun, but that doesn't
> match the actual depth when the device comes online. For qla2xxx, it
> means that we'd allocate the sbitmap with shift=6 (64 bits per word),
> thus using just a single cache line for 64 requests. Shift=4 (16 bits
> per word) would be the default shift for depth 64.
> 
> Am I misreading the code? Perhaps we should only allocate a preliminary
> sbitmap in scsi_alloc_sdev, and reallocate it after slave_configure()
> has been called, to get the shift right for the driver's default
> settings?

That looks fine to reallocate it after ->slave_configure() returns,
but we need to freeze the request queue for avoiding any in-flight
scsi command. At that time, freeze should be quick enough.


Thanks,
Ming


  reply	other threads:[~2022-01-06 16:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 18:00 mpt3sas fails to allocate budget_map and detects no devices Martin Wilck
2022-01-06  3:03 ` Ming Lei
2022-01-06  3:17   ` Martin K. Petersen
2022-01-06 10:26   ` Martin Wilck
2022-01-06 15:00     ` Ming Lei
2022-01-06 15:22       ` Martin Wilck
2022-01-06 15:41         ` Ming Lei
2022-01-06 16:19           ` Martin Wilck
2022-01-06 16:33             ` Ming Lei [this message]
2022-01-10  2:59               ` Ming Lei
2022-01-12 16:59                 ` Martin Wilck
2022-01-25 16:29                   ` Martin Wilck
2022-01-26  1:25                     ` Ming Lei

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=YdcZwVUFGUPgkbLn@T590 \
    --to=ming.lei@redhat.com \
    --cc=MPT-FusionLinux.pdl@broadcom.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=martin.wilck@suse.com \
    --cc=sreekanth.reddy@broadcom.com \
    --cc=suganath-prabu.subramani@broadcom.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;
as well as URLs for NNTP newsgroup(s).