From: Amit Shah <amit.shah@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>,
Juan Quintela <quintela@redhat.com>,
Stefan Hajnoczi <stefanha@gmail.com>,
Markus Armbruster <armbru@redhat.com>,
qemu list <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: [PATCH v2 1/2] cdrom: Allow the TEST_UNIT_READY command after a cdrom change
Date: Thu, 7 Apr 2011 16:45:36 +0530 [thread overview]
Message-ID: <20110407111536.GE1419@amit-x200.redhat.com> (raw)
In-Reply-To: <4D9D8FE0.4070107@redhat.com>
On (Thu) 07 Apr 2011 [12:20:16], Kevin Wolf wrote:
> Am 07.04.2011 11:11, schrieb Amit Shah:
> > On (Thu) 07 Apr 2011 [10:59:20], Kevin Wolf wrote:
> >> Am 07.04.2011 07:05, schrieb Amit Shah:
> >>> We restrict the commands that a guest can send us after a cdrom change
> >>> event. The current list includes REQUEST_SENSE and INQUIRY commands.
> >>> Guests can also issue TEST_UNIT_READY to inquire for the status, so
> >>> allow this command as well.
> >>>
> >>> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> >>
> >> Hm... MMC-5, section 4.1.6.1 seems to conflict with this:
> >>
> >> "If a Host issues a command other than GET CONFIGURATION, GET EVENT
> >> STATUS NOTIFICATION, INQUIRY or REQUEST SENSE while a unit attention
> >> condition exists for that Host, the Drive shall not perform the command
> >> and shall report CHECK CONDITION status unless a higher priority status
> >> as defined by the Drive is also pending."
> >>
> >> So while you're right that our list is incomplete, TEST UNIT READY
> >> doesn't seem to be among the missing commands.
> >
> > Hm - older Linux guests (pre 2.6.38) and Windows guests, as Gleb's
> > commit mentioned, rely on this command to get CD change notifications:
> >
> > /* identical to scsi_test_unit_ready except that it doesn't
> > * eat the NOT_READY returns for removable media */
> > int sr_test_unit_ready(struct scsi_device *sdev, struct scsi_sense_hdr *sshdr)
> > {
> > int retries = MAX_RETRIES;
> > int the_result;
> > u8 cmd[] = {TEST_UNIT_READY, 0, 0, 0, 0, 0 };
> >
> > /* issue TEST_UNIT_READY until the initial startup UNIT_ATTENTION
> > * conditions are gone, or a timeout happens
> > */
> > do {
> > the_result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL,
> > 0, sshdr, SR_TIMEOUT,
> > retries--, NULL);
> > if (scsi_sense_valid(sshdr) &&
> > sshdr->sense_key == UNIT_ATTENTION)
> > sdev->changed = 1;
> >
> > } while (retries > 0 &&
> > (!scsi_status_is_good(the_result) ||
> > (scsi_sense_valid(sshdr) &&
> > sshdr->sense_key == UNIT_ATTENTION)));
> > return the_result;
> > }
>
> I think the scsi_execute_req() call might issue a REQUEST SENSE
> internally and therefore clear the unit attention condition. Tried to
> check that in the source, but I'm hopelessly lost in the kernel...
No, it doesn't.
It's clear the 2nd patch is needed; the 1st one must be papering over
something else. Right now I'm inclined to think that it's because we
don't report tray open and no media as separate events to the guest,
as Markus has found out.
Amit
next prev parent reply other threads:[~2011-04-07 11:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-07 5:05 [Qemu-devel] [PATCH v2 0/2] Correct transitions for cd change state Amit Shah
2011-04-07 5:05 ` [Qemu-devel] [PATCH v2 1/2] cdrom: Allow the TEST_UNIT_READY command after a cdrom change Amit Shah
2011-04-07 7:22 ` [Qemu-devel] " Paolo Bonzini
2011-04-07 8:42 ` Stefan Hajnoczi
2011-04-07 8:51 ` Amit Shah
2011-04-07 8:59 ` Kevin Wolf
2011-04-07 9:11 ` Amit Shah
2011-04-07 10:20 ` Kevin Wolf
2011-04-07 11:15 ` Amit Shah [this message]
2011-04-07 5:05 ` [Qemu-devel] [PATCH v2 2/2] cdrom: Make disc change event visible to guests Amit Shah
2011-04-07 7:31 ` [Qemu-devel] " Paolo Bonzini
2011-04-07 8:01 ` Amit Shah
2011-04-07 8:41 ` Stefan Hajnoczi
2011-04-07 8:51 ` Amit Shah
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=20110407111536.GE1419@amit-x200.redhat.com \
--to=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=gleb@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@gmail.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).