All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Sean Nyekjaer <sean@geanix.com>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
	linux-kernel@vger.kernel.org,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Boris Brezillon <bbrezillon@kernel.org>,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH v5 3/4] mtd: core: protect access to MTD devices while in suspend
Date: Mon, 13 Dec 2021 12:06:58 +0100	[thread overview]
Message-ID: <20211213120658.45f312a6@collabora.com> (raw)
In-Reply-To: <20211213105012.65jk4rylxzncqdfy@skn-laptop>

On Mon, 13 Dec 2021 12:50:12 +0200
Sean Nyekjaer <sean@geanix.com> wrote:

> Hi Miquel and Boris,
> 
> On Mon, Dec 13, 2021 at 10:53:36AM +0100, Boris Brezillon wrote:
> > On Mon, 13 Dec 2021 10:33:50 +0100
> > Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >   
> > > Hello,
> > > 
> > > boris.brezillon@collabora.com wrote on Mon, 13 Dec 2021 10:28:01 +0100:
> > >   
> > > > On Mon, 13 Dec 2021 10:10:25 +0100
> > > > Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> > > >     
> > > > > Hi Sean,
> > > > > 
> > > > > sean@geanix.com wrote on Fri, 10 Dec 2021 14:25:35 +0100:
> > > > >       
> > > > > > On Thu, Dec 09, 2021 at 03:28:11PM +0100, Miquel Raynal wrote:        
> > > > > > > Hi Sean,
> > > > > > > 
> > > > > > > sean@geanix.com wrote on Thu, 9 Dec 2021 15:07:21 +0100:
> > > > > > >           
> > > > > > > > On Fri, Dec 03, 2021 at 02:39:58PM +0100, Miquel Raynal wrote:          
> > > > > > > > > Hello,
> > > > > > > > >             
> > > > > > > > > > > Fine by me, lets drop this series.            
> > > > > > > > > 
> > > > > > > > > FYI I've dropped the entire series from mtd/next. I'm waiting for the
> > > > > > > > > fix discussed below (without abusing the chip mutex ;-) ).            
> > > > > > > > 
> > > > > > > > Cool, looking forward to test a patch series :)          
> > > > > > > 
> > > > > > > Test? You mean "write"? :)
> > > > > > > 
> > > > > > > Cheers,
> > > > > > > Miquèl          
> > > > > > 
> > > > > > Hi Miquel,
> > > > > > 
> > > > > > Should we us a atomic for the suspended variable?        
> > > > > 
> > > > > I haven't thought about it extensively, an atomic variable sound fine
> > > > > but I am definitely not a locking expert...      
> > > > 
> > > > No need to use an atomic if the variable is already protected by a lock
> > > > when accessed, and this seems to be case.    
> > > 
> > > Maybe there was a confusion about this lock: I think Boris just do not
> > > want the core to take any lock during a suspend operation. But you can
> > > still use locks, as long as you release them before suspending.
> > > 
> > > And also, that chip lock might not be the one you want to take because
> > > it's been introduced for another purpose.  
> > 
> > Access to the suspended field is already protected by the chip lock,
> > and I think it's just fine to keep it this way.  
> 
> I'm reading the suspended variable in wait_event() outside the lock :/

It doesn't matter because you're checking it again with the lock held
when doing a new loop iteration.

WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Sean Nyekjaer <sean@geanix.com>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
	linux-kernel@vger.kernel.org,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Boris Brezillon <bbrezillon@kernel.org>,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH v5 3/4] mtd: core: protect access to MTD devices while in suspend
Date: Mon, 13 Dec 2021 12:06:58 +0100	[thread overview]
Message-ID: <20211213120658.45f312a6@collabora.com> (raw)
In-Reply-To: <20211213105012.65jk4rylxzncqdfy@skn-laptop>

On Mon, 13 Dec 2021 12:50:12 +0200
Sean Nyekjaer <sean@geanix.com> wrote:

> Hi Miquel and Boris,
> 
> On Mon, Dec 13, 2021 at 10:53:36AM +0100, Boris Brezillon wrote:
> > On Mon, 13 Dec 2021 10:33:50 +0100
> > Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >   
> > > Hello,
> > > 
> > > boris.brezillon@collabora.com wrote on Mon, 13 Dec 2021 10:28:01 +0100:
> > >   
> > > > On Mon, 13 Dec 2021 10:10:25 +0100
> > > > Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> > > >     
> > > > > Hi Sean,
> > > > > 
> > > > > sean@geanix.com wrote on Fri, 10 Dec 2021 14:25:35 +0100:
> > > > >       
> > > > > > On Thu, Dec 09, 2021 at 03:28:11PM +0100, Miquel Raynal wrote:        
> > > > > > > Hi Sean,
> > > > > > > 
> > > > > > > sean@geanix.com wrote on Thu, 9 Dec 2021 15:07:21 +0100:
> > > > > > >           
> > > > > > > > On Fri, Dec 03, 2021 at 02:39:58PM +0100, Miquel Raynal wrote:          
> > > > > > > > > Hello,
> > > > > > > > >             
> > > > > > > > > > > Fine by me, lets drop this series.            
> > > > > > > > > 
> > > > > > > > > FYI I've dropped the entire series from mtd/next. I'm waiting for the
> > > > > > > > > fix discussed below (without abusing the chip mutex ;-) ).            
> > > > > > > > 
> > > > > > > > Cool, looking forward to test a patch series :)          
> > > > > > > 
> > > > > > > Test? You mean "write"? :)
> > > > > > > 
> > > > > > > Cheers,
> > > > > > > Miquèl          
> > > > > > 
> > > > > > Hi Miquel,
> > > > > > 
> > > > > > Should we us a atomic for the suspended variable?        
> > > > > 
> > > > > I haven't thought about it extensively, an atomic variable sound fine
> > > > > but I am definitely not a locking expert...      
> > > > 
> > > > No need to use an atomic if the variable is already protected by a lock
> > > > when accessed, and this seems to be case.    
> > > 
> > > Maybe there was a confusion about this lock: I think Boris just do not
> > > want the core to take any lock during a suspend operation. But you can
> > > still use locks, as long as you release them before suspending.
> > > 
> > > And also, that chip lock might not be the one you want to take because
> > > it's been introduced for another purpose.  
> > 
> > Access to the suspended field is already protected by the chip lock,
> > and I think it's just fine to keep it this way.  
> 
> I'm reading the suspended variable in wait_event() outside the lock :/

