All of lore.kernel.org
 help / color / mirror / Atom feed
* Proposal to change sensor interface to use double values
@ 2018-08-06 19:10 James Feist
  2018-08-06 20:08 ` Patrick Venture
  2018-08-06 20:31 ` Tanous, Ed
  0 siblings, 2 replies; 5+ messages in thread
From: James Feist @ 2018-08-06 19:10 UTC (permalink / raw)
  To: OpenBMC Maillist

I've submitted a change to modify the sensor interface to remove scale, 
and make the sensor value a double. The main reason for doing this is 
simplification of the interface. In most usages, daemons pull the value, 
and the scale, then immediately translate this value to a double. This 
could easily be done once by the sensor producer instead of all daemons. 
The counter example that was given was phosphor-fan-presence, but doing 
a quick grep I can't find scale being used, so this might mean for a 
scaled fan you have to factor that in to all configuration files, or 
scaled fans aren't supported. The threshold interface is not usable 
independent from the value interface, as the thresholds are affected by 
the same scale. Using a fixed scale also won't work well for a 
logarithmic sensor, while floating point would. Realistic precision 
should not be affected for any common sensor. We also in the future may 
be interested in a daemon producing a threshold for a sensor that 
another daemon owns. With the scale existing elsewhere, this would not 
be trivial to map.

Review for context: https://gerrit.openbmc-project.xyz/#/c/11739/

This change is not ready to be submitted as is, but we would like to 
hear if there are any major objections. If not, we would like to start 
an upgrade path to support both interfaces until it is possible to make 
the switch. Bmcweb already supports both. In most cases this is just 
pulling the value using a visitor, and setting the scale to 0 if it does 
not exist. Max and Min can also be used for IPMI scaling.

Thanks,

- James Feist

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Proposal to change sensor interface to use double values
  2018-08-06 19:10 Proposal to change sensor interface to use double values James Feist
@ 2018-08-06 20:08 ` Patrick Venture
  2018-08-06 20:24   ` Emily Shaffer
  2018-08-06 20:31 ` Tanous, Ed
  1 sibling, 1 reply; 5+ messages in thread
From: Patrick Venture @ 2018-08-06 20:08 UTC (permalink / raw)
  To: James Feist; +Cc: OpenBMC Maillist

On Mon, Aug 6, 2018 at 12:10 PM, James Feist
<james.feist@linux.intel.com> wrote:
> I've submitted a change to modify the sensor interface to remove scale, and
> make the sensor value a double. The main reason for doing this is
> simplification of the interface. In most usages, daemons pull the value, and
> the scale, then immediately translate this value to a double. This could
> easily be done once by the sensor producer instead of all daemons. The
> counter example that was given was phosphor-fan-presence, but doing a quick
> grep I can't find scale being used, so this might mean for a scaled fan you
> have to factor that in to all configuration files, or scaled fans aren't
> supported. The threshold interface is not usable independent from the value
> interface, as the thresholds are affected by the same scale. Using a fixed
> scale also won't work well for a logarithmic sensor, while floating point
> would. Realistic precision should not be affected for any common sensor. We
> also in the future may be interested in a daemon producing a threshold for a
> sensor that another daemon owns. With the scale existing elsewhere, this
> would not be trivial to map.
>
> Review for context: https://gerrit.openbmc-project.xyz/#/c/11739/
>
> This change is not ready to be submitted as is, but we would like to hear if
> there are any major objections. If not, we would like to start an upgrade
> path to support both interfaces until it is possible to make the switch.
> Bmcweb already supports both. In most cases this is just pulling the value
> using a visitor, and setting the scale to 0 if it does not exist. Max and
> Min can also be used for IPMI scaling.

I'm fine with this.  It saves everybody converting it to a double
before using.  Further scaling, which can be necessary can be further
done against the double.  For instance, with ipmi, to fit a value we
sometimes scale again.

>
> Thanks,
>
> - James Feist
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Proposal to change sensor interface to use double values
  2018-08-06 20:08 ` Patrick Venture
@ 2018-08-06 20:24   ` Emily Shaffer
  2018-08-06 20:38     ` Vernon Mauery
  0 siblings, 1 reply; 5+ messages in thread
From: Emily Shaffer @ 2018-08-06 20:24 UTC (permalink / raw)
  To: Patrick Venture; +Cc: James Feist, OpenBMC Maillist

