public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jörg Sommer" <joerg@alea.gnuu.de>
To: Lin Ming <ming.m.lin@intel.com>
Cc: Jeff Garzik <jgarzik@redhat.com>, Tejun Heo <tj@kernel.org>,
	linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
	"James E.J. Bottomley" <JBottomley@parallels.com>
Subject: Re: DMA doesn't work since "make ata port as parent device of scsi host"
Date: Wed, 21 Mar 2012 20:40:43 +0100	[thread overview]
Message-ID: <20120321194042.GA16112@alea.gnuu.de> (raw)
In-Reply-To: <1332293133.17160.12.camel@minggr>

[-- Attachment #1: Type: text/plain, Size: 4623 bytes --]

Lin Ming hat am Wed 21. Mar, 09:25 (+0800) geschrieben:
> On Thu, 2012-03-15 at 16:59 +0100, Jörg Sommer wrote:
> > Lin Ming hat am Thu 15. Mar, 16:19 (+0800) geschrieben:
> > > On Thu, 2012-03-15 at 08:48 +0100, Jörg Sommer wrote:
> > > > Lin Ming hat am Thu 15. Mar, 11:26 (+0800) geschrieben:
> > > > > On Thu, 2012-03-15 at 09:59 +0800, Lin Ming wrote:
> > > > > > On Thu, 2012-03-15 at 02:48 +0100, Jörg Sommer wrote:
> > > > > > > Hi,
> > > > > > > 
> > > > > > > I'm getting these messages in a KVM virtualized host and the access to
> > > > > > > the disks is very slow. Using libata.dma=0 suppresses the warnings, but
> > > > > > > the disks are still slow.
> > > > > > 
> > > > > > Hi Jörg,
> > > > > > 
> > > > > > Let me try to reproduce this issue first.
> > > > > 
> > > > > I tried below commands on x86_32, but can't reproduce it.
> > > > > 
> > > > > qemu-system-i386 -kernel /root/vmlinuz-3.3.0-rc7 -append "root=/dev/sda1
> > > > > zcache" -hda /root/debian-32.img -hdb /root/data.img
> > > > > 
> > > > > Maybe because i386 uses different ata controller than ppc(ata_piix vs
> > > > > pata-macio).
> > > > > 
> > > > > I'll try qemu-system-ppc.
> > > > > 
> > > > > Did you need to run some workload to trigger these warings?
> > > > > Or did you get these warnings right after booting the VM?
> > > > 
> > > > These warnings come up before »INIT started«. I don't have to do
> > > > anything, just wait and see.
> > > > 
> > > > # truncate -s100M /mnt/data/new
> > > > # mke2fs -Fq /mnt/data/new
> > > > # mount -o loop /mnt/data/new /mnt/other
> > > > # cp --parents /bin/zsh-static /mnt/other/zsh
> > > > # umount /mnt/other
> > > > # qemu-system-ppc -enable-kvm -M mac99 -cpu G4 -k de -kernel /boot/vmlinuz-3.3.0-rc5-04520-g8d233c0 -append 'root=/dev/sda ro console=ttyPZ0 init=/zsh' -hda /mnt/data/new
> > > > 
> > > > I've uploaded my config and the kernel:
> > > > http://alioth.debian.org/~jo-guest/config-3.3.0-rc5-04520-g8d233c0
> > > > http://alioth.debian.org/~jo-guest/vmlinuz-3.3.0-rc5-04520-g8d233c0
> > > > 
> > > > You have to switch to the serial console (Ctrl-Alt-3 or with -nographic
> > > > Ctrl-a c). All kernel messages arrive there.
> > > > 

> Hi, 
> 
> Below patch should fix the problem.
> 
> Could you help to test it?

Yes, it does. The kernel doesn't hang at bootup. Thanks for you
investigation.

> >From a36022015c97c9a9f80e71b4283f0ff5f481ffc3 Mon Sep 17 00:00:00 2001
> From: Lin Ming <ming.m.lin@intel.com>
> Date: Tue, 20 Mar 2012 14:35:10 +0800
> Subject: [PATCH] [SCSI] scsi_lib: use correct DMA device in __scsi_alloc_queue
> 
> Currently, __scsi_alloc_queue uses SCSI host's parent device
> as DMA device to set segment boundary. But the parent device may not
> refer to the DMA device. For example, for ATA disk, SCSI host's parent
> device now refers to ATA port.
> 
> Since commit d139b9b([SCSI] scsi_lib_dma: fix bug with dma maps on
> nested scsi objects), a new field Scsi_Host->dma_device was introduced
> to refer to the real DMA device.
> 
> Use ->dma_device in __scsi_alloc_queue to correctly set segment
> boundary.
> 
> And use scsi_add_host_with_dma in ata_scsi_add_hosts to pass in the
> correct DMA device.
> 
> Signed-off-by: Lin Ming <ming.m.lin@intel.com>

Tested-by: Jörg Sommer <joerg@alea.gnuu.de>

> ---
>  drivers/ata/libata-scsi.c |    3 ++-
>  drivers/scsi/scsi_lib.c   |    2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 7ae1e77..e47f889 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -3398,7 +3398,8 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)
>  		 */
>  		shost->max_host_blocked = 1;
>  
> -		rc = scsi_add_host(ap->scsi_host, &ap->tdev);
> +		rc = scsi_add_host_with_dma(ap->scsi_host,
> +						&ap->tdev, ap->host->dev);
>  		if (rc)
>  			goto err_add;
>  	}
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index f85cfa6..486088b 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1642,7 +1642,7 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost,
>  					 request_fn_proc *request_fn)
>  {
>  	struct request_queue *q;
> -	struct device *dev = shost->shost_gendev.parent;
> +	struct device *dev = shost->dma_dev;
>  
>  	q = blk_init_queue(request_fn, NULL);
>  	if (!q)
> -- 
> 1.7.2.5
> 
> 

Regards, Jörg.
-- 
Dein Gesicht wird dir geschenkt. Lächeln musst du selber! (Inga Hermann)

[-- Attachment #2: Digital signature http://en.wikipedia.org/wiki/OpenPGP --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

      reply	other threads:[~2012-03-21 19:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120315014807.GA3051@alea.gnuu.de>
     [not found] ` <1331776741.3436.33.camel@minggr>
     [not found]   ` <1331781968.3436.43.camel@minggr>
     [not found]     ` <20120315074835.GA18295@alea.gnuu.de>
     [not found]       ` <1331799598.3436.46.camel@minggr>
     [not found]         ` <20120315155924.GA6738@alea.gnuu.de>
2012-03-21  1:25           ` DMA doesn't work since "make ata port as parent device of scsi host" Lin Ming
2012-03-21 19:40             ` Jörg Sommer [this message]

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=20120321194042.GA16112@alea.gnuu.de \
    --to=joerg@alea.gnuu.de \
    --cc=JBottomley@parallels.com \
    --cc=jgarzik@redhat.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=tj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox