lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yr8FG9/f60AVg7qJ@e120937-lin>
Date:   Fri, 1 Jul 2022 15:31:18 +0100
From:   Cristian Marussi <cristian.marussi@....com>
To:     Sudeep Holla <sudeep.holla@....com>
Cc:     linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        vincent.guittot@...aro.org, f.fainelli@...il.com
Subject: Re: [PATCH 2/5] firmware: arm_scmi: Support only one single
 SystemPower device

On Fri, Jul 01, 2022 at 02:45:09PM +0100, Sudeep Holla wrote:
> On Thu, Jun 23, 2022 at 01:47:39PM +0100, Cristian Marussi wrote:
> > In order to minimize SCMI platform fw-side complexity, only one single SCMI
> > platform should be in charge of SCMI SystemPower protocol communications
> > with the OSPM: enforce the existence of one single unique device associated
> > with SystemPower protocol across any possible number of SCMI platforms, and
> > warn if a system tries to register different SystemPower devices from
> > multiple platforms.
> > 
> > Signed-off-by: Cristian Marussi <cristian.marussi@....com>
> > ---
> >  drivers/firmware/arm_scmi/bus.c | 31 ++++++++++++++++++++++++++++++-
> >  1 file changed, 30 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
> > index a7cbf4d09081..476855d3dccb 100644
> > --- a/drivers/firmware/arm_scmi/bus.c
> > +++ b/drivers/firmware/arm_scmi/bus.c
> > @@ -19,6 +19,11 @@ static DEFINE_IDA(scmi_bus_id);
> >  static DEFINE_IDR(scmi_protocols);
> >  static DEFINE_SPINLOCK(protocol_lock);
> >  
> > +/* Track globally the creation of SCMI SystemPower related devices */
> > +static bool scmi_syspower_registered;
> > +/* Protect access to scmi_syspower_registered */
> > +static DEFINE_MUTEX(scmi_syspower_mtx);
> > +
> 

Hi Sudeep,

thanks for the review first of all.

> Since we create device from the driver, can't we do this from there
> and keep the bus code free from handling all these special conditions
> which are checked for each device creation.
> 
> Yes scmi_device_create can be called outside the exiting code but since it
> is not exported(yet), we can assume all users are in kernel and we can
> catch that if anyone attempts to add. And probably we don't need the lock
> as well if it is taken care in the single loop creating the device.
> 

Do you mean to move the check inside driver.c common routines like in
scmi_get_protocol_device() right before calling scmi_device_create() ?

If this is what you meant, yes I can do that to avoid polluting the
bus code...indeed it would be easier than dealing with all the internals
in scmi_device_create() like it is now, BUT regarding the mutex I'm not so
sure I can avoid it since the device creation is triggered at the end of
main platform probe (driver:scmi_probe()) BUT potentially also whenever a
new SCMI driver is (lately) loaded and asks for the device creation after
(or worst concurrently to) the main probe loop.

Beside that, there is the case of definitions of multiple SCMI platforms,
which is not officially supported I know but that is, in my understanding,
one of the most possible cause of having multiple instances of an SCMI
SystemPower driver trying to register. (i.e. multiple scmi DT nodes ALL
defining a SystemPower protocol with potentially multiple underlying FWs
advertising SystemPower support which was the thing we wanted to avoid
promoting ... AFAIU...but I could be missing something..)

Thanks,
Cristian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