It doesn't matter because you're checking it again with the lock held
when doing a new loop iteration.

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2021-12-13 11:07 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 11:02 [PATCH v5 0/4] mtd: core: protect access to mtd devices while in suspend Sean Nyekjaer
2021-11-02 11:02 ` Sean Nyekjaer
2021-11-02 11:02 ` [PATCH v5 1/4] mtd: rawnand: nand_bbt: hide suspend/resume hooks while scanning bbt Sean Nyekjaer
2021-11-02 11:02   ` Sean Nyekjaer
2021-11-19 18:35   ` Miquel Raynal
2021-11-19 18:35     ` Miquel Raynal
2021-11-02 11:02 ` [PATCH v5 2/4] mtd: mtdconcat: don't use mtd_{suspend,resume}() Sean Nyekjaer
2021-11-02 11:02   ` Sean Nyekjaer
2021-11-19 18:35   ` Miquel Raynal
2021-11-19 18:35     ` Miquel Raynal
2021-11-02 11:02 ` [PATCH v5 3/4] mtd: core: protect access to MTD devices while in suspend Sean Nyekjaer
2021-11-02 11:02   ` Sean Nyekjaer
2021-11-19 18:35   ` Miquel Raynal
2021-11-19 18:35     ` Miquel Raynal
     [not found]   ` <CGME20211123120353eucas1p2fb2561b7cfddd8d6e7decaef8b504f4c@eucas1p2.samsung.com>
2021-11-23 12:03     ` Marek Szyprowski
2021-11-23 12:03       ` Marek Szyprowski
2021-11-23 12:50       ` Sean Nyekjaer
2021-11-23 12:50         ` Sean Nyekjaer
2021-11-23 13:07         ` Boris Brezillon
2021-11-23 13:07           ` Boris Brezillon
2021-11-29  9:19           ` Miquel Raynal
2021-11-29  9:19             ` Miquel Raynal
2021-11-29  9:41             ` Sean Nyekjaer
2021-11-29  9:41               ` Sean Nyekjaer
2021-11-29 11:17               ` Marek Szyprowski
2021-11-29 11:17                 ` Marek Szyprowski
2021-11-30 12:41                 ` Sean Nyekjaer
2021-11-30 12:41                   ` Sean Nyekjaer
2021-11-30 13:15                   ` Boris Brezillon
2021-11-30 13:15                     ` Boris Brezillon
2021-11-30 13:29                     ` Sean Nyekjaer
2021-11-30 13:29                       ` Sean Nyekjaer
2021-11-30 13:37                       ` Boris Brezillon
2021-11-30 13:37                         ` Boris Brezillon
2021-12-03 13:39                         ` Miquel Raynal
2021-12-03 13:39                           ` Miquel Raynal
2021-12-09 14:07                           ` Sean Nyekjaer
2021-12-09 14:07                             ` Sean Nyekjaer
2021-12-09 14:28                             ` Miquel Raynal
2021-12-09 14:28                               ` Miquel Raynal
2021-12-10 13:25                               ` Sean Nyekjaer
2021-12-10 13:25                                 ` Sean Nyekjaer
2021-12-13  9:10                                 ` Miquel Raynal
2021-12-13  9:10                                   ` Miquel Raynal
2021-12-13  9:28                                   ` Boris Brezillon
2021-12-13  9:28                                     ` Boris Brezillon
2021-12-13  9:33                                     ` Miquel Raynal
2021-12-13  9:33                                       ` Miquel Raynal
2021-12-13  9:53                                       ` Boris Brezillon
2021-12-13  9:53                                         ` Boris Brezillon
2021-12-13 10:50                                         ` Sean Nyekjaer
2021-12-13 10:50                                           ` Sean Nyekjaer
2021-12-13 11:06                                           ` Boris Brezillon [this message]
2021-12-13 11:06                                             ` Boris Brezillon
2021-11-02 11:02 ` [PATCH v5 4/4] mtd: rawnand: remove suspended check Sean Nyekjaer
2021-11-02 11:02   ` Sean Nyekjaer
2021-11-19 18:35   ` Miquel Raynal
2021-11-19 18:35     ` Miquel Raynal

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=20211213120658.45f312a6@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=bbrezillon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=m.szyprowski@samsung.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=sean@geanix.com \
    --cc=vigneshr@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.