[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR04MB6575AC5B5FE4C306F6674194FCAA0@DM6PR04MB6575.namprd04.prod.outlook.com>
Date: Tue, 12 Jan 2021 08:20:11 +0000
From: Avri Altman <Avri.Altman@....com>
To: Bean Huo <huobean@...il.com>, Can Guo <cang@...eaurora.org>,
"asutoshd@...eaurora.org" <asutoshd@...eaurora.org>,
"nguyenb@...eaurora.org" <nguyenb@...eaurora.org>,
"hongwus@...eaurora.org" <hongwus@...eaurora.org>,
"ziqichen@...eaurora.org" <ziqichen@...eaurora.org>,
"rnayak@...eaurora.org" <rnayak@...eaurora.org>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"kernel-team@...roid.com" <kernel-team@...roid.com>,
"saravanak@...gle.com" <saravanak@...gle.com>,
"salyzyn@...gle.com" <salyzyn@...gle.com>
CC: Alim Akhtar <alim.akhtar@...sung.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Stanley Chu <stanley.chu@...iatek.com>,
Bean Huo <beanhuo@...ron.com>,
Nitin Rawat <nitirawa@...eaurora.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Bart Van Assche <bvanassche@....org>,
Satya Tangirala <satyat@...gle.com>,
open list <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 2/2] scsi: ufs: Protect PM ops and err_handler from user
access through sysfs
>
> On Sat, 2021-01-02 at 05:59 -0800, Can Guo wrote:
> > + * @shutting_down: flag to check if shutdown has been invoked
> > + * @host_sem: semaphore used to serialize concurrent contexts
> > * @eh_wq: Workqueue that eh_work works on
> > * @eh_work: Worker to handle UFS errors that require s/w attention
> > * @eeh_work: Worker to handle exception events
> > @@ -751,7 +753,8 @@ struct ufs_hba {
> > u32 intr_mask;
> > u16 ee_ctrl_mask;
> > bool is_powered;
> > - struct semaphore eh_sem;
> > + bool shutting_down;
> > + struct semaphore host_sem;
> >
> > /* Work Queues */
> > struct workqueue_struct *eh_wq;
> > @@ -875,6 +878,11 @@ static inline bool ufshcd_is_wb_allowed(struct
> > ufs_hba *hba)
> > return hba->caps & UFSHCD_CAP_WB_EN;
> > }
> >
> > +static inline bool ufshcd_is_sysfs_allowed(struct ufs_hba *hba)
> > +{
> > + return !hba->shutting_down;
> > +}
> > +
>
>
> Can,
>
> Instead adding new shutting_down flag, can we use availible variable
> system_state?
>
Like Can, I am too, don't think that using system state here, e.g. UFS_SHUTDOWN_PM suffices.
The use of the new flag, jointly with the semaphore, provides a tighter control.
Acked-by: Avri Altman <avri.altman@....com>
Powered by blists - more mailing lists