From nobody Mon Feb 9 15:10:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1652106905; cv=none; d=zohomail.com; s=zohoarc; b=mHCc7CCq3yLgx8jQmg7K8yCyifZXhYUSQZrof0CwVkXWVzoEs8Ur96M5hc8vH/akKlM/bjvKxGcnqueQEBob+C/wreBC+h+IjvmbRaR1ro6JJbvgxdYHXSGWsNfQu3+nPt8yU6FCzT/hOz5W+6L/jfNAF7fuItoVX3Wnp8QgtPo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652106905; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OAD0hQ8O/B6FAIVZQSbMeuJlJqdcAErXgyUTsjn6Luk=; b=YfejWwFqAxie8bDImszIChqgXlzHJmiypv/wbNRvNTsgp6TCB8BmmvMPu2JwqHLcTvCC9Kna5Hve1RdOwQGkt+3wk2ewISK3/oymYUwZufgJ9Ou2tVNgDTnwuJ/7yvzWkg/T4SB+zxOPsbmLF4fTaNxex6b83zgzvlm9HnHEKwE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1652106905710958.5961608649618; Mon, 9 May 2022 07:35:05 -0700 (PDT) Received: from localhost ([::1]:46684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no4TY-0003tz-26 for importer@patchew.org; Mon, 09 May 2022 10:35:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no4EN-0002Hj-4z; Mon, 09 May 2022 10:19:25 -0400 Received: from mga05.intel.com ([192.55.52.43]:24288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no4EL-0001AQ-HO; Mon, 09 May 2022 10:19:22 -0400 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2022 07:19:19 -0700 Received: from lmaniak-dev.elements.local ([10.55.249.72]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2022 07:19:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652105961; x=1683641961; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wCnjRNxx0aBPKHmxBrCa2GOKDCDydqbCCvB5XSuBI9k=; b=PptGfoDanHtObCht+6G/KMh2CPzI2KsnNa9MiNYXtVK0PZ6EnNGM+eWf l6TGjXfNdJJxeNjxVUSwsFBN61HMDDlmFmrBWESanyFmMwJXDltdhufrY UcIptugcSnx0bWSJ8ErGGgg2NZKZS/e3kGNAmRzPK+p1WiqAoXTihCOw8 YoeS7fUXjwQWqjZ0Dop4Cb6ADRnvV5PeCb5+hWhs/jKoWvW0HtLp8U123 Za+G5xbIITSQ7vfR8QTCJzAI2Z2Q9+d6wVZrounbuF0DjSmXFDxu6x9bm 6h/IVlEEU4bjBRilOKOuSx4MJ+sEMJhEoV3e8BZqzRSYooRSwyRFUocdd Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10342"; a="355490904" X-IronPort-AV: E=Sophos;i="5.91,211,1647327600"; d="scan'208";a="355490904" X-IronPort-AV: E=Sophos;i="5.91,211,1647327600"; d="scan'208";a="622987375" From: Lukasz Maniak To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, ani@anisinha.ca, armbru@redhat.com, f4bug@amsat.org, fam@euphon.net, hreitz@redhat.com, imammedo@redhat.com, its@irrelevant.dk, kbusch@kernel.org, k.jensen@samsung.com, kwolf@redhat.com, lukasz.gieryk@linux.intel.com, lukasz.maniak@linux.intel.com, marcel.apfelbaum@gmail.com, mst@redhat.com, stefanha@redhat.com, xypron.glpk@gmx.de Subject: [PATCH v8 11/12] hw/nvme: Update the initalization place for the AER queue Date: Mon, 9 May 2022 16:16:19 +0200 Message-Id: <20220509141620.3868733-12-lukasz.maniak@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509141620.3868733-1-lukasz.maniak@linux.intel.com> References: <20220509141620.3868733-1-lukasz.maniak@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=192.55.52.43; envelope-from=lukasz.maniak@linux.intel.com; helo=mga05.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1652106907736100001 From: =C5=81ukasz Gieryk This patch updates the initialization place for the AER queue, so it=E2=80= =99s initialized once, at controller initialization, and not every time controller is enabled. While the original version works for a non-SR-IOV device, as it=E2=80=99s h= ard to interact with the controller if it=E2=80=99s not enabled, the multiple reinitialization is not necessarily correct. With the SR/IOV feature enabled a segfault can happen: a VF can have its controller disabled, while a namespace can still be attached to the controller through the parent PF. An event generated in such case ends up on an uninitialized queue. While it=E2=80=99s an interesting question whether a VF should support AER = in the first place, I don=E2=80=99t think it must be answered today. Signed-off-by: =C5=81ukasz Gieryk Reviewed-by: Klaus Jensen Acked-by: Michael S. Tsirkin --- hw/nvme/ctrl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 247c09882dd..b0862b1d96c 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -6326,8 +6326,6 @@ static int nvme_start_ctrl(NvmeCtrl *n) =20 nvme_set_timestamp(n, 0ULL); =20 - QTAILQ_INIT(&n->aer_queue); - nvme_select_iocs(n); =20 return 0; @@ -6987,6 +6985,7 @@ static void nvme_init_state(NvmeCtrl *n) n->features.temp_thresh_hi =3D NVME_TEMPERATURE_WARNING; n->starttime_ms =3D qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL); n->aer_reqs =3D g_new0(NvmeRequest *, n->params.aerl + 1); + QTAILQ_INIT(&n->aer_queue); =20 list->numcntl =3D cpu_to_le16(max_vfs); for (i =3D 0; i < max_vfs; i++) { --=20 2.25.1