[-- Attachment #1: Type: text/plain, Size: 2137 bytes --]

Same, I'm ok with this.

On Mon, Aug 6, 2018 at 1:09 PM Patrick Venture <venture@google.com> wrote:

> On Mon, Aug 6, 2018 at 12:10 PM, James Feist
> <james.feist@linux.intel.com> wrote:
> > I've submitted a change to modify the sensor interface to remove scale,
> and
> > make the sensor value a double. The main reason for doing this is
> > simplification of the interface. In most usages, daemons pull the value,
> and
> > the scale, then immediately translate this value to a double. This could
> > easily be done once by the sensor producer instead of all daemons. The
> > counter example that was given was phosphor-fan-presence, but doing a
> quick
> > grep I can't find scale being used, so this might mean for a scaled fan
> you
> > have to factor that in to all configuration files, or scaled fans aren't
> > supported. The threshold interface is not usable independent from the
> value
> > interface, as the thresholds are affected by the same scale. Using a
> fixed
> > scale also won't work well for a logarithmic sensor, while floating point
> > would. Realistic precision should not be affected for any common sensor.
> We
> > also in the future may be interested in a daemon producing a threshold
> for a
> > sensor that another daemon owns. With the scale existing elsewhere, this
> > would not be trivial to map.
> >
> > Review for context: https://gerrit.openbmc-project.xyz/#/c/11739/
> >
> > This change is not ready to be submitted as is, but we would like to
> hear if
> > there are any major objections. If not, we would like to start an upgrade
> > path to support both interfaces until it is possible to make the switch.
> > Bmcweb already supports both. In most cases this is just pulling the
> value
> > using a visitor, and setting the scale to 0 if it does not exist. Max and
> > Min can also be used for IPMI scaling.
>
> I'm fine with this.  It saves everybody converting it to a double
> before using.  Further scaling, which can be necessary can be further
> done against the double.  For instance, with ipmi, to fit a value we
> sometimes scale again.
>
> >
> > Thanks,
> >
> > - James Feist
> >
> >
>

[-- Attachment #2: Type: text/html, Size: 2752 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Proposal to change sensor interface to use double values
  2018-08-06 19:10 Proposal to change sensor interface to use double values James Feist
  2018-08-06 20:08 ` Patrick Venture
@ 2018-08-06 20:31 ` Tanous, Ed
  1 sibling, 0 replies; 5+ messages in thread
From: Tanous, Ed @ 2018-08-06 20:31 UTC (permalink / raw)
  To: James Feist, OpenBMC Maillist

+1

The existing interfaces are error prone to implement to.  This change makes them easier to use, and clearer.

-Ed

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Proposal to change sensor interface to use double values
  2018-08-06 20:24   ` Emily Shaffer
@ 2018-08-06 20:38     ` Vernon Mauery
  0 siblings, 0 replies; 5+ messages in thread
From: Vernon Mauery @ 2018-08-06 20:38 UTC (permalink / raw)
  To: Emily Shaffer; +Cc: Patrick Venture, OpenBMC Maillist, James Feist

On 06-Aug-2018 01:24 PM, Emily Shaffer wrote:
>Same, I'm ok with this.
>
>On Mon, Aug 6, 2018 at 1:09 PM Patrick Venture <venture@google.com> wrote:
>
>> On Mon, Aug 6, 2018 at 12:10 PM, James Feist
>> <james.feist@linux.intel.com> wrote:
>> > I've submitted a change to modify the sensor interface to remove scale,
>> and
>> > make the sensor value a double. The main reason for doing this is
>> > simplification of the interface. In most usages, daemons pull the value,
>> and
>> > the scale, then immediately translate this value to a double. This could
>> > easily be done once by the sensor producer instead of all daemons. The
>> > counter example that was given was phosphor-fan-presence, but doing a
>> quick
>> > grep I can't find scale being used, so this might mean for a scaled fan
>> you
>> > have to factor that in to all configuration files, or scaled fans aren't
>> > supported. The threshold interface is not usable independent from the
>> value
>> > interface, as the thresholds are affected by the same scale. Using a
>> fixed
>> > scale also won't work well for a logarithmic sensor, while floating point
>> > would. Realistic precision should not be affected for any common sensor.
>> We
>> > also in the future may be interested in a daemon producing a threshold
>> for a
>> > sensor that another daemon owns. With the scale existing elsewhere, this
>> > would not be trivial to map.
>> >
>> > Review for context: https://gerrit.openbmc-project.xyz/#/c/11739/
>> >
>> > This change is not ready to be submitted as is, but we would like to
>> hear if
>> > there are any major objections. If not, we would like to start an upgrade
>> > path to support both interfaces until it is possible to make the switch.
>> > Bmcweb already supports both. In most cases this is just pulling the
>> value
>> > using a visitor, and setting the scale to 0 if it does not exist. Max and
>> > Min can also be used for IPMI scaling.
>>
>> I'm fine with this.  It saves everybody converting it to a double
>> before using.  Further scaling, which can be necessary can be further
>> done against the double.  For instance, with ipmi, to fit a value we
>> sometimes scale again.

+2

And for anyone complaining about a loss of precision, keep in mind we 
are reading low-precision ADCs and stuff like that anyway. The original 
design may have had a ton of precision (with a 64-bit value and a 64-bit 
exponent), but it was not being used to the point that demotion to a 
double will cause a loss of significant figures. This will maintain 
every bit of precision that was there from the hardware, but in a much 
more efficient manner.

--Vernon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-06 20:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-06 19:10 Proposal to change sensor interface to use double values James Feist
2018-08-06 20:08 ` Patrick Venture
2018-08-06 20:24   ` Emily Shaffer
2018-08-06 20:38     ` Vernon Mauery
2018-08-06 20:31 ` Tanous, Ed

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.