stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Mark Brown <broonie@kernel.org>
Cc: Lino Sanfilippo <LinoSanfilippo@gmx.de>,
	f.fainelli@gmail.com, rjui@broadcom.com, sbranden@broadcom.com,
	bcm-kernel-feedback-list@broadcom.com, nsaenz@kernel.org,
	linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, p.rosenberger@kunbus.com,
	linux-integrity@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] spi: bcm2835: do not unregister controller in shutdown handler
Date: Mon, 4 Oct 2021 12:44:36 -0300	[thread overview]
Message-ID: <20211004154436.GY3544071@ziepe.ca> (raw)
In-Reply-To: <YVsLxHMCdXf4vS+i@sirena.org.uk>

On Mon, Oct 04, 2021 at 03:12:20PM +0100, Mark Brown wrote:
> On Mon, Oct 04, 2021 at 10:17:56AM -0300, Jason Gunthorpe wrote:
> 
> > Shutdown is supposed to quiet the HW so it is not doing DMAs any
> > more. This is basically an 'emergency' kind of path, the HW should be
> > violently stopped if available - ie clearing the bus master bits on
> > PCI, for instance.
> 
> > When something like kexec happens we need the machine to be in a state
> > where random DMA's are not corrupting memory.
> 
> That's all well and good but there's no point in implementing something
> half baked that's opening up a whole bunch of opportunities to crash the
> system if more work comes in after it's half broken the device setup.  

Well, that is up to the driver implementing this. It looks like device
shutdown is called before the userspace is all nuked so yes,
concurrency with userspace is a possible concern here.

> > Due to the emergency sort of nature it is not appropriate to do
> > locking complicated sorts of things like struct device unregistrations
> > here.
> 
> That's just not what's actually implemented in a bunch of places, nor
> something one would infer from the documentation ("Called at shut-down
> to quiesce the device", no mention of emergency cases which I'd guess
> would just be kdump) - 

Drivers mis understanding stuff is not new..

> that's a different thing and definitely abusing the API.  I would guess
> that a good proportion of people implementing it are more worried about
> clean system shutdown than they are about kdump.

The other important case is to get the device cleaned up enough to
pass back to firmware for platforms that use a firmware
shutdown/reboot path.

Jason

  reply	other threads:[~2021-10-04 15:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 19:56 [PATCH] spi: bcm2835: do not unregister controller in shutdown handler Lino Sanfilippo
2021-09-28 20:08 ` Mark Brown
2021-09-29  8:38   ` Aw: " Lino Sanfilippo
2021-10-01 17:54 ` Mark Brown
2021-10-03 15:25   ` Lino Sanfilippo
2021-10-04 12:49     ` Mark Brown
2021-10-04 13:17       ` Jason Gunthorpe
2021-10-04 14:12         ` Mark Brown
2021-10-04 15:44           ` Jason Gunthorpe [this message]
2021-10-04 16:31             ` Mark Brown
2021-10-04 16:36               ` Florian Fainelli
2021-10-04 16:51                 ` Jason Gunthorpe
2021-10-04 16:55                   ` Florian Fainelli
2021-10-04 17:13                     ` Jason Gunthorpe
2021-10-04 17:27                       ` Mark Brown
2021-10-04 17:35                         ` Jason Gunthorpe
2021-10-04 17:44                         ` Florian Fainelli
2021-10-04 17:56                           ` Mark Brown
2021-10-04 17:05                   ` Mark Brown
2021-10-04 16:52                 ` Mark Brown
2021-10-04 16:57                   ` Florian Fainelli
2021-10-04 18:30             ` Lino Sanfilippo
2021-10-04 18:37               ` Jason Gunthorpe

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=20211004154436.GY3544071@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=LinoSanfilippo@gmx.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=broonie@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=nsaenz@kernel.org \
    --cc=p.rosenberger@kunbus.com \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=stable@vger.kernel.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).