qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 1e64fa: hw/nvme: fix narrowing conversion


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 1e64fa: hw/nvme: fix narrowing conversion
Date: Fri, 03 Jun 2022 19:31:36 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 1e64facc015e16d8e4efa239feaeda9e4e9aeb04
      
https://github.com/qemu/qemu/commit/1e64facc015e16d8e4efa239feaeda9e4e9aeb04
  Author: Dmitry Tikhov <ddtikhov@gmail.com>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M hw/nvme/ns.c

  Log Message:
  -----------
  hw/nvme: fix narrowing conversion

Since nlbas is of type int, it does not work with large namespace size
values, e.g., 9 TB size of file backing namespace and 8 byte metadata
with 4096 bytes lbasz gives negative nlbas value, which is later
promoted to negative int64_t type value and results in negative
ns->moff which breaks namespace

Signed-off-by: Dmitry Tikhov <ddtikhov@gmail.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: 51c453266309166c2737623211c0afc12884cccd
      
https://github.com/qemu/qemu/commit/51c453266309166c2737623211c0afc12884cccd
  Author: Dmitry Tikhov <d.tihov@yadro.com>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M hw/nvme/ctrl.c

  Log Message:
  -----------
  hw/nvme: add missing return statement

Since there is no return after nvme_dsm_cb invocation, metadata
associated with non-zero block range is currently zeroed. Also this
behaviour leads to segfault since we schedule iocb->bh two times.
First when entering nvme_dsm_cb with iocb->idx == iocb->nr and
second because of missing return on call stack unwinding by calling
blk_aio_pwrite_zeroes and subsequent nvme_dsm_cb callback.

Fixes: d7d1474fd85d ("hw/nvme: reimplement dsm to allow cancellation")
Signed-off-by: Dmitry Tikhov <d.tihov@yadro.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: 2e8f952ae7de23b4847937dbbf51f7a1ab10a2af
      
https://github.com/qemu/qemu/commit/2e8f952ae7de23b4847937dbbf51f7a1ab10a2af
  Author: Dmitry Tikhov <d.tihov@yadro.com>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M hw/nvme/ctrl.c

  Log Message:
  -----------
  hw/nvme: fix copy cmd for pi enabled namespaces

Current implementation have problem in the read part of copy command.
Because there is no metadata mangling before nvme_dif_check invocation,
reftag error could be thrown for blocks of namespace that have not been
previously written to.

Signed-off-by: Dmitry Tikhov <d.tihov@yadro.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: 9235a72a5df0fae1ede89f02717b597ef91cf6ad
      
https://github.com/qemu/qemu/commit/9235a72a5df0fae1ede89f02717b597ef91cf6ad
  Author: Klaus Jensen <k.jensen@samsung.com>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M hw/nvme/ctrl.c

  Log Message:
  -----------
  hw/nvme: fix smart aen

Pass the right constant to nvme_smart_event(). The NVME_AER* values hold
the bit position in the SMART byte, not the shifted value that we expect
it to be in nvme_smart_event().

