From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>, "Kevin Wolf" <kwolf@redhat.com>,
qemu-block@nongnu.org,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
"Max Reitz" <mreitz@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Richard Henderson" <rth@twiddle.net>
Subject: [PATCH 0/3] block/nvme: Fix NVMeRegs alignment/packing and use atomic operations
Date: Wed, 16 Sep 2020 22:40:01 +0200 [thread overview]
Message-ID: <20200916204004.1511985-1-philmd@redhat.com> (raw)
Fix a compiler optimization problem introduced in commit
e5ff22ba9fc ("block/nvme: Pair doorbell registers"),
use atomic operations.
For some not understood yet reason using atomic_and triggers
a NMI on x86 arch. Using the following snippet on top of this
series:
-- >8 --
- atomic_set(&s->regs->ctrl.cc,
- cpu_to_le32(atomic_read(&s->regs->ctrl.cc) & const_le32(0xFE)=
));
+ atomic_and(&s->regs->ctrl.cc, const_le32(0xFE));
---
triggers:
{1}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source:=
3
{1}[Hardware Error]: event severity: fatal
{1}[Hardware Error]: Error 0, type: fatal
{1}[Hardware Error]: section_type: PCIe error
{1}[Hardware Error]: port_type: 0, PCIe end point
{1}[Hardware Error]: version: 1.16
{1}[Hardware Error]: command: 0x0006, status: 0x0010
{1}[Hardware Error]: device_id: 0000:04:00.0
{1}[Hardware Error]: slot: 0
{1}[Hardware Error]: secondary_bus: 0x00
{1}[Hardware Error]: vendor_id: 0x8086, device_id: 0x2701
{1}[Hardware Error]: class_code: 010802
{1}[Hardware Error]: aer_uncor_status: 0x00100000, aer_uncor_mask: 0x00018=
000
{1}[Hardware Error]: aer_uncor_severity: 0x000e7030
{1}[Hardware Error]: TLP Header: 33000000 00000000 00000000 00000000
Kernel panic - not syncing: Fatal hardware error!
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.6.8-100.fc30.x86_64 #1
Hardware name: Dell Inc. PowerEdge R430/03XKDV, BIOS 1.2.6 06/08/2015
Call Trace:
<NMI>
dump_stack+0x66/0x90
panic+0xf1/0x2d3
__ghes_panic.part.0+0x26/0x26
ghes_notify_nmi.cold+0x5/0x5
nmi_handle+0x66/0x120
default_do_nmi+0x45/0x100
do_nmi+0x165/0x1d0
end_repeat_nmi+0x16/0x50
RIP: 0010:intel_idle+0x82/0x130
Code: 65 48 8b 04 25 c0 8b 01 00 0f 01 c8 48 8b 00 a8 08 75 17 e9 07 00 00 0=
0 0f 00 2d f5 cd 6d 00 b9 01 00 00 00 48 89 d8 0f 01 c9 <65> 48 8b 04 25 c0 8=
b 01 00 f0 80 60 02 df f0 83 44 24 fc 00 b
RSP: 0018:ffffffffa8603e30 EFLAGS: 00000046
RAX: 0000000000000001 RBX: 0000000000000001 RCX: 0000000000000001
RDX: 0000000000000000 RSI: ffffffffa875edc0 RDI: 0000000000000000
RBP: ffffffffa875edc0 R08: 00000013ef2b797f R09: 000000000000ba42
R10: 00000000000993b3 R11: ffffa070afc29ca4 R12: 0000000000000002
R13: ffffffffa875edc0 R14: 0000000000000002 R15: ffffffffa8614840
? intel_idle+0x82/0x130
? intel_idle+0x82/0x130
</NMI>
cpuidle_enter_state+0x81/0x3e0
cpuidle_enter+0x29/0x40
do_idle+0x1c0/0x260
cpu_startup_entry+0x19/0x20
start_kernel+0x7ad/0x7ba
secondary_startup_64+0xb6/0xc0
Kernel Offset: 0x26000000 from 0xffffffff81000000 (relocation range: 0xfffff=
fff80000000-0xffffffffbfffffff)
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Philippe Mathieu-Daud=C3=A9 (3):
block/nvme: Initialize constant values with const_le32()
block/nvme: Use atomic operations instead of 'volatile' keyword
block/nvme: Align NVMeRegs structure to 4KiB and mark it packed
block/nvme.c | 55 ++++++++++++++++++++++++++++------------------------
1 file changed, 30 insertions(+), 25 deletions(-)
--=20
2.26.2
next reply other threads:[~2020-09-16 20:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 20:40 Philippe Mathieu-Daudé [this message]
2020-09-16 20:40 ` [PATCH 1/3] block/nvme: Initialize constant values with const_le32() Philippe Mathieu-Daudé
2020-09-17 9:55 ` Stefan Hajnoczi
2020-09-17 13:52 ` Philippe Mathieu-Daudé
2020-09-16 20:40 ` [PATCH 2/3] block/nvme: Use atomic operations instead of 'volatile' keyword Philippe Mathieu-Daudé
2020-09-17 10:42 ` Stefan Hajnoczi
2020-09-16 20:40 ` [PATCH 3/3] block/nvme: Align NVMeRegs structure to 4KiB and mark it packed Philippe Mathieu-Daudé
2020-09-17 11:07 ` Stefan Hajnoczi
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=20200916204004.1511985-1-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=dgilbert@redhat.com \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=stefanha@redhat.com \
/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).