Re: [RFC] [PATCH 3/3] drivers: spi: spi.c: Don't use the message queue if possible in spi_sync

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

 



On Wed, May 25, 2022 at 04:46:03PM +0200, David Jander wrote:
> David Jander <david@xxxxxxxxxxx> wrote:

> > +static void __spi_transfer_message_noqueue(struct spi_controller *ctlr, struct spi_message *msg)
> > +{
> > +	bool was_busy;
> > +	int ret;
> > +
> > +	mutex_lock(&ctlr->io_mutex);
> > +
> > +	/* If another context is idling the device then wait */
> > +	while (ctlr->idling) {
> > +		printk(KERN_INFO "spi sync message processing: controller is idling!\n");
> > +		usleep_range(10000, 11000);
> > +	}

> This is dead ugly of course, and it needs to be removed. Not yet sure how,
> hence the RFC. Maybe the idle -> not busy transition can be included inside
> the io_mutex? That way this while will never be hit and can be removed...

I'm not sure it's even quite right from a safety point of view - idling
is protected by queue_lock but this now only takes io_mutex.  Moving
idling (and all the was_busy stuff) within the io_mutex would definitely
resolve the issue, the async submission context is the only one that
really needs the spinlock and it doesn't care about idling.  I can't
think what you could do with the io_mutex when idling so it seems to
fit.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux