From patchwork Wed Jul 18 15:10:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Farhan Ali X-Patchwork-Id: 10532659 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BE3EC6020A for ; Wed, 18 Jul 2018 15:11:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE1CE29884 for ; Wed, 18 Jul 2018 15:11:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A291329882; Wed, 18 Jul 2018 15:11:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6B4FD29855 for ; Wed, 18 Jul 2018 15:11:24 +0000 (UTC) Received: from localhost ([::1]:37085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ffo6t-0004Vr-LG for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Jul 2018 11:11:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ffo69-00049A-8Y for qemu-devel@nongnu.org; Wed, 18 Jul 2018 11:10:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ffo66-0002IU-3k for qemu-devel@nongnu.org; Wed, 18 Jul 2018 11:10:37 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57526 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ffo65-0002HP-SW for qemu-devel@nongnu.org; Wed, 18 Jul 2018 11:10:34 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6IF86lN112954 for ; Wed, 18 Jul 2018 11:10:32 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ka6fhvd9h-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 18 Jul 2018 11:10:32 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Jul 2018 09:10:31 -0600 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 18 Jul 2018 09:10:30 -0600 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6IFAToX721246 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 18 Jul 2018 08:10:29 -0700 Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1D04C6A057; Wed, 18 Jul 2018 09:10:29 -0600 (MDT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7F2DC6A04D; Wed, 18 Jul 2018 09:10:28 -0600 (MDT) Received: from [9.56.58.136] (unknown [9.56.58.136]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 18 Jul 2018 09:10:28 -0600 (MDT) To: Nishanth Aravamudan References: <20180717205212.GA9580@breakout> From: Farhan Ali Date: Wed, 18 Jul 2018 11:10:27 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18071815-0036-0000-0000-00000A113651 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009386; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000266; SDB=6.01062617; UDB=6.00545601; IPR=6.00840472; MB=3.00022186; MTD=3.00000008; XFM=3.00000015; UTC=2018-07-18 15:10:31 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18071815-0037-0000-0000-00004825614B Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-07-18_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807180169 X-MIME-Autoconverted: from 8bit to quoted-printable by mx0b-001b2d01.pphosted.com id w6IF86lN112954 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: Re: [Qemu-devel] [BUG?] aio_get_linux_aio: Assertion `ctx->linux_aio' failed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Cornelia Huck , QEMU Developers , Christian Borntraeger , "open list:virtio-ccw" , Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 07/18/2018 09:42 AM, Farhan Ali wrote: > > > On 07/17/2018 04:52 PM, Nishanth Aravamudan wrote: >> iiuc, this possibly implies AIO was not actually used previously on this >> guest (it might have silently been falling back to threaded IO?). I >> don't have access to s390x, but would it be possible to run qemu under >> gdb and see if aio_setup_linux_aio is being called at all (I think it >> might not be, but I'm not sure why), and if so, if it's for the context >> in question? >> >> If it's not being called first, could you see what callpath is calling >> aio_get_linux_aio when this assertion trips? >> >> Thanks! >> -Nish > > > Hi Nishant, > > From the coredump of the guest this is the call trace that calls > aio_get_linux_aio: > > > Stack trace of thread 145158: > #0  0x000003ff94dbe274 raise (libc.so.6) > #1  0x000003ff94da39a8 abort (libc.so.6) > #2  0x000003ff94db62ce __assert_fail_base (libc.so.6) > #3  0x000003ff94db634c __assert_fail (libc.so.6) > #4  0x000002aa20db067a aio_get_linux_aio (qemu-system-s390x) > #5  0x000002aa20d229a8 raw_aio_plug (qemu-system-s390x) > #6  0x000002aa20d309ee bdrv_io_plug (qemu-system-s390x) > #7  0x000002aa20b5a8ea virtio_blk_handle_vq (qemu-system-s390x) > #8  0x000002aa20db2f6e aio_dispatch_handlers (qemu-system-s390x) > #9  0x000002aa20db3c34 aio_poll (qemu-system-s390x) > #10 0x000002aa20be32a2 iothread_run (qemu-system-s390x) > #11 0x000003ff94f879a8 start_thread (libpthread.so.0) > #12 0x000003ff94e797ee thread_start (libc.so.6) > > > Thanks for taking a look and responding. > > Thanks > Farhan > > > Trying to debug a little further, the block device in this case is a "host device". And looking at your commit carefully you use the bdrv_attach_aio_context callback to setup a Linux AioContext. For some reason the "host device" struct (BlockDriver bdrv_host_device in block/file-posix.c) does not have a bdrv_attach_aio_context defined. So a simple change of adding the callback to the struct solves the issue and the guest starts fine. I am not too familiar with block device code in QEMU, so not sure if this is the right fix or if there are some underlying problems. Thanks Farhan diff --git a/block/file-posix.c b/block/file-posix.c index 28824aa..b8d59fb 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -3135,6 +3135,7 @@ static BlockDriver bdrv_host_device = { .bdrv_refresh_limits = raw_refresh_limits, .bdrv_io_plug = raw_aio_plug, .bdrv_io_unplug = raw_aio_unplug, + .bdrv_attach_aio_context = raw_aio_attach_aio_context, .bdrv_co_truncate = raw_co_truncate, .bdrv_getlength = raw_getlength,