From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W351Q-0003F1-Vh for qemu-devel@nongnu.org; Tue, 14 Jan 2014 09:31:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W351I-0002li-2I for qemu-devel@nongnu.org; Tue, 14 Jan 2014 09:31:16 -0500 Received: from e39.co.us.ibm.com ([32.97.110.160]:44063) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W351H-0002lc-Qs for qemu-devel@nongnu.org; Tue, 14 Jan 2014 09:31:07 -0500 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 14 Jan 2014 07:31:06 -0700 Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 48B3B1FF001B for ; Tue, 14 Jan 2014 07:30:34 -0700 (MST) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by b03cxnp07029.gho.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s0ECSgxe16187436 for ; Tue, 14 Jan 2014 13:28:42 +0100 Received: from d03av02.boulder.ibm.com (localhost [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s0EEV4Pt015661 for ; Tue, 14 Jan 2014 07:31:04 -0700 Message-ID: <52D54A27.7020109@linux.vnet.ibm.com> Date: Tue, 14 Jan 2014 09:31:03 -0500 From: Eric Farman MIME-Version: 1.0 References: <1389709469-15111-1-git-send-email-farman@linux.vnet.ibm.com> <1389709469-15111-4-git-send-email-farman@linux.vnet.ibm.com> In-Reply-To: <1389709469-15111-4-git-send-email-farman@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] scsi/virtio-scsi: Prevent assertion on missed events List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini 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 > --- > 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