All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: "Gonglei (Arei)" <arei.gonglei@huawei.com>
Cc: Hanweidong <hanweidong@huawei.com>,
	Luonengjun <luonengjun@huawei.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Wangzhenguo <wangzhenguo@huawei.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	"Huangweidong (Hardware)" <huangweidong@huawei.com>
Subject: Re: [Qemu-devel] use O_DIRECT to open disk images for IDE failed under xen-4.1.2 and qemu upstream
Date: Thu, 23 May 2013 13:34:54 +0100	[thread overview]
Message-ID: <alpine.DEB.2.02.1305231330460.4799__23713.1529291675$1369312649$gmane$org@kaball.uk.xensource.com> (raw)
In-Reply-To: <33183CC9F5247A488A2544077AF190206C8FCB9B@szxeml538-mbx.china.huawei.com>

On Thu, 23 May 2013, Gonglei (Arei) wrote:
> Hi, all
> 
> I use O_DIRECT to open disk images for IDE, but I'm failed. After debug, I get the below logs:
> [2013-05-22 23:25:46] ide: CMD=c8
> [2013-05-22 23:25:46] bmdma: readb 0x00 : 0x08
> [2013-05-22 23:25:46] bmdma: writeb 0x00 : 0x09
> [2013-05-22 23:25:46] bmdma_cmd_writeb: 0x00000009
> [2013-05-22 23:25:46] bmdma: readb 0x02 : 0x01
> [2013-05-22 23:25:46] bmdma: readb 0x02 : 0x01
> [2013-05-22 23:25:46] bmdma: readb 0x02 : 0x01
> [2013-05-22 23:25:46] bmdma: readb 0x02 : 0x01
> [2013-05-22 23:25:46] bmdma: readb 0x02 : 0x01
> [2013-05-22 23:25:46] bmdma: readb 0x02 : 0x01
> [2013-05-22 23:26:39] bmdma: writeb 0x00 : 0x08
> [2013-05-22 23:26:39] bmdma_cmd_writeb: 0x00000008
> [2013-05-22 23:26:56] ====== offset:0 buf:0x7ff100f21c00 count:512 aio_offset:0
> [2013-05-22 23:31:30] ====== offset:0 buf:0x7ff100f21c00 count:512 aio_offset:0
> [2013-05-22 23:31:30] ====== handle_aiocb_rw_linear errno: -14
> [2013-05-22 23:31:30] ====== paio_complete errno=14
> [2013-05-22 23:31:30] ====== ide_dma_error!!!
> [2013-05-22 23:31:30] ide: read status addr=0x3f6 val=41
> 
> QEMU command line :
> qemu-system-i386 -xen-domid 837 -chardev socket,id=libxl-cmd,path=/var/run/xen/qmp-libxl-837,server,nowait -mon chardev=libxl-cmd,mode=control -name suse11 -vnc 0.0.0.0:1 -serial pty -boot order=c -usb -usbdevice tablet -smp 2,maxcpus=2 -device rtl8139,id=nic0,netdev=net0,mac=00:16:3e:13:d3:72 -netdev type=tap,id=net0,ifname=tap837.0,downscript=no -M xenfv -m 2040 -drive file=/mnt/sdd/image/suse.image,if=ide,index=0,media=disk,format=raw,cache=none
> 
> errno 14 shows Bad Address. And I find QEMU_AIO_MISALIGNED flag bit is not set through debug. 
> 
>     /*
>      * If O_DIRECT is used the buffer needs to be aligned on a sector
>      * boundary.  Check if this is the case or tell the low-level
>      * driver that it needs to copy the buffer.
>      */
>     if ((bs->open_flags & BDRV_O_NOCACHE)) {
>         if (!bdrv_qiov_is_aligned(bs, qiov)) {    //if the address is aligned-512, will no meet the conditions
>             type |= QEMU_AIO_MISALIGNED;
> #ifdef CONFIG_LINUX_AIO
>         } else if (s->use_aio) {
>             return laio_submit(bs, s->aio_ctx, s->fd, sector_num, qiov,
>                                nb_sectors, cb, opaque, type);
> #endif
> 
> Next process:
> static ssize_t handle_aiocb_rw(struct qemu_paiocb *aiocb)
> {
>     ssize_t nbytes;
>     char *buf;
> 
>     if (!(aiocb->aio_type & QEMU_AIO_MISALIGNED)) {
>         /*
>          * If there is just a single buffer, and it is properly aligned
>          * we can just use plain pread/pwrite without any problems.
>          */
>         if (aiocb->aio_niov == 1)
>              return handle_aiocb_rw_linear(aiocb, aiocb->aio_iov->iov_base); //this way, and reports errno 14 next
> 
> Anyone have a good method to resolve this bug? Thanks!
 
I know that this is not the answer you are looking for but why do you
want to use O_DIRECT with IDE?
It should be perfectly safe to use write-back.

  reply	other threads:[~2013-05-23 12:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23  9:18 [Qemu-devel] use O_DIRECT to open disk images for IDE failed under xen-4.1.2 and qemu upstream Gonglei (Arei)
2013-05-23 12:34 ` Stefano Stabellini [this message]
2013-05-23 12:34 ` Stefano Stabellini
2013-05-24  2:59   ` Gonglei (Arei)
2013-05-24  2:59   ` Gonglei (Arei)
2013-05-24  9:08     ` Stefano Stabellini
2013-05-24  9:08     ` Stefano Stabellini
2013-05-25  7:03       ` Gonglei (Arei)
2013-05-25  7:03       ` Gonglei (Arei)
2013-05-24 12:20     ` Stefan Hajnoczi
2013-05-24 12:20     ` Stefan Hajnoczi
2013-05-25  7:32       ` Gonglei (Arei)
2013-05-25  7:32       ` Gonglei (Arei)
2013-05-27 12:44         ` Stefan Hajnoczi
2013-05-28 14:44           ` Konrad Rzeszutek Wilk
2013-05-28 14:44           ` [Qemu-devel] [Xen-devel] " Konrad Rzeszutek Wilk
2013-05-27 12:44         ` [Qemu-devel] " Stefan Hajnoczi

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='alpine.DEB.2.02.1305231330460.4799__23713.1529291675$1369312649$gmane$org@kaball.uk.xensource.com' \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=arei.gonglei@huawei.com \
    --cc=hanweidong@huawei.com \
    --cc=huangweidong@huawei.com \
    --cc=luonengjun@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wangzhenguo@huawei.com \
    --cc=xen-devel@lists.xen.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.