qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lukasz Maniak <lukasz.maniak@linux.intel.com>
To: qemu-devel@nongnu.org
Cc: "Klaus Jensen" <its@irrelevant.dk>,
	"Keith Busch" <kbusch@kernel.org>,
	"Lukasz Maniak" <lukasz.maniak@linux.intel.com>,
	qemu-block@nongnu.org,
	"Łukasz Gieryk" <lukasz.gieryk@linux.intel.com>
Subject: [PATCH v5 15/15] hw/nvme: Update the initalization place for the AER queue
Date: Thu, 17 Feb 2022 18:45:04 +0100	[thread overview]
Message-ID: <20220217174504.1051716-16-lukasz.maniak@linux.intel.com> (raw)
In-Reply-To: <20220217174504.1051716-1-lukasz.maniak@linux.intel.com>

From: Łukasz Gieryk <lukasz.gieryk@linux.intel.com>

This patch updates the initialization place for the AER queue, so it’s
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’s hard
to interact with the controller if it’s 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’s an interesting question whether a VF should support AER in
the first place, I don’t think it must be answered today.

Signed-off-by: Łukasz Gieryk <lukasz.gieryk@linux.intel.com>
---
 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 a9742cf5051..ae41fced596 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -6182,8 +6182,6 @@ static int nvme_start_ctrl(NvmeCtrl *n)
 
     nvme_set_timestamp(n, 0ULL);
 
-    QTAILQ_INIT(&n->aer_queue);
-
     nvme_select_iocs(n);
 
     return 0;
@@ -6844,6 +6842,7 @@ static void nvme_init_state(NvmeCtrl *n)
     n->features.temp_thresh_hi = NVME_TEMPERATURE_WARNING;
     n->starttime_ms = qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL);
     n->aer_reqs = g_new0(NvmeRequest *, n->params.aerl + 1);
+    QTAILQ_INIT(&n->aer_queue);
 
     list->numcntl = cpu_to_le16(max_vfs);
     for (i = 0; i < max_vfs; i++) {
-- 
2.25.1



  parent reply	other threads:[~2022-02-17 18:01 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 17:44 [PATCH v5 00/15] hw/nvme: SR-IOV with Virtualization Enhancements Lukasz Maniak
2022-02-17 17:44 ` [PATCH v5 01/15] pcie: Add support for Single Root I/O Virtualization (SR/IOV) Lukasz Maniak
2022-02-18  8:24   ` Michael S. Tsirkin
2022-02-17 17:44 ` [PATCH v5 02/15] pcie: Add some SR/IOV API documentation in docs/pcie_sriov.txt Lukasz Maniak
2022-02-18  8:24   ` Michael S. Tsirkin
2022-02-17 17:44 ` [PATCH v5 03/15] pcie: Add a helper to the SR/IOV API Lukasz Maniak
2022-02-18  8:25   ` Michael S. Tsirkin
2022-02-17 17:44 ` [PATCH v5 04/15] pcie: Add 1.2 version token for the Power Management Capability Lukasz Maniak
2022-02-18  8:25   ` Michael S. Tsirkin
2022-02-17 17:44 ` [PATCH v5 05/15] hw/nvme: Add support for SR-IOV Lukasz Maniak
2022-02-18  7:06   ` Klaus Jensen
2022-02-17 17:44 ` [PATCH v5 06/15] hw/nvme: Add support for Primary Controller Capabilities Lukasz Maniak
2022-02-17 17:44 ` [PATCH v5 07/15] hw/nvme: Add support for Secondary Controller List Lukasz Maniak
2022-02-17 17:44 ` [PATCH v5 08/15] hw/nvme: Implement the Function Level Reset Lukasz Maniak
2022-02-17 17:44 ` [PATCH v5 09/15] hw/nvme: Make max_ioqpairs and msix_qsize configurable in runtime Lukasz Maniak
2022-03-01 12:22   ` Klaus Jensen
2022-02-17 17:44 ` [PATCH v5 10/15] hw/nvme: Remove reg_size variable and update BAR0 size calculation Lukasz Maniak
2022-02-17 17:45 ` [PATCH v5 11/15] hw/nvme: Calculate BAR attributes in a function Lukasz Maniak
2022-02-17 17:45 ` [PATCH v5 12/15] hw/nvme: Initialize capability structures for primary/secondary controllers Lukasz Maniak
2022-02-18 14:37   ` Lukasz Maniak
2022-02-17 17:45 ` [PATCH v5 13/15] hw/nvme: Add support for the Virtualization Management command Lukasz Maniak
2022-03-01 13:07   ` Klaus Jensen
2022-03-09 12:41     ` Łukasz Gieryk
2022-03-11 12:20       ` Lukasz Maniak
2022-02-17 17:45 ` [PATCH v5 14/15] docs: Add documentation for SR-IOV and Virtualization Enhancements Lukasz Maniak
2022-03-01 12:23   ` Klaus Jensen
2022-03-21 12:36     ` Lukasz Maniak
2022-03-22  6:15       ` Klaus Jensen
2022-02-17 17:45 ` Lukasz Maniak [this message]
2022-02-18  6:49   ` [PATCH v5 15/15] hw/nvme: Update the initalization place for the AER queue Klaus Jensen
2022-02-18  8:23 ` [PATCH v5 00/15] hw/nvme: SR-IOV with Virtualization Enhancements Michael S. Tsirkin
2022-02-18 14:33   ` Lukasz Maniak
2022-02-18  8:26 ` Michael S. Tsirkin
2022-02-18  8:51   ` Klaus Jensen
2022-02-18  9:33     ` Michael S. Tsirkin

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=20220217174504.1051716-16-lukasz.maniak@linux.intel.com \
    --to=lukasz.maniak@linux.intel.com \
    --cc=its@irrelevant.dk \
    --cc=kbusch@kernel.org \
    --cc=lukasz.gieryk@linux.intel.com \
    --cc=qemu-block@nongnu.org \
    --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).