netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: gpiccoli@canonical.com
Cc: netanel@amazon.com, akiyano@amazon.com, netdev@vger.kernel.org,
	gtzalik@amazon.com, saeedb@amazon.com, zorik@amazon.com,
	kernel@gpiccoli.net, gshan@redhat.com, gavin.guo@canonical.com,
	jay.vosburgh@canonical.com, pedro.principeza@canonical.com
Subject: Re: [PATCH] net: ena: Add PCI shutdown handler to allow safe kexec
Date: Wed, 25 Mar 2020 12:04:12 -0700 (PDT)	[thread overview]
Message-ID: <20200325.120412.734295569199099804.davem@davemloft.net> (raw)
In-Reply-To: <20200320125534.28966-1-gpiccoli@canonical.com>

From: "Guilherme G. Piccoli" <gpiccoli@canonical.com>
Date: Fri, 20 Mar 2020 09:55:34 -0300

> Currently ENA only provides the PCI remove() handler, used during rmmod
> for example. This is not called on shutdown/kexec path; we are potentially
> creating a failure scenario on kexec:
> 
> (a) Kexec is triggered, no shutdown() / remove() handler is called for ENA;
> instead pci_device_shutdown() clears the master bit of the PCI device,
> stopping all DMA transactions;
> 
> (b) Kexec reboot happens and the device gets enabled again, likely having
> its FW with that DMA transaction buffered; then it may trigger the (now
> invalid) memory operation in the new kernel, corrupting kernel memory area.
> 
> This patch aims to prevent this, by implementing a shutdown() handler
> quite similar to the remove() one - the difference being the handling
> of the netdev, which is unregistered on remove(), but following the
> convention observed in other drivers, it's only detached on shutdown().
> 
> This prevents an odd issue in AWS Nitro instances, in which after the 2nd
> kexec the next one will fail with an initrd corruption, caused by a wild
> DMA write to invalid kernel memory. The lspci output for the adapter
> present in my instance is:
> 
> 00:05.0 Ethernet controller [0200]: Amazon.com, Inc. Elastic Network
> Adapter (ENA) [1d0f:ec20]
> 
> Suggested-by: Gavin Shan <gshan@redhat.com>
> Signed-off-by: Guilherme G. Piccoli <gpiccoli@canonical.com>

Applied and queued up for -stable, thank you.

  parent reply	other threads:[~2020-03-25 19:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 12:55 [PATCH] net: ena: Add PCI shutdown handler to allow safe kexec Guilherme G. Piccoli
2020-03-24  4:04 ` David Miller
2020-03-24 20:04 ` Bhupesh Sharma
2020-03-25 19:04 ` David Miller [this message]
2020-03-25 19:06   ` Guilherme G. Piccoli
2020-03-23  9:05 Jubran, Samih
2020-03-23 14:09 ` Guilherme G. Piccoli

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=20200325.120412.734295569199099804.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=akiyano@amazon.com \
    --cc=gavin.guo@canonical.com \
    --cc=gpiccoli@canonical.com \
    --cc=gshan@redhat.com \
    --cc=gtzalik@amazon.com \
    --cc=jay.vosburgh@canonical.com \
    --cc=kernel@gpiccoli.net \
    --cc=netanel@amazon.com \
    --cc=netdev@vger.kernel.org \
    --cc=pedro.principeza@canonical.com \
    --cc=saeedb@amazon.com \
    --cc=zorik@amazon.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).