Fixes: c62720f137df ("hw/block/nvme: trigger async event during injecting smart 
warning")
Acked-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: a859eb9f8f64e116671048a43a07d87bc6527a55
      
https://github.com/qemu/qemu/commit/a859eb9f8f64e116671048a43a07d87bc6527a55
  Author: Klaus Jensen <k.jensen@samsung.com>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M hw/nvme/nvme.h
    M hw/nvme/subsys.c

  Log Message:
  -----------
  hw/nvme: enforce common serial per subsystem

The Identify Controller Serial Number (SN) is the serial number for the
NVM subsystem and must be the same across all controller in the NVM
subsystem.

Enforce this.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: 36d83272d5e45dff13e988ee0a59f11c58b442ba
      
https://github.com/qemu/qemu/commit/36d83272d5e45dff13e988ee0a59f11c58b442ba
  Author: Klaus Jensen <k.jensen@samsung.com>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M docs/about/deprecated.rst
    M hw/core/machine.c
    M hw/nvme/ns.c

  Log Message:
  -----------
  hw/nvme: do not auto-generate eui64

We cannot provide auto-generated unique or persistent namespace
identifiers (EUI64, NGUID, UUID) easily. Since 6.1, namespaces have been
assigned a generated EUI64 of the form "52:54:00:<namespace counter>".
This is will be unique within a QEMU instance, but not globally.

Revert that this is assigned automatically and immediately deprecate the
compatibility parameter. Users can opt-in to this with the
`eui64-default=on` device parameter or set it explicitly with
`eui64=UINT64`.

Cc: libvir-list@redhat.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: bd9f371c6f6eeb8e907dfc770876ad8ef4ff85fc
      
https://github.com/qemu/qemu/commit/bd9f371c6f6eeb8e907dfc770876ad8ef4ff85fc
  Author: Klaus Jensen <k.jensen@samsung.com>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M hw/nvme/ns.c

  Log Message:
  -----------
  hw/nvme: do not auto-generate uuid

Do not default to generate an UUID for namespaces if it is not
explicitly specified.

This is a technically a breaking change in behavior. However, since the
UUID changes on every VM launch, it is not spec compliant and is of
little use since the UUID cannot be used reliably anyway and the
behavior prior to this patch must be considered buggy.

Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: 9f2e1acf83c332752f52c39dad390c94ec2ba9f5
      
https://github.com/qemu/qemu/commit/9f2e1acf83c332752f52c39dad390c94ec2ba9f5
  Author: Klaus Jensen <k.jensen@samsung.com>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M hw/nvme/ctrl.c

  Log Message:
  -----------
  hw/nvme: do not report null uuid

Do not report the "null uuid" (all zeros) in the namespace
identification descriptors.

Reported-by: Luis Chamberlain <mcgrof@kernel.org>
Reported-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: fbba243bc700a4e479331e20544c7f6a41ae87b3
      
https://github.com/qemu/qemu/commit/fbba243bc700a4e479331e20544c7f6a41ae87b3
  Author: Klaus Jensen <k.jensen@samsung.com>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M hw/nvme/ctrl.c

  Log Message:
  -----------
  hw/nvme: bump firmware revision

The Linux kernel quirks the QEMU NVMe controller pretty heavily because
of the namespace identifier mess. Since this is now fixed, bump the
firmware revision number to allow the quirk to be disabled for this
revision.

As of now, bump the firmware revision number to be equal to the QEMU
release version number.

Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: 8b1e59a6873662a01379cf052384e5dedefe7447
      
https://github.com/qemu/qemu/commit/8b1e59a6873662a01379cf052384e5dedefe7447
  Author: Klaus Jensen <k.jensen@samsung.com>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M docs/about/deprecated.rst

  Log Message:
  -----------
  hw/nvme: deprecate the use-intel-id compatibility parameter

Since version 5.2 commit 6eb7a071292a ("hw/block/nvme: change controller
pci id"), the emulated NVMe controller has defaulted to a non-Intel PCI
identifier.

Deprecate the compatibility parameter so we can get rid of it once and
for all.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: d7fe639cabf778903f6cab23ff58c905c71375ec
      
https://github.com/qemu/qemu/commit/d7fe639cabf778903f6cab23ff58c905c71375ec
  Author: Dmitry Tikhov <d.tihov@yadro.com>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M hw/nvme/dif.c

  Log Message:
  -----------
  hw/nvme: add new command abort case

NVMe command set specification for end-to-end data protection formatted
namespace states:

    o If the Reference Tag Check bit of the PRCHK field is set to ‘1’ and
      the namespace is formatted for Type 3 protection, then the
      controller:
          ▪ should not compare the protection Information Reference Tag
            field to the computed reference tag; and
          ▪ may ignore the ILBRT and EILBRT fields. If a command is
            aborted as a result of the Reference Tag Check bit of the
            PRCHK field being set to ‘1’, then that command should be
            aborted with a status code of Invalid Protection Information,
            but may be aborted with a status code of Invalid Field in
            Command.

Currently qemu compares reftag in the nvme_dif_prchk function whenever
Reference Tag Check bit is set in the command. For type 3 namespaces
however, caller of nvme_dif_prchk - nvme_dif_check does not increment
reftag for each subsequent logical block. That way commands incorporating
more than one logical block for type 3 formatted namespaces with reftag
check bit set, always fail with End-to-end Reference Tag Check Error.
Comply with spec by handling case of set Reference Tag Check
bit in the type 3 formatted namespace.

Fixes: 146f720c5563 ("hw/block/nvme: end-to-end data protection")
Signed-off-by: Dmitry Tikhov <d.tihov@yadro.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: ca127b3fc247517ec7d4dad291f2c0f90602ce5b
      
https://github.com/qemu/qemu/commit/ca127b3fc247517ec7d4dad291f2c0f90602ce5b
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-03 (Fri, 03 Jun 2022)

  Changed paths:
    M docs/about/deprecated.rst
    M hw/core/machine.c
    M hw/nvme/ctrl.c
    M hw/nvme/dif.c
    M hw/nvme/ns.c
    M hw/nvme/nvme.h
    M hw/nvme/subsys.c

  Log Message:
  -----------
  Merge tag 'nvme-next-pull-request' of git://git.infradead.org/qemu-nvme into 
staging

hw/nvme updates

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCAAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmKaZmgACgkQTeGvMW1P
# DenI7wgAxY4QtRlUnufzaZqcoi+affFTKlKm0JYKZm/Ldxt2RtHoWxRZDLLIUp8B
# 4XAlIGJw7VwrafEtSkx4K6cSyKluMJ9Ax8pNd03sEweXBBfdhNizspPprp+Jm9P9
# hRcH8kSiBp5B451cORBlgmoHguWeWawe1r66uFLTCbEMtfQQNaxNVsTsgAsOvtwv
# XsjLVFVKGNDWXGRta+lzu4seNNuzfucsAmKWUjg5HN38rstY7XxfLVMzt8ORcwjk
# oNmQuy3JiKujdPVhE5PVgNRZkigwoDt3hDA1QTncGTBUoA/CtaB5SK9EhcJ5xJVI
# EHv99S9LQ8ng5BJC2pUSU32yRkaNOQ==
# =XTXH
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 03 Jun 2022 12:52:08 PM PDT
# gpg:                using RSA key 522833AA75E2DCE6A24766C04DE1AF316D4F0DE9
# gpg: Good signature from "Klaus Jensen <its@irrelevant.dk>" [unknown]
# gpg:                 aka "Klaus Jensen <k.jensen@samsung.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: DDCA 4D9C 9EF9 31CC 3468  4272 63D5 6FC5 E55D A838
#      Subkey fingerprint: 5228 33AA 75E2 DCE6 A247  66C0 4DE1 AF31 6D4F 0DE9

* tag 'nvme-next-pull-request' of git://git.infradead.org/qemu-nvme:
  hw/nvme: add new command abort case
  hw/nvme: deprecate the use-intel-id compatibility parameter
  hw/nvme: bump firmware revision
  hw/nvme: do not report null uuid
  hw/nvme: do not auto-generate uuid
  hw/nvme: do not auto-generate eui64
  hw/nvme: enforce common serial per subsystem
  hw/nvme: fix smart aen
  hw/nvme: fix copy cmd for pi enabled namespaces
  hw/nvme: add missing return statement
  hw/nvme: fix narrowing conversion

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/70e975203f36...ca127b3fc247



reply via email to

[Prev in Thread] Current Thread [Next in Thread]