qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Dmitry Fomichev <Dmitry.Fomichev@wdc.com>,
	"its@irrelevant.dk" <its@irrelevant.dk>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "kwolf@redhat.com" <kwolf@redhat.com>,
	"qemu-block@nongnu.org" <qemu-block@nongnu.org>,
	"k.jensen@samsung.com" <k.jensen@samsung.com>,
	"mreitz@redhat.com" <mreitz@redhat.com>,
	"kbusch@kernel.org" <kbusch@kernel.org>,
	"info@dantalion.nl" <info@dantalion.nl>
Subject: Re: [PATCH] hw/block/nvme: improve invalid zasl value reporting
Date: Wed, 10 Feb 2021 07:09:40 +0100	[thread overview]
Message-ID: <19475525-e1cb-e1cf-4c68-30432c31bdde@redhat.com> (raw)
In-Reply-To: <4c6a62bf19b79eb7b770aba90425a0ebffbc9fb7.camel@wdc.com>

On 2/9/21 8:39 PM, Dmitry Fomichev wrote:
> On Mon, 2021-02-08 at 09:25 +0100, Klaus Jensen wrote:
>> From: Klaus Jensen <k.jensen@samsung.com>
>>
>> The Zone Append Size Limit (ZASL) must be at least 4096 bytes, so
>> improve the user experience by adding an early parameter check in
>> nvme_check_constraints.
>>
>> When ZASL is still too small due to the host configuring the device for
>> an even larger page size, convert the trace point in nvme_start_ctrl to
>> an NVME_GUEST_ERR such that this is logged by QEMU instead of only
>> traced.
>>
>> Reported-by: "info@dantalion.nl" <info@dantalion.nl>

Apparently the reporter signed 'Corne'.

>> Cc: Dmitry Fomichev <Dmitry.Fomichev@wdc.com>
>> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
>> ---
>>  hw/block/nvme.c | 12 ++++++++++--
>>  1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/block/nvme.c b/hw/block/nvme.c
>> index c2f0c88fbf39..d96888cd2333 100644
>> --- a/hw/block/nvme.c
>> +++ b/hw/block/nvme.c
>> @@ -3983,8 +3983,10 @@ static int nvme_start_ctrl(NvmeCtrl *n)
>>          n->zasl = n->params.mdts;
>>      } else {
>>          if (n->params.zasl_bs < n->page_size) {
>> -            trace_pci_nvme_err_startfail_zasl_too_small(n->params.zasl_bs,
>> -                                                        n->page_size);
>> +            NVME_GUEST_ERR(pci_nvme_err_startfail_zasl_too_small,
>> +                           "Zone Append Size Limit (ZASL) of %d bytes is too "
>> +                           "small; must be at least %d bytes",
>> +                           n->params.zasl_bs, n->page_size);
>>              return -1;
>>          }
>>          n->zasl = 31 - clz32(n->params.zasl_bs / n->page_size);
>> @@ -4503,6 +4505,12 @@ static void nvme_check_constraints(NvmeCtrl *n, Error **errp)
>>              error_setg(errp, "zone append size limit has to be a power of 2");
>>              return;
>>          }
>> +
>> +        if (n->params.zasl_bs < 4096) {
>> +            error_setg(errp, "zone append size limit must be at least "
>> +                       "4096 bytes");
>> +            return;
>> +        }
>>      }
>>  }
> 
> The guest error is less confusing than simply a trace. LGTM.

Trace events are meant for the developers when debugging, they
are usually stripped out in final build.

Errors are reported to the user / operator (i.e. incorrect
configuration).

Regards,

Phil.



  reply	other threads:[~2021-02-10  6:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08  8:25 [PATCH] hw/block/nvme: improve invalid zasl value reporting Klaus Jensen
2021-02-08  9:15 ` info
2021-02-08  9:19   ` Klaus Jensen
2021-02-09 19:39 ` Dmitry Fomichev
2021-02-10  6:09   ` Philippe Mathieu-Daudé [this message]
2021-02-10 20:56 ` Klaus Jensen

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=19475525-e1cb-e1cf-4c68-30432c31bdde@redhat.com \
    --to=philmd@redhat.com \
    --cc=Dmitry.Fomichev@wdc.com \
    --cc=info@dantalion.nl \
    --cc=its@irrelevant.dk \
    --cc=k.jensen@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.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).