All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Lucas Meneghel Rodrigues <lmr@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>,
	aliguori@us.ibm.com,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org, Michael Walle <michael@walle.cc>,
	Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>,
	Frediano Ziglio <freddy77@gmail.com>,
	Cleber Rosa <crosa@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] block: avoid SIGUSR2
Date: Fri, 28 Oct 2011 17:58:34 +0200	[thread overview]
Message-ID: <4EAAD12A.1070603@redhat.com> (raw)
In-Reply-To: <CAJSP0QUQC5Ue94LS=CC9PGBxo-eOP1xPQPhL_dVLpt3GXLFe1A@mail.gmail.com>

On 10/28/2011 02:31 PM, Stefan Hajnoczi wrote:
> Zhi Yong: We were just talking about converting devices to aio.  If
> you have time to do that for fdc, sd, or any other synchronous API
> users in hw/ that would be helpful.  Please let us know which device
> you are refactoring so we don't duplicate work.

The problem is not really fdc or sd themselves, but whoever uses the 
result of the synchronous reads---respectively DMA and the SD clients.

Some SD clients talk to the SD card in a relatively confined way and 
have interrupts that they set when the operation is done, so these 
confined parts that talk to the card could be changed to a coroutine and 
locked with a CoMutex.  However, not even all of these can do it (in 
particular I'm not sure about ssi-sd.c cannot).

I'm thinking that the problem with the floppy is really that it mixes 
synchronous and asynchronous parts.  As long as you're entirely 
synchronous you should not have any problem, but as soon as you add 
asynchronicity (via bottom halves) you now have to deal with reentrancy.

"git grep _bh hw/" suggests that this should not be a huge problem; most 
if not all occurrences are related to ptimers, or are in entirely 
asynchronous code (IDE, SCSI, virtio).  Floppy+DMA seems to be the only 
problematic occurrence, and any fix (switch to timers, drop idle BH in 
qemu_aio_wait, reschedule if DMA reenters during I/O, drop BH completely 
and just loop) is as good as the others.

(Actually, another one worth checking is ATAPI, but I don't know the 
code and the standards well enough).

Paolo

  reply	other threads:[~2011-10-28 15:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-19 14:37 [Qemu-devel] [PATCH v2] block: avoid SIGUSR2 Frediano Ziglio
2011-09-19 15:02 ` Paolo Bonzini
2011-09-19 15:11   ` Kevin Wolf
2011-09-19 15:25     ` Paolo Bonzini
2011-09-19 15:15 ` Kevin Wolf
2011-10-27 13:26 ` Kevin Wolf
2011-10-27 13:57   ` Stefan Hajnoczi
2011-10-27 14:15     ` Kevin Wolf
2011-10-27 14:32       ` Kevin Wolf
2011-10-28 11:33         ` Kevin Wolf
2011-10-28 11:35           ` Kevin Wolf
2011-10-28 11:50           ` Paolo Bonzini
2011-10-28 12:29             ` Kevin Wolf
2011-10-28 12:31               ` Stefan Hajnoczi
2011-10-28 15:58                 ` Paolo Bonzini [this message]
2011-10-31  2:10                 ` Zhi Yong Wu
2011-10-28 12:20           ` Cleber Rosa

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=4EAAD12A.1070603@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=crosa@redhat.com \
    --cc=freddy77@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=lmr@redhat.com \
    --cc=michael@walle.cc \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@linux.vnet.ibm.com \
    --cc=wuzhy@linux.vnet.ibm.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 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.