qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 2/2] Add AT24Cxx I2C EEPROM device model
Date: Tue, 20 Nov 2012 15:06:01 +0100	[thread overview]
Message-ID: <20121120140601.GA28789@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <50AB8783.5060508@siemens.com>

On Tue, Nov 20, 2012 at 02:37:07PM +0100, Jan Kiszka wrote:
> On 2012-11-20 14:27, Stefan Hajnoczi wrote:
> > On Mon, Nov 19, 2012 at 03:24:39PM +0100, Jan Kiszka wrote:
> >> +static void at24_flush_transfer_buffer(AT24State *s)
> >> +{
> >> +    if (s->cached_sector < 0 || !s->cache_dirty) {
> >> +        return;
> >> +    }
> >> +    bdrv_write(s->bs, s->cached_sector, s->sector_buffer, 1);
> > [...]
> >> +static int at24_cache_sector(AT24State *s, int sector)
> >> +{
> >> +    int ret;
> >> +
> >> +    if (s->cached_sector == sector) {
> >> +        return 0;
> >> +    }
> >> +    ret = bdrv_read(s->bs, sector, s->sector_buffer, 1);
> > 
> > Can you use bdrv_aio_writev()/bdrv_aio_readv()?  We should avoid adding
> > new synchronous block I/O.  Because it forces us to run a nested event
> > loop that blocks the guest until I/O completes.
> 
> The call is synchronous as the I2C bus model is as well. How do I model
> this with bdrv_aio_*?

The bus model needs to be asynchronous.

There are still a few bdrv_read()/bdrv_write() users in hw/ today so
it's not the end of the world if you can't make it async, but it means
someone else will have to do the work eventually :(.

Stefan

  reply	other threads:[~2012-11-20 14:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19 14:24 [Qemu-devel] [PATCH 0/2] i2c: Add AT24Cxx EEPROM model Jan Kiszka
2012-11-19 14:24 ` [Qemu-devel] [PATCH 1/2] i2c: Introduce device address mask Jan Kiszka
2012-11-19 14:24 ` [Qemu-devel] [PATCH 2/2] Add AT24Cxx I2C EEPROM device model Jan Kiszka
2012-11-20 13:27   ` Stefan Hajnoczi
2012-11-20 13:37     ` Jan Kiszka
2012-11-20 14:06       ` Stefan Hajnoczi [this message]
2012-11-20 14:38         ` Jan Kiszka
2012-11-20 14:40           ` Stefan Hajnoczi
2012-11-20 14:59             ` Jan Kiszka
2013-01-16 10:09   ` [Qemu-devel] [PATCH 2/2 v2] " Jan Kiszka
2012-11-19 17:43 ` [Qemu-devel] [PATCH 0/2] i2c: Add AT24Cxx EEPROM model Stefan Weil
2012-11-20 11:49   ` Jan Kiszka
2012-12-12  9:44 ` Jan Kiszka
2012-12-18 13:55   ` Stefan Hajnoczi
2013-01-16  9:34     ` Jan Kiszka
2012-12-18 14:26   ` Andreas Färber
2013-01-16  9:35     ` Jan Kiszka

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=20121120140601.GA28789@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).