qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Farman <farman@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/3] scsi/virtio-scsi: Prevent assertion on missed events
Date: Tue, 14 Jan 2014 09:31:03 -0500	[thread overview]
Message-ID: <52D54A27.7020109@linux.vnet.ibm.com> (raw)
In-Reply-To: <1389709469-15111-4-git-send-email-farman@linux.vnet.ibm.com>

On 01/14/2014 09:24 AM, Eric Farman wrote:
> In some cases, an unplug can cause events to be dropped, which
> leads to an assertion failure when preparing to notify the guest
> kernel.  This merely accommodates both variations of the "no event"
> value that could occur in this codepath.
>
> Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
> ---
>   hw/scsi/virtio-scsi.c |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index 49a9576..f8e3632 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -521,7 +521,8 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
>       evt->event = event;
>       evt->reason = reason;
>       if (!dev) {
> -        assert(event == VIRTIO_SCSI_T_NO_EVENT);
> +        assert(event == VIRTIO_SCSI_T_NO_EVENT ||
> +               event == VIRTIO_SCSI_T_EVENTS_MISSED);
>       } else {
>           evt->lun[0] = 1;
>           evt->lun[1] = dev->id;
Didn't want to stuff this in the commit itself, but I am especially 
curious about this patch.  While I encountered the assertion failure 
with some regularity during my testing, with the patch I have 
occasionally encountered a guest kernel oops.  I believe this patch ends 
up allowing us to get just a little bit farther, but that there is still 
code needed.  Not sure which failure is better, but also haven't had 
much success reproducing/debugging the kernel error.

I'm appending the kernel backtrace below, for reference:

[   21.341765] Unable to handle kernel pointer dereference at virtual 
kernel address 63772d302e302000
[   21.346892] Oops: 0038 [#1] SMP
[   21.347112] Modules linked in: virtio_blk virtio_scsi dm_multipath
[   21.347524] CPU: 0 PID: 4 Comm: kworker/0:0 Not tainted 3.10.0 #1
[   21.348685] Workqueue: events virtscsi_handle_event [virtio_scsi]
[   21.348939] task: 000000001ff74848 ti: 000000001ffa0000 task.ti: 
000000001ffa0000
Krnl GPRS: 000000001cd47b78 63772d302e302e31 0000000001697000 
0000000000000001
[   21.349910]            0000000000000001 0000000000000000 
0000000000000000 0000000001697000
[   21.350185]            0000000000000000 0000000000000000 
00000000018e8000 00000000018e8738
[   21.350425]            000000001ff26e00 0000000001697000 
000000001ffa3d08 000000001ffa3ce0
[   21.350677] Krnl Code: 00000000004637c8: e3e0f0980024    stg 
%r14,152(%r15)
            00000000004637ce: e31020000004    lg    %r1,0(%r2)
           #00000000004637d4: e31010c00004    lg    %r1,192(%r1)
           >00000000004637da: e3c010000002    ltg    %r12,0(%r1)
            00000000004637e0: a784000a        brc    8,4637f4
            00000000004637e4: b904002c        lgr    %r2,%r12
            00000000004637e8: c0e5ffe9e944    brasl    %r14,1a0a70
            00000000004637ee: ec26000b007c    cgij    %r2,0,6,463804
[   21.352029] Call Trace:
[   21.352122] ([<000000000047316c>] scsi_remove_device+0x40/0x50)
[   21.352330]  [<000003ff8000f6ee>] virtscsi_handle_event+0x1ea/0x230 
[virtio_scsi]
[   21.378453]  [<0000000000152364>] process_one_work+0x1a8/0x400
[   21.382530]  [<0000000000152a94>] worker_thread+0x144/0x35c
[   21.382818]  [<000000000015a112>] kthread+0xd2/0xdc
[   21.383105]  [<000000000063504e>] kernel_thread_starter+0x6/0xc
[   21.383391]  [<0000000000635048>] kernel_thread_starter+0x0/0xc
[   21.383679] Last Breaking-Event-Address:
[   21.383851]  [<000003ff8000e1f4>] 0x3ff8000e1f4
[   21.384080]
[   21.384142] ---[ end trace 07fb696109d46d45 ]---
[   21.386001] Unable to handle kernel pointer dereference at virtual 
kernel address fffffffffffff000
[   21.386433] Oops: 0038 [#2] SMP
[   21.386648] Modules linked in: virtio_blk virtio_scsi dm_multipath
[   21.387035] CPU: 0 PID: 4 Comm: kworker/0:0 Tainted: G D 3.10.0 #1
[   21.387471] task: 000000001ff74848 ti: 000000001ffa0000 task.ti: 
000000001ffa0000
[   21.387793] Krnl PSW : 0404e00180000000 000000000015a6c2 
(kthread_data+0x6/0x10)
[   21.388113]            R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:2 
PM:0 EA:3
Krnl GPRS: 000000000000000e 0000000000000000 000000001ff74848 
0000000000000000
[   21.392411]            0000000000006f00 000000000000038c 
00000000009db800 00000000009db800
[   21.392759]            00000000009db800 000000001ff74c10 
0000000000915c88 0000000002403800
[   21.393075]            000000001ff74848 0000000000000000 
0000000000153270 000000001ffa38d8
[   21.393398] Krnl Code: 000000000015a6b8: 07fe        bcr 15,%r14
            000000000015a6ba: 0707        bcr    0,%r7
           #000000000015a6bc: e31023800004    lg    %r1,896(%r2)
           >000000000015a6c2: e3201fd8ff04    lg    %r2,-40(%r1)
            000000000015a6c8: 07fe        bcr    15,%r14
            000000000015a6ca: 0707        bcr    0,%r7
            000000000015a6cc: ebeff0880024    stmg %r14,%r15,136(%r15)
            000000000015a6d2: a7f13fe0        tmll    %r15,16352
[   21.395048] Call Trace:
[   21.395153] ([<0000000000915c88>] __per_cpu_offset+0x0/0x200)
[   21.395419]  [<00000000006330ac>] __schedule+0x7a8/0xa94
[   21.395684]  [<0000000000136042>] do_exit+0x69e/0xa90
[   21.395948]  [<00000000001126f8>] die+0x154/0x17c
[   21.396212]  [<000000000011c400>] do_no_context+0xa8/0xe0
[   21.396475]  [<00000000006370e2>] do_asce_exception+0x172/0x18c
[   21.396738]  [<00000000006351ce>] pgm_check_handler+0x17a/0x17e
[   21.396999]  [<00000000004637da>] scsi_device_put+0x2e/0x74
[   21.397262] ([<000000000047316c>] scsi_remove_device+0x40/0x50)
[   21.397525]  [<000003ff8000f6ee>] virtscsi_handle_event+0x1ea/0x230 
[virtio_scsi]
[   21.400894]  [<0000000000152364>] process_one_work+0x1a8/0x400
[   21.403878]  [<0000000000152a94>] worker_thread+0x144/0x35c
[   21.404350]  [<000000000015a112>] kthread+0xd2/0xdc
[   21.404617]  [<000000000063504e>] kernel_thread_starter+0x6/0xc
[   21.404883]  [<0000000000635048>] kernel_thread_starter+0x0/0xc
[   21.405147] Last Breaking-Event-Address:
[   21.405306]  [<000000000015326a>] wq_worker_sleeping+0x22/0xb0
[   21.405570]

  - Eric Farman

  reply	other threads:[~2014-01-14 14:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14 14:24 [Qemu-devel] [PATCH RFC 0/3] virtio-scsi unplug of active device Eric Farman
2014-01-14 14:24 ` [Qemu-devel] [PATCH 1/3] scsi/virtio-scsi: Properly flush I/Os inflight during an unplug Eric Farman
2014-01-14 14:45   ` Paolo Bonzini
2014-01-14 14:24 ` [Qemu-devel] [PATCH 2/3] scsi/virtio-scsi: Cleanup of I/Os that never started Eric Farman
2014-01-14 14:49   ` Paolo Bonzini
2014-01-14 16:08     ` Eric Farman
2014-01-14 14:24 ` [Qemu-devel] [PATCH 3/3] scsi/virtio-scsi: Prevent assertion on missed events Eric Farman
2014-01-14 14:31   ` Eric Farman [this message]
2014-01-14 14:47   ` Paolo Bonzini

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=52D54A27.7020109@linux.vnet.ibm.com \
    --to=farman@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.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).