Skip to contentSkip to conversation

scaling issue

phosphor-pid-control Hank Liou (劉晉翰) 4 participants 21 messages Aug 21, 2019 – Sep 16, 2019

lore
Share & tools
lore
#0 lore raw

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these normal behaviors? Or do I miss something?

[1] https://github.com/openbmc/phosphor-pid-control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c

[2] https://github.com/openbmc/phosphor-pid-control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

#1 lore raw
Quoted 5 lines · Hank Liou (劉晉翰)

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these normal behaviors? Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your config. Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

Quoted 15 lines

[1] https://github.com/openbmc/phosphor-pid-control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c

[2] https://github.com/openbmc/phosphor-pid-control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

#2 lore raw

Hi Patrick,

Quoted 20 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 5 lines · Hank Liou (劉晉翰)

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these normal behaviors? Or do I miss something?

Quoted 4 lines

Are you using dbus configuration or json? If json, can you attach your config. Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit [1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the temp reading since my min and max are 0 [6].

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86
[3]

       {
            "name": "fan1",
            "type": "fan",
            "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
            "writePath": "/sys/class/hwmon/hwmon1/pwm1",
            "min": 0,
            "max": 255
        },
        {
            "name": "temp1",
            "type": "temp",
            "readPath": "/xyz/openbmc_project/sensors/temperature/temp1",
            "writePath": "",
            "min": 0,
            "max": 0
        }

[4] https://github.com/openbmc/phosphor-pid-control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassive.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#3 lore raw

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Any suggestion?

Thanks,
Hank

Quoted 119 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank Liou (劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 11 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Hank Liou (劉晉翰)
Quoted 8 lines
Quoted 5 lines

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 6 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your config. Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit
[1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the temp reading since my min and max are 0 [6].

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L86
[3]

      {
           "name": "fan1",
           "type": "fan",
           "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
           "writePath": "/sys/class/hwmon/hwmon1/pwm1",
           "min": 0,
           "max": 255
       },
       {
           "name": "temp1",
           "type": "temp",
           "readPath": "/xyz/openbmc_project/sensors/temperature/temp1",
           "writePath": "",
           "min": 0,
           "max": 0
       }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassi ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#4 lore raw
Quoted 4 lines · Hank Liou (劉晉翰)

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

So, iirc, the min/max in the json is only for sensors that write, and not read. Sorry, I'm ramping up on a new team and slower to catch up to emails.

Yeah, the min/max in the json are for basically converting a percentage value to a PWM values -- that's its initial goal. Temperature sensors typically don't have minimum and maximum values in the code's use-cases. I added James to this because they use the daemon for other cases -- where perhaps that'll make sense.

Quoted 125 lines

Any suggestion?

Thanks,
Hank

Quoted 119 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank Liou (劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 11 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Hank Liou (劉晉翰)
Quoted 8 lines
Quoted 5 lines

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 6 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your config. Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit
[1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the temp reading since my min and max are 0 [6].

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L86
[3]

      {
           "name": "fan1",
           "type": "fan",
           "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
           "writePath": "/sys/class/hwmon/hwmon1/pwm1",
           "min": 0,
           "max": 255
       },
       {
           "name": "temp1",
           "type": "temp",
           "readPath": "/xyz/openbmc_project/sensors/temperature/temp1",
           "writePath": "",
           "min": 0,
           "max": 0
       }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassi ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#5 lore raw
Quoted 10 lines · Patrick Venture
Quoted 4 lines · Hank Liou (劉晉翰)

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

So, iirc, the min/max in the json is only for sensors that write, and not read. Sorry, I'm ramping up on a new team and slower to catch up to emails.

Quoted 5 lines

Yeah, the min/max in the json are for basically converting a percentage value to a PWM values -- that's its initial goal. Temperature sensors typically don't have minimum and maximum values in the code's use-cases. I added James to this because they use the daemon for other cases -- where perhaps that'll make sense.

I believe the history of min/max being removed for passive sensors was here: https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-pid-control/+/23470

The only other use case we have for min / max is for fan RPM so that we can create a PID based on Tach %, so that the same PID can be reused on multiple platforms with different sized fans.

-James

Quoted 126 lines
Quoted 126 lines

Any suggestion?

Thanks,
Hank

Quoted 119 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank Liou (劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 11 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Hank Liou (劉晉翰)
Quoted 8 lines
Quoted 5 lines

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 6 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your config. Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit
[1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the temp reading since my min and max are 0 [6].

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L86
[3]

       {
            "name": "fan1",
            "type": "fan",
            "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
            "writePath": "/sys/class/hwmon/hwmon1/pwm1",
            "min": 0,
            "max": 255
        },
        {
            "name": "temp1",
            "type": "temp",
            "readPath": "/xyz/openbmc_project/sensors/temperature/temp1",
            "writePath": "",
            "min": 0,
            "max": 0
        }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassi ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#6 lore raw
Quoted 22 lines · James Feist
Quoted 10 lines · Patrick Venture
Quoted 4 lines · Hank Liou (劉晉翰)

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

So, iirc, the min/max in the json is only for sensors that write, and not read. Sorry, I'm ramping up on a new team and slower to catch up to emails.

Quoted 5 lines

Yeah, the min/max in the json are for basically converting a percentage value to a PWM values -- that's its initial goal. Temperature sensors typically don't have minimum and maximum values in the code's use-cases. I added James to this because they use the daemon for other cases -- where perhaps that'll make sense.

I believe the history of min/max being removed for passive sensors was here:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-pid-control/+/23470

Quoted 132 lines

The only other use case we have for min / max is for fan RPM so that we can create a PID based on Tach %, so that the same PID can be reused on multiple platforms with different sized fans.

-James

Quoted 126 lines
Quoted 126 lines

Any suggestion?

Thanks,
Hank

Quoted 119 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank Liou (劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 11 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Hank Liou (劉晉翰)
Quoted 8 lines
Quoted 5 lines

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 6 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your config. Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit
[1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the temp reading since my min and max are 0 [6].

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L86
[3]

       {
            "name": "fan1",
            "type": "fan",
            "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
            "writePath": "/sys/class/hwmon/hwmon1/pwm1",
            "min": 0,
            "max": 255
        },
        {
            "name": "temp1",
            "type": "temp",
            "readPath": "/xyz/openbmc_project/sensors/temperature/temp1",
            "writePath": "",
            "min": 0,
            "max": 0
        }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassi ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

Hank, do you need to use the min/max on the temperature sensors? Try your build with those entries deleted from the json file (they're optional).

James, I think I should add a warning and ignore those fields in that case. What do you think? (I honestly thought they were already ignored for temperature sensors -- have to look at the code to verify).

#7 lore raw
Quoted 156 lines · Patrick Venture
Quoted 22 lines · James Feist
Quoted 10 lines · Patrick Venture
Quoted 4 lines · Hank Liou (劉晉翰)

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

So, iirc, the min/max in the json is only for sensors that write, and not read. Sorry, I'm ramping up on a new team and slower to catch up to emails.

Quoted 5 lines

Yeah, the min/max in the json are for basically converting a percentage value to a PWM values -- that's its initial goal. Temperature sensors typically don't have minimum and maximum values in the code's use-cases. I added James to this because they use the daemon for other cases -- where perhaps that'll make sense.

I believe the history of min/max being removed for passive sensors was here:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-pid-control/+/23470

Quoted 132 lines

The only other use case we have for min / max is for fan RPM so that we can create a PID based on Tach %, so that the same PID can be reused on multiple platforms with different sized fans.

-James

Quoted 126 lines
Quoted 126 lines

Any suggestion?

Thanks,
Hank

Quoted 119 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank Liou (劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 11 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Hank Liou (劉晉翰)
Quoted 8 lines
Quoted 5 lines

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 6 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your config. Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit
[1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the temp reading since my min and max are 0 [6].

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L86
[3]

        {
             "name": "fan1",
             "type": "fan",
             "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
             "writePath": "/sys/class/hwmon/hwmon1/pwm1",
             "min": 0,
             "max": 255
         },
         {
             "name": "temp1",
             "type": "temp",
             "readPath": "/xyz/openbmc_project/sensors/temperature/temp1",
             "writePath": "",
             "min": 0,
             "max": 0
         }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassi ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

Quoted 8 lines

Hank, do you need to use the min/max on the temperature sensors? Try your build with those entries deleted from the json file (they're optional).

James, I think I should add a warning and ignore those fields in that case. What do you think? (I honestly thought they were already ignored for temperature sensors -- have to look at the code to verify).

I don't have much of an opinion here as I don't use the json configuration, but more warnings never hurt.

Quoted 1 line
#8 lore raw
In reply to Hank Liou (劉晉翰)

PTAL - https://gerrit.openbmc-project.xyz/24827 - this is merged, and the srcrev bump should propagate into openbmc/openbmc in a day or two.

Quoted 129 lines · Hank Liou (劉晉翰)

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Any suggestion?

Thanks,
Hank

Quoted 119 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank Liou (劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 11 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Hank Liou (劉晉翰)
Quoted 8 lines
Quoted 5 lines

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 6 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your config. Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit
[1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the temp reading since my min and max are 0 [6].

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L86
[3]

      {
           "name": "fan1",
           "type": "fan",
           "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
           "writePath": "/sys/class/hwmon/hwmon1/pwm1",
           "min": 0,
           "max": 255
       },
       {
           "name": "temp1",
           "type": "temp",
           "readPath": "/xyz/openbmc_project/sensors/temperature/temp1",
           "writePath": "",
           "min": 0,
           "max": 0
       }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassi ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#9 lore raw

Hi Patrick,

Since we use phosphor-sel-logger [1] at the same time, we do assign min and max of temp sensors to Dbus (max: 127, min: -128). So in the present case, our temp value will be divided by 0.255 (also due to exponent is -3 here). This will cause re-scaling problem. Therefore there should be an statement to distinguish sensor types. If it is "temp", then one assigns 0 to the min and max from Dbus.

[1] https://github.com/openbmc/phosphor-sel-logger/blob/3d300fca24b30864b3e9a4f5768cfe5e769458ae/include/sensorutils.hpp#L59<https://g>

Hank

________________________________
From: Patrick Venture <[email protected]>
Sent: Friday, August 30, 2019 1:47 AM
To: Hank Liou (劉晉翰)
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

PTAL - https://gerrit.openbmc-project.xyz/24827 - this is merged, and the srcrev bump should propagate into openbmc/openbmc in a day or two.

Quoted 129 lines · Hank Liou (劉晉翰)

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Any suggestion?

Thanks,
Hank

Quoted 119 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank Liou (劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 11 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Hank Liou (劉晉翰)
Quoted 8 lines
Quoted 5 lines

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 6 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your config. Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit
[1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the temp reading since my min and max are 0 [6].

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L86
[3]

      {
           "name": "fan1",
           "type": "fan",
           "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
           "writePath": "/sys/class/hwmon/hwmon1/pwm1",
           "min": 0,
           "max": 255
       },
       {
           "name": "temp1",
           "type": "temp",
           "readPath": "/xyz/openbmc_project/sensors/temperature/temp1",
           "writePath": "",
           "min": 0,
           "max": 0
       }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassi ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#10 lore raw

Hi Patrick,

Sorry for not clearly stating our problem. We have the following issue:

temp sensor gets 31(C) -> 31 / 0.255 = 121.57 -> pid uses 127.57 as input for temp sensor ->

stepwise fan table output 100 duty -> full speed fan

As a result, fan will be at full speed while temp is low. Before the commit fc2e803 [1], this won't happen. The root cause is that, before fc2e803, pid will use config min/max, which is 0 in our case. This would not trigger scaling function, namely scaleSensorReading, in util.cpp. However, after such commit, min/max would be non-zero (-128/127 from DBus). This will trigger scaling function.

[1] https://github.com/openbmc/phosphor-pid-control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c

Hank

________________________________
From: Hank Liou (劉晉翰)
Sent: Monday, September 2, 2019 4:52 PM
To: Patrick Venture
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Hi Patrick,

Since we use phosphor-sel-logger [1] at the same time, we do assign min and max of temp sensors to Dbus (max: 127, min: -128). So in the present case, our temp value will be divided by 0.255 (also due to exponent is -3 here). This will cause re-scaling problem. Therefore there should be an statement to distinguish sensor types. If it is "temp", then one assigns 0 to the min and max from Dbus.

[1] https://github.com/openbmc/phosphor-sel-logger/blob/3d300fca24b30864b3e9a4f5768cfe5e769458ae/include/sensorutils.hpp#L59<https://g>

Hank

________________________________
From: Patrick Venture <[email protected]>
Sent: Friday, August 30, 2019 1:47 AM
To: Hank Liou (劉晉翰)
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

PTAL - https://gerrit.openbmc-project.xyz/24827 - this is merged, and the srcrev bump should propagate into openbmc/openbmc in a day or two.

Quoted 129 lines · Hank Liou (劉晉翰)

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Any suggestion?

Thanks,
Hank

Quoted 119 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank Liou (劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 11 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Hank Liou (劉晉翰)
Quoted 8 lines
Quoted 5 lines

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 6 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your config. Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit
[1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the temp reading since my min and max are 0 [6].

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L86
[3]

      {
           "name": "fan1",
           "type": "fan",
           "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
           "writePath": "/sys/class/hwmon/hwmon1/pwm1",
           "min": 0,
           "max": 255
       },
       {
           "name": "temp1",
           "type": "temp",
           "readPath": "/xyz/openbmc_project/sensors/temperature/temp1",
           "writePath": "",
           "min": 0,
           "max": 0
       }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassi ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#11 lore raw
Quoted 10 lines · Hank Liou (劉晉翰)

Hi Patrick,

Sorry for not clearly stating our problem. We have the following issue:

temp sensor gets 31(C) -> 31 / 0.255 = 121.57 -> pid uses 127.57 as input for temp sensor ->

stepwise fan table output 100 duty -> full speed fan

Ok, so you're getting a dbus-based min/max value and you want to ignore it? In the json configuration, if you set the values to 0, they are set to the default (0), so there'd be no clean way to know to ignore dbus in this case, without adding a small check to only consider min/max from dbus when sensor is not temp/margin. Basically, only care about min/max on dbus if type is "fan"

If that's right, James do you have a cycle to look at this one-liner?

Quoted 171 lines

As a result, fan will be at full speed while temp is low. Before the commit fc2e803 [1], this won't happen. The root cause is that, before fc2e803, pid will use config min/max, which is 0 in our case. This would not trigger scaling function, namely scaleSensorReading, in util.cpp. However, after such commit, min/max would be non-zero (-128/127 from DBus). This will trigger scaling function.

[1] https://github.com/openbmc/phosphor-pid-control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c

Hank

________________________________
From: Hank Liou (劉晉翰)
Sent: Monday, September 2, 2019 4:52 PM
To: Patrick Venture
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Hi Patrick,

Since we use phosphor-sel-logger [1] at the same time, we do assign min and max of temp sensors to Dbus (max: 127, min: -128). So in the present case, our temp value will be divided by 0.255 (also due to exponent is -3 here). This will cause re-scaling problem. Therefore there should be an statement to distinguish sensor types. If it is "temp", then one assigns 0 to the min and max from Dbus.

[1] https://github.com/openbmc/phosphor-sel-logger/blob/3d300fca24b30864b3e9a4f5768cfe5e769458ae/include/sensorutils.hpp#L59

Hank

________________________________
From: Patrick Venture <[email protected]>
Sent: Friday, August 30, 2019 1:47 AM
To: Hank Liou (劉晉翰)
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

PTAL - https://gerrit.openbmc-project.xyz/24827 - this is merged, and the srcrev bump should propagate into openbmc/openbmc in a day or two.

Quoted 129 lines · Hank Liou (劉晉翰)

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Any suggestion?

Thanks,
Hank

Quoted 119 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank Liou (劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 11 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Hank Liou (劉晉翰)
Quoted 8 lines
Quoted 5 lines

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 6 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your config. Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit
[1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the temp reading since my min and max are 0 [6].

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L86
[3]

      {
           "name": "fan1",
           "type": "fan",
           "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
           "writePath": "/sys/class/hwmon/hwmon1/pwm1",
           "min": 0,
           "max": 255
       },
       {
           "name": "temp1",
           "type": "temp",
           "readPath": "/xyz/openbmc_project/sensors/temperature/temp1",
           "writePath": "",
           "min": 0,
           "max": 0
       }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassi ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#12 lore raw

Sorry about the regression issue, Hank.
IIRC I proposed to have separate groups of min/max values in D-Bus and json files since they convey different semantics.
At the end the min/max value was merged in the current way, because the assumption that min/max values in json is only used for fan pwm and nothing else -- which obviously is not true now.
Should we revisit the approach? Having something like 'fanPwmScale' as a separate config param is a cleaner approach in my opinion.

Quoted 223 lines · Patrick Venture
Quoted 8 lines · Hank Liou (劉晉翰)

Hi Patrick,

Sorry for not clearly stating our problem. We have the following issue:

temp sensor gets 31(C) -> 31 / 0.255 = 121.57 -> pid uses 127.57 as

input for temp sensor ->

Quoted 2 lines

stepwise fan table output 100 duty -> full speed fan

Ok, so you're getting a dbus-based min/max value and you want to ignore it? In the json configuration, if you set the values to 0, they are set to the default (0), so there'd be no clean way to know to ignore dbus in this case, without adding a small check to only consider min/max from dbus when sensor is not temp/margin. Basically, only care about min/max on dbus if type is "fan"

If that's right, James do you have a cycle to look at this one-liner?

Quoted 3 lines

As a result, fan will be at full speed while temp is low. Before the

commit fc2e803 [1], this won't happen. The root cause is that, before fc2e803, pid will use config min/max, which is 0 in our case. This would not trigger scaling function, namely scaleSensorReading, in util.cpp. However, after such commit, min/max would be non-zero (-128/127 from DBus). This will trigger scaling function.

Quoted 3 lines

[1]

https://github.com/openbmc/phosphor-pid-control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c

Quoted 13 lines

Hank

________________________________
From: Hank Liou (劉晉翰)
Sent: Monday, September 2, 2019 4:52 PM
To: Patrick Venture
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 4 lines

Hi Patrick,

Since we use phosphor-sel-logger [1] at the same time, we do assign min

and max of temp sensors to Dbus (max: 127, min: -128). So in the present case, our temp value will be divided by 0.255 (also due to exponent is -3 here). This will cause re-scaling problem. Therefore there should be an statement to distinguish sensor types. If it is "temp", then one assigns 0 to the min and max from Dbus.

Quoted 3 lines

[1]

https://github.com/openbmc/phosphor-sel-logger/blob/3d300fca24b30864b3e9a4f5768cfe5e769458ae/include/sensorutils.hpp#L59

Quoted 16 lines

Hank

________________________________
From: Patrick Venture <[email protected]>
Sent: Friday, August 30, 2019 1:47 AM
To: Hank Liou (劉晉翰)
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

PTAL - https://gerrit.openbmc-project.xyz/24827 - this is merged, and the srcrev bump should propagate into openbmc/openbmc in a day or two.

On Wed, Aug 28, 2019 at 11:00 PM Hank Liou (劉晉翰) <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Quoted 8 lines
Quoted 8 lines

Any suggestion?

Thanks,
Hank

Quoted 3 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank

Liou

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines

(劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 11 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Hank Liou (劉晉翰)
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan

input

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to be 0 (since the input value of fan is from an integer array [2]).

Are these

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

normal behaviors?

Quoted 3 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach

your config.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Since you're saying it was working and now isn't, I'm assuming

there's

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then

(before

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json

file (Json

Quoted 1 line
Quoted 1 line
Quoted 1 line

file [3]). However, after commit [1] the min and max values of config

would

Quoted 1 line
Quoted 1 line
Quoted 1 line

not be fed into the fan control process. The scaling issue is

originated from

Quoted 1 line
Quoted 1 line
Quoted 1 line

commit [4] with the aim to treat fan rpm as percentage. It seems that

commit

Quoted 1 line
Quoted 1 line
Quoted 1 line

[1] unexpectedly affects temp sensors in the sense that the temp is

the

Quoted 1 line
Quoted 1 line
Quoted 1 line

integer reading not percentage. Before commit [1], it would not

re-scale the

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

temp reading since my min and max are 0 [6].

There is another issue with commit [1]. Now the fan rpm would be

something

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the

fan input is 0

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L86
[3]

      {
           "name": "fan1",
           "type": "fan",
           "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
           "writePath": "/sys/class/hwmon/hwmon1/pwm1",
           "min": 0,
           "max": 255
       },
       {
           "name": "temp1",
           "type": "temp",
           "readPath":

"/xyz/openbmc_project/sensors/temperature/temp1",

Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
           "writePath": "",
           "min": 0,
           "max": 0
       }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassi ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

Signature · 2 lines
Regards,
Kun
#13 lore raw
Quoted 5 lines · Kun Yi

Sorry about the regression issue, Hank.
IIRC I proposed to have separate groups of min/max values in D-Bus and json files since they convey different semantics.
At the end the min/max value was merged in the current way, because the assumption that min/max values in json is only used for fan pwm and nothing else -- which obviously is not true now. Should we revisit the approach? Having something like 'fanPwmScale' as a separate config param is a cleaner approach in my opinion.

Kun, it was my understanding that the issue they're seeing is that they're reading min/max from dbus. But maybe I have if flipped.

I disagree that fanPwmScale is cleaner because it's now specific to fan pwm. In theory, using min/max could have some future purpose. Perhaps minWrite/maxWrite would be more ... separate. However, I think the issue seen is unrelated.

Quoted 201 lines · Patrick Venture
Quoted 13 lines · Hank Liou (劉晉翰)
Quoted 10 lines

Hi Patrick,

Sorry for not clearly stating our problem. We have the following issue:

temp sensor gets 31(C) -> 31 / 0.255 = 121.57 -> pid uses 127.57 as input for temp sensor ->

stepwise fan table output 100 duty -> full speed fan

Quoted 180 lines

Ok, so you're getting a dbus-based min/max value and you want to ignore it? In the json configuration, if you set the values to 0, they are set to the default (0), so there'd be no clean way to know to ignore dbus in this case, without adding a small check to only consider min/max from dbus when sensor is not temp/margin. Basically, only care about min/max on dbus if type is "fan"

If that's right, James do you have a cycle to look at this one-liner?

Quoted 171 lines

As a result, fan will be at full speed while temp is low. Before the commit fc2e803 [1], this won't happen. The root cause is that, before fc2e803, pid will use config min/max, which is 0 in our case. This would not trigger scaling function, namely scaleSensorReading, in util.cpp. However, after such commit, min/max would be non-zero (-128/127 from DBus). This will trigger scaling function.

[1] https://github.com/openbmc/phosphor-pid-control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c

Hank

________________________________
From: Hank Liou (劉晉翰)
Sent: Monday, September 2, 2019 4:52 PM
To: Patrick Venture
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Hi Patrick,

Since we use phosphor-sel-logger [1] at the same time, we do assign min and max of temp sensors to Dbus (max: 127, min: -128). So in the present case, our temp value will be divided by 0.255 (also due to exponent is -3 here). This will cause re-scaling problem. Therefore there should be an statement to distinguish sensor types. If it is "temp", then one assigns 0 to the min and max from Dbus.

[1] https://github.com/openbmc/phosphor-sel-logger/blob/3d300fca24b30864b3e9a4f5768cfe5e769458ae/include/sensorutils.hpp#L59

Hank

________________________________
From: Patrick Venture <[email protected]>
Sent: Friday, August 30, 2019 1:47 AM
To: Hank Liou (劉晉翰)
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

PTAL - https://gerrit.openbmc-project.xyz/24827 - this is merged, and the srcrev bump should propagate into openbmc/openbmc in a day or two.

Quoted 129 lines · Hank Liou (劉晉翰)

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Any suggestion?

Thanks,
Hank

Quoted 119 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank Liou (劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 11 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Hank Liou (劉晉翰)
Quoted 8 lines
Quoted 5 lines

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 6 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your config. Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit
[1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the temp reading since my min and max are 0 [6].

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L86
[3]

      {
           "name": "fan1",
           "type": "fan",
           "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
           "writePath": "/sys/class/hwmon/hwmon1/pwm1",
           "min": 0,
           "max": 255
       },
       {
           "name": "temp1",
           "type": "temp",
           "readPath": "/xyz/openbmc_project/sensors/temperature/temp1",
           "writePath": "",
           "min": 0,
           "max": 0
       }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassi ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

--
Regards,
Kun

#14 lore raw
In reply to Patrick Venture
Quoted 8 lines · Patrick Venture
Quoted 7 lines · Hank Liou (劉晉翰)

Hi Patrick,

Sorry for not clearly stating our problem. We have the following issue:

Quoted 6 lines
Quoted 3 lines

temp sensor gets 31(C) -> 31 / 0.255 = 121.57 -> pid uses 127.57 as input for temp sensor ->

stepwise fan table output 100 duty -> full speed fan

Ok, so you're getting a dbus-based min/max value and you want to ignore it?

What is providing the dbus-based min/max?

Quoted 5 lines

In the json configuration, if you set the values to 0,
they are set to the default (0), so there'd be no clean way to know to ignore dbus in this case, without adding a small check to only consider min/max from dbus when sensor is not temp/margin. Basically, only care about min/max on dbus if type is "fan"

Why is the dbus-based min/max even there if you don't plan on using it?

Quoted 174 lines

If that's right, James do you have a cycle to look at this one-liner?

Quoted 171 lines

As a result, fan will be at full speed while temp is low. Before the commit fc2e803 [1], this won't happen. The root cause is that, before fc2e803, pid will use config min/max, which is 0 in our case. This would not trigger scaling function, namely scaleSensorReading, in util.cpp. However, after such commit, min/max would be non-zero (-128/127 from DBus). This will trigger scaling function.

[1] https://github.com/openbmc/phosphor-pid-control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c

Hank

________________________________
From: Hank Liou (劉晉翰)
Sent: Monday, September 2, 2019 4:52 PM
To: Patrick Venture
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Hi Patrick,

Since we use phosphor-sel-logger [1] at the same time, we do assign min and max of temp sensors to Dbus (max: 127, min: -128). So in the present case, our temp value will be divided by 0.255 (also due to exponent is -3 here). This will cause re-scaling problem. Therefore there should be an statement to distinguish sensor types. If it is "temp", then one assigns 0 to the min and max from Dbus.

[1] https://github.com/openbmc/phosphor-sel-logger/blob/3d300fca24b30864b3e9a4f5768cfe5e769458ae/include/sensorutils.hpp#L59

Hank

________________________________
From: Patrick Venture <[email protected]>
Sent: Friday, August 30, 2019 1:47 AM
To: Hank Liou (劉晉翰)
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

PTAL - https://gerrit.openbmc-project.xyz/24827 - this is merged, and the srcrev bump should propagate into openbmc/openbmc in a day or two.

Quoted 129 lines · Hank Liou (劉晉翰)

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Any suggestion?

Thanks,
Hank

Quoted 119 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank Liou (劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 11 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Hank Liou (劉晉翰)
Quoted 8 lines
Quoted 5 lines

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 6 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your config. Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit
[1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the temp reading since my min and max are 0 [6].

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L86
[3]

       {
            "name": "fan1",
            "type": "fan",
            "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
            "writePath": "/sys/class/hwmon/hwmon1/pwm1",
            "min": 0,
            "max": 255
        },
        {
            "name": "temp1",
            "type": "temp",
            "readPath": "/xyz/openbmc_project/sensors/temperature/temp1",
            "writePath": "",
            "min": 0,
            "max": 0
        }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontrolle r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-
control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspassi ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#15 lore raw
Quoted 8 lines

-----Original Message-----
From: James Feist [mailto:[email protected]]
Sent: Tuesday, September 10, 2019 1:27 AM
To: Patrick Venture <[email protected]>; Hank Liou (劉晉翰) <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 17 lines
Quoted 1 line · Patrick Venture

On Thu, Sep 5, 2019 at 12:25 AM Hank Liou (劉晉翰)

Quoted 14 lines · <[email protected]> wrote:
Quoted 11 lines

Hi Patrick,

Sorry for not clearly stating our problem. We have the following issue:

temp sensor gets 31(C) -> 31 / 0.255 = 121.57 -> pid uses 127.57 as input for temp sensor ->

stepwise fan table output 100 duty -> full speed fan

Ok, so you're getting a dbus-based min/max value and you want to ignore it?

Yes, we want to ignore it.

Quoted 2 lines

What is providing the dbus-based min/max?

We use dbus min/max for phosphor-sel-logger utility. The dbus min/max is provided by config file of phosphor-hwmon. In our case, they are -128/127 respectively.

I have an observation:
I found that while fan readpath is of the form "/sys/...", the fan input would not be rescaled. The same is for other sensors since the input value would not enter rescaling function. However, in our case we don't have a sys path for some thermal sensors.

Quoted 7 lines
Quoted 6 lines

In the json configuration, if you set the values to 0, they are set to the default (0), so there'd be no clean way to know to ignore dbus in this case, without adding a small check to only consider min/max from dbus when sensor is not temp/margin. Basically, only care about min/max on dbus if type is "fan"

I agree with the option to add a check since the min/max is only for fan now.

Quoted 204 lines

Why is the dbus-based min/max even there if you don't plan on using it?

Quoted 6 lines

If that's right, James do you have a cycle to look at this one-liner?

Quoted 3 lines

As a result, fan will be at full speed while temp is low. Before the commit

fc2e803 [1], this won't happen. The root cause is that, before fc2e803, pid will use config min/max, which is 0 in our case. This would not trigger scaling function, namely scaleSensorReading, in util.cpp. However, after such commit, min/max would be non-zero (-128/127 from DBus). This will trigger scaling function.

Quoted 4 lines
Quoted 4 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d9256

Quoted 14 lines
Quoted 14 lines

944e18c7c878a441606b1f121c

Hank

________________________________
From: Hank Liou (劉晉翰)
Sent: Monday, September 2, 2019 4:52 PM
To: Patrick Venture
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 4 lines
Quoted 4 lines

Hi Patrick,

Since we use phosphor-sel-logger [1] at the same time, we do assign min

and max of temp sensors to Dbus (max: 127, min: -128). So in the present case, our temp value will be divided by 0.255 (also due to exponent is -3 here). This will cause re-scaling problem. Therefore there should be an statement to distinguish sensor types. If it is "temp", then one assigns 0 to the min and max from Dbus.

Quoted 4 lines
Quoted 4 lines

[1]
https://github.com/openbmc/phosphor-sel-

logger/blob/3d300fca24b30864b

Quoted 17 lines
Quoted 17 lines

3e9a4f5768cfe5e769458ae/include/sensorutils.hpp#L59

Hank

________________________________
From: Patrick Venture <[email protected]>
Sent: Friday, August 30, 2019 1:47 AM
To: Hank Liou (劉晉翰)
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

PTAL - https://gerrit.openbmc-project.xyz/24827 - this is merged, and the srcrev bump should propagate into openbmc/openbmc in a day or two.

On Wed, Aug 28, 2019 at 11:00 PM Hank Liou (劉晉翰)

Quoted 39 lines · <[email protected]> wrote:
Quoted 39 lines
Quoted 39 lines

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Any suggestion?

Thanks,
Hank

Quoted 29 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank bounces+Liou
(劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 16 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 6 lines · Hank Liou (劉晉翰)

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 3 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your

config.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit [1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the

temp reading since my min and max are 0 [6].

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontro

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

lle
r.cpp#L86
[3]

       {
            "name": "fan1",
            "type": "fan",
            "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
            "writePath": "/sys/class/hwmon/hwmon1/pwm1",
            "min": 0,
            "max": 255
        },
        {
            "name": "temp1",
            "type": "temp",
            "readPath":

"/xyz/openbmc_project/sensors/temperature/temp1",

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
            "writePath": "",
            "min": 0,
            "max": 0
        }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontro

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

lle
r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspass

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

i
ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#16 lore raw
Quoted 22 lines · Hank Liou (劉晉翰)
Quoted 22 lines

-----Original Message-----
From: James Feist [mailto:[email protected]]
Sent: Tuesday, September 10, 2019 1:27 AM
To: Patrick Venture <[email protected]>; Hank Liou (劉晉翰) <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Patrick Venture

On Thu, Sep 5, 2019 at 12:25 AM Hank Liou (劉晉翰)

Quoted 10 lines · <[email protected]> wrote:
Quoted 10 lines

Hi Patrick,

Sorry for not clearly stating our problem. We have the following issue:

temp sensor gets 31(C) -> 31 / 0.255 = 121.57 -> pid uses 127.57 as input for temp sensor ->

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

stepwise fan table output 100 duty -> full speed fan

Ok, so you're getting a dbus-based min/max value and you want to ignore it?

Yes, we want to ignore it.

It looks like the sensor value scaling should be ignored for non-fans.
Per https://github.com/openbmc/phosphor-pid-control/commit/75eb769d351434547899186f73ff70ae00d7934a,
this change was only meant to deal with a fan case where the goal
looks like it was to treat the fan values as percentages on reading
the sensors, and not only on writing them by leveraging the min/max
json sometimes?

I can change the dbuspassive constructor to set the values back to their input values (ignoring dbus) if the type is not "fan", but I'm not sure that makes sense because the real use-case isn't clear to me, and I know the scaling from dbus is gone:
https://github.com/openbmc/phosphor-pid-control/search?utf8=%E2%9C%93&q=inheritValueFromDbus&type=

I'll submit the patch real quick, but I'm not sure it's the right long-term fix. I'd like to clean this up if possible so that we don't leverage "unused" features of a configuration and instead explicitly use them (or not).

Quoted 225 lines
Quoted 3 lines

What is providing the dbus-based min/max?

We use dbus min/max for phosphor-sel-logger utility. The dbus min/max is provided by config file of phosphor-hwmon. In our case, they are -128/127 respectively.

I have an observation:
I found that while fan readpath is of the form "/sys/...", the fan input would not be rescaled. The same is for other sensors since the input value would not enter rescaling function. However, in our case we don't have a sys path for some thermal sensors.

Quoted 7 lines
Quoted 6 lines

In the json configuration, if you set the values to 0, they are set to the default (0), so there'd be no clean way to know to ignore dbus in this case, without adding a small check to only consider min/max from dbus when sensor is not temp/margin. Basically, only care about min/max on dbus if type is "fan"

I agree with the option to add a check since the min/max is only for fan now.

Quoted 204 lines

Why is the dbus-based min/max even there if you don't plan on using it?

Quoted 6 lines

If that's right, James do you have a cycle to look at this one-liner?

Quoted 3 lines

As a result, fan will be at full speed while temp is low. Before the commit

fc2e803 [1], this won't happen. The root cause is that, before fc2e803, pid will use config min/max, which is 0 in our case. This would not trigger scaling function, namely scaleSensorReading, in util.cpp. However, after such commit, min/max would be non-zero (-128/127 from DBus). This will trigger scaling function.

Quoted 4 lines
Quoted 4 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d9256

Quoted 14 lines
Quoted 14 lines

944e18c7c878a441606b1f121c

Hank

________________________________
From: Hank Liou (劉晉翰)
Sent: Monday, September 2, 2019 4:52 PM
To: Patrick Venture
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 4 lines
Quoted 4 lines

Hi Patrick,

Since we use phosphor-sel-logger [1] at the same time, we do assign min

and max of temp sensors to Dbus (max: 127, min: -128). So in the present case, our temp value will be divided by 0.255 (also due to exponent is -3 here). This will cause re-scaling problem. Therefore there should be an statement to distinguish sensor types. If it is "temp", then one assigns 0 to the min and max from Dbus.

Quoted 4 lines
Quoted 4 lines

[1]
https://github.com/openbmc/phosphor-sel-

logger/blob/3d300fca24b30864b

Quoted 17 lines
Quoted 17 lines

3e9a4f5768cfe5e769458ae/include/sensorutils.hpp#L59

Hank

________________________________
From: Patrick Venture <[email protected]>
Sent: Friday, August 30, 2019 1:47 AM
To: Hank Liou (劉晉翰)
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

PTAL - https://gerrit.openbmc-project.xyz/24827 - this is merged, and the srcrev bump should propagate into openbmc/openbmc in a day or two.

On Wed, Aug 28, 2019 at 11:00 PM Hank Liou (劉晉翰)

Quoted 39 lines · <[email protected]> wrote:
Quoted 39 lines
Quoted 39 lines

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Any suggestion?

Thanks,
Hank

Quoted 29 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank bounces+Liou
(劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 16 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 6 lines · Hank Liou (劉晉翰)

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 3 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your

config.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit [1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the

temp reading since my min and max are 0 [6].

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontro

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

lle
r.cpp#L86
[3]

       {
            "name": "fan1",
            "type": "fan",
            "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
            "writePath": "/sys/class/hwmon/hwmon1/pwm1",
            "min": 0,
            "max": 255
        },
        {
            "name": "temp1",
            "type": "temp",
            "readPath":

"/xyz/openbmc_project/sensors/temperature/temp1",

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
            "writePath": "",
            "min": 0,
            "max": 0
        }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontro

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

lle
r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspass

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

i
ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#17 lore raw
Quoted 44 lines · Patrick Venture
Quoted 22 lines · Hank Liou (劉晉翰)
Quoted 22 lines

-----Original Message-----
From: James Feist [mailto:[email protected]]
Sent: Tuesday, September 10, 2019 1:27 AM
To: Patrick Venture <[email protected]>; Hank Liou (劉晉翰) <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Patrick Venture

On Thu, Sep 5, 2019 at 12:25 AM Hank Liou (劉晉翰)

Quoted 10 lines · <[email protected]> wrote:
Quoted 10 lines

Hi Patrick,

Sorry for not clearly stating our problem. We have the following issue:

temp sensor gets 31(C) -> 31 / 0.255 = 121.57 -> pid uses 127.57 as input for temp sensor ->

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

stepwise fan table output 100 duty -> full speed fan

Ok, so you're getting a dbus-based min/max value and you want to ignore it?

Yes, we want to ignore it.

It looks like the sensor value scaling should be ignored for non-fans.
Per https://github.com/openbmc/phosphor-pid-control/commit/75eb769d351434547899186f73ff70ae00d7934a,
this change was only meant to deal with a fan case where the goal
looks like it was to treat the fan values as percentages on reading
the sensors, and not only on writing them by leveraging the min/max
json sometimes?

I can change the dbuspassive constructor to set the values back to their input values (ignoring dbus) if the type is not "fan", but I'm not sure that makes sense because the real use-case isn't clear to me, and I know the scaling from dbus is gone:
https://github.com/openbmc/phosphor-pid-control/search?utf8=%E2%9C%93&q=inheritValueFromDbus&type=

Quoted 4 lines

I'll submit the patch real quick, but I'm not sure it's the right long-term fix. I'd like to clean this up if possible so that we don't leverage "unused" features of a configuration and instead explicitly use them (or not).

This patch should address what you're seeing. Overall, I think there should be a larger change addressing the goal of the original change.

https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-pid-control/+/25070

Quoted 226 lines
Quoted 226 lines
Quoted 4 lines

What is providing the dbus-based min/max?

We use dbus min/max for phosphor-sel-logger utility. The dbus min/max is provided by config file of phosphor-hwmon. In our case, they are -128/127 respectively.

I have an observation:
I found that while fan readpath is of the form "/sys/...", the fan input would not be rescaled. The same is for other sensors since the input value would not enter rescaling function. However, in our case we don't have a sys path for some thermal sensors.

Quoted 7 lines
Quoted 6 lines

In the json configuration, if you set the values to 0, they are set to the default (0), so there'd be no clean way to know to ignore dbus in this case, without adding a small check to only consider min/max from dbus when sensor is not temp/margin. Basically, only care about min/max on dbus if type is "fan"

I agree with the option to add a check since the min/max is only for fan now.

Quoted 204 lines

Why is the dbus-based min/max even there if you don't plan on using it?

Quoted 6 lines

If that's right, James do you have a cycle to look at this one-liner?

Quoted 3 lines

As a result, fan will be at full speed while temp is low. Before the commit

fc2e803 [1], this won't happen. The root cause is that, before fc2e803, pid will use config min/max, which is 0 in our case. This would not trigger scaling function, namely scaleSensorReading, in util.cpp. However, after such commit, min/max would be non-zero (-128/127 from DBus). This will trigger scaling function.

Quoted 4 lines
Quoted 4 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d9256

Quoted 14 lines
Quoted 14 lines

944e18c7c878a441606b1f121c

Hank

________________________________
From: Hank Liou (劉晉翰)
Sent: Monday, September 2, 2019 4:52 PM
To: Patrick Venture
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 4 lines
Quoted 4 lines

Hi Patrick,

Since we use phosphor-sel-logger [1] at the same time, we do assign min

and max of temp sensors to Dbus (max: 127, min: -128). So in the present case, our temp value will be divided by 0.255 (also due to exponent is -3 here). This will cause re-scaling problem. Therefore there should be an statement to distinguish sensor types. If it is "temp", then one assigns 0 to the min and max from Dbus.

Quoted 4 lines
Quoted 4 lines

[1]
https://github.com/openbmc/phosphor-sel-

logger/blob/3d300fca24b30864b

Quoted 17 lines
Quoted 17 lines

3e9a4f5768cfe5e769458ae/include/sensorutils.hpp#L59

Hank

________________________________
From: Patrick Venture <[email protected]>
Sent: Friday, August 30, 2019 1:47 AM
To: Hank Liou (劉晉翰)
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

PTAL - https://gerrit.openbmc-project.xyz/24827 - this is merged, and the srcrev bump should propagate into openbmc/openbmc in a day or two.

On Wed, Aug 28, 2019 at 11:00 PM Hank Liou (劉晉翰)

Quoted 39 lines · <[email protected]> wrote:
Quoted 39 lines
Quoted 39 lines

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Any suggestion?

Thanks,
Hank

Quoted 29 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank bounces+Liou
(劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 16 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 6 lines · Hank Liou (劉晉翰)

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 3 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your

config.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit [1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the

temp reading since my min and max are 0 [6].

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontro

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

lle
r.cpp#L86
[3]

       {
            "name": "fan1",
            "type": "fan",
            "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
            "writePath": "/sys/class/hwmon/hwmon1/pwm1",
            "min": 0,
            "max": 255
        },
        {
            "name": "temp1",
            "type": "temp",
            "readPath":

"/xyz/openbmc_project/sensors/temperature/temp1",

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
            "writePath": "",
            "min": 0,
            "max": 0
        }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontro

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

lle
r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspass

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

i
ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#18 lore raw
Quoted 51 lines · Patrick Venture
Quoted 44 lines · Patrick Venture
Quoted 22 lines · Hank Liou (劉晉翰)
Quoted 22 lines

-----Original Message-----
From: James Feist [mailto:[email protected]]
Sent: Tuesday, September 10, 2019 1:27 AM
To: Patrick Venture <[email protected]>; Hank Liou (劉晉翰) <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 1 line · Patrick Venture

On Thu, Sep 5, 2019 at 12:25 AM Hank Liou (劉晉翰)

Quoted 10 lines · <[email protected]> wrote:
Quoted 10 lines

Hi Patrick,

Sorry for not clearly stating our problem. We have the following issue:

temp sensor gets 31(C) -> 31 / 0.255 = 121.57 -> pid uses 127.57 as input for temp sensor ->

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

stepwise fan table output 100 duty -> full speed fan

Ok, so you're getting a dbus-based min/max value and you want to ignore it?

Yes, we want to ignore it.

It looks like the sensor value scaling should be ignored for non-fans.
Per https://github.com/openbmc/phosphor-pid-control/commit/75eb769d351434547899186f73ff70ae00d7934a,
this change was only meant to deal with a fan case where the goal
looks like it was to treat the fan values as percentages on reading
the sensors, and not only on writing them by leveraging the min/max
json sometimes?

I can change the dbuspassive constructor to set the values back to their input values (ignoring dbus) if the type is not "fan", but I'm not sure that makes sense because the real use-case isn't clear to me, and I know the scaling from dbus is gone:
https://github.com/openbmc/phosphor-pid-control/search?utf8=%E2%9C%93&q=inheritValueFromDbus&type=

Quoted 4 lines

I'll submit the patch real quick, but I'm not sure it's the right long-term fix. I'd like to clean this up if possible so that we don't leverage "unused" features of a configuration and instead explicitly use them (or not).

Quoted 4 lines

This patch should address what you're seeing. Overall, I think there should be a larger change addressing the goal of the original change.

https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-pid-control/+/25070

I decided to take on the larger change because chances are we might hit it some other way:
https://gerrit.openbmc-project.xyz/c/25072/

This lets you specify a json configuration option that will ignore the MinValue/MaxValue properties on dbus.

Quoted 227 lines
Quoted 227 lines
Quoted 227 lines
Quoted 5 lines

What is providing the dbus-based min/max?

We use dbus min/max for phosphor-sel-logger utility. The dbus min/max is provided by config file of phosphor-hwmon. In our case, they are -128/127 respectively.

I have an observation:
I found that while fan readpath is of the form "/sys/...", the fan input would not be rescaled. The same is for other sensors since the input value would not enter rescaling function. However, in our case we don't have a sys path for some thermal sensors.

Quoted 7 lines
Quoted 6 lines

In the json configuration, if you set the values to 0, they are set to the default (0), so there'd be no clean way to know to ignore dbus in this case, without adding a small check to only consider min/max from dbus when sensor is not temp/margin. Basically, only care about min/max on dbus if type is "fan"

I agree with the option to add a check since the min/max is only for fan now.

Quoted 204 lines

Why is the dbus-based min/max even there if you don't plan on using it?

Quoted 6 lines

If that's right, James do you have a cycle to look at this one-liner?

Quoted 3 lines

As a result, fan will be at full speed while temp is low. Before the commit

fc2e803 [1], this won't happen. The root cause is that, before fc2e803, pid will use config min/max, which is 0 in our case. This would not trigger scaling function, namely scaleSensorReading, in util.cpp. However, after such commit, min/max would be non-zero (-128/127 from DBus). This will trigger scaling function.

Quoted 4 lines
Quoted 4 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d9256

Quoted 14 lines
Quoted 14 lines

944e18c7c878a441606b1f121c

Hank

________________________________
From: Hank Liou (劉晉翰)
Sent: Monday, September 2, 2019 4:52 PM
To: Patrick Venture
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 4 lines
Quoted 4 lines

Hi Patrick,

Since we use phosphor-sel-logger [1] at the same time, we do assign min

and max of temp sensors to Dbus (max: 127, min: -128). So in the present case, our temp value will be divided by 0.255 (also due to exponent is -3 here). This will cause re-scaling problem. Therefore there should be an statement to distinguish sensor types. If it is "temp", then one assigns 0 to the min and max from Dbus.

Quoted 4 lines
Quoted 4 lines

[1]
https://github.com/openbmc/phosphor-sel-

logger/blob/3d300fca24b30864b

Quoted 17 lines
Quoted 17 lines

3e9a4f5768cfe5e769458ae/include/sensorutils.hpp#L59

Hank

________________________________
From: Patrick Venture <[email protected]>
Sent: Friday, August 30, 2019 1:47 AM
To: Hank Liou (劉晉翰)
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

PTAL - https://gerrit.openbmc-project.xyz/24827 - this is merged, and the srcrev bump should propagate into openbmc/openbmc in a day or two.

On Wed, Aug 28, 2019 at 11:00 PM Hank Liou (劉晉翰)

Quoted 39 lines · <[email protected]> wrote:
Quoted 39 lines
Quoted 39 lines

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Any suggestion?

Thanks,
Hank

Quoted 29 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf Of Hank bounces+Liou
(劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Hi Patrick,

Quoted 16 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 6 lines · Hank Liou (劉晉翰)

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

normal behaviors?

Quoted 3 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your

config.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

info->min != conf::inheritValueFromDbus (in dbus/dbuspassive.cpp)

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan control process. The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit [1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the

temp reading since my min and max are 0 [6].

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see [5]). Hence the fan input is 0 not percentage. Is there something wrong?

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontro

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

lle
r.cpp#L86
[3]

       {
            "name": "fan1",
            "type": "fan",
            "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
            "writePath": "/sys/class/hwmon/hwmon1/pwm1",
            "min": 0,
            "max": 255
        },
        {
            "name": "temp1",
            "type": "temp",
            "readPath":

"/xyz/openbmc_project/sensors/temperature/temp1",

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
            "writePath": "",
            "min": 0,
            "max": 0
        }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancontro

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

lle
r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspass

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

i
ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#19 lore raw

Hi Patrick,

Thanks for your help. This change does solve the issue.

Hank

Quoted 328 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, September 11, 2019 1:52 AM
To: Hank Liou (劉晉翰) <[email protected]>
Cc: James Feist <[email protected]>; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 2 lines · Patrick Venture

On Tue, Sep 10, 2019 at 7:39 AM Patrick Venture <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines

On Tue, Sep 10, 2019 at 1:02 AM Hank Liou (劉晉翰)

Quoted 9 lines · <[email protected]> wrote:
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: James Feist [mailto:[email protected]]
Sent: Tuesday, September 10, 2019 1:27 AM
To: Patrick Venture <[email protected]>; Hank Liou (劉晉翰) <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Patrick Venture
Quoted 1 line

On Thu, Sep 5, 2019 at 12:25 AM Hank Liou (劉晉翰)

Quoted 5 lines · <[email protected]> wrote:
Quoted 5 lines

Hi Patrick,

Sorry for not clearly stating our problem. We have the following

issue:

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

temp sensor gets 31(C) -> 31 / 0.255 = 121.57 -> pid uses 127.57 as input for temp sensor ->

stepwise fan table output 100 duty -> full speed fan

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

Ok, so you're getting a dbus-based min/max value and you want to ignore it?

Yes, we want to ignore it.

It looks like the sensor value scaling should be ignored for non-fans. Per
https://github.com/openbmc/phosphor-pid-

control/commit/75eb769d35143

Quoted 10 lines
Quoted 10 lines

4547899186f73ff70ae00d7934a, this change was only meant to deal with a fan case where the goal looks like it was to treat the fan values as percentages on reading the sensors, and not only on writing them by leveraging the min/max json sometimes?

I can change the dbuspassive constructor to set the values back to their input values (ignoring dbus) if the type is not "fan", but I'm not sure that makes sense because the real use-case isn't clear to me, and I know the scaling from dbus is gone:
https://github.com/openbmc/phosphor-pid-

control/search?utf8=%E2%9C%9

Quoted 7 lines
Quoted 6 lines

3&q=inheritValueFromDbus&type=

I'll submit the patch real quick, but I'm not sure it's the right long-term fix. I'd like to clean this up if possible so that we don't leverage "unused" features of a configuration and instead explicitly use them (or not).

Quoted 5 lines

This patch should address what you're seeing. Overall, I think there should be a larger change addressing the goal of the original change.

https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-pid-control/+/25
070

I decided to take on the larger change because chances are we might hit it some other way:
https://gerrit.openbmc-project.xyz/c/25072/

This lets you specify a json configuration option that will ignore the MinValue/MaxValue properties on dbus.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

What is providing the dbus-based min/max?

We use dbus min/max for phosphor-sel-logger utility. The dbus min/max

is provided by config file of phosphor-hwmon.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

In our case, they are -128/127 respectively.

I have an observation:
I found that while fan readpath is of the form "/sys/...", the fan input

would not be rescaled. The same is for other sensors since the input value would not enter rescaling function.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

However, in our case we don't have a sys path for some thermal sensors.

Quoted 7 lines
Quoted 6 lines

In the json configuration, if you set the values to 0, they are set to the default (0), so there'd be no clean way to know to ignore dbus in this case, without adding a small check to only consider min/max from dbus when sensor is not temp/margin. Basically, only care about min/max on dbus if type is "fan"

I agree with the option to add a check since the min/max is only for fan

now.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Why is the dbus-based min/max even there if you don't plan on using it?

Quoted 5 lines

If that's right, James do you have a cycle to look at this one-liner?

Quoted 2 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

As a result, fan will be at full speed while temp is low. Before the commit

fc2e803 [1], this won't happen. The root cause is that, before fc2e803, pid will use config min/max, which is 0 in our case. This would not trigger scaling function, namely scaleSensorReading, in util.cpp. However, after such commit, min/max would be non-zero (-128/127 from DBus). This will trigger

scaling function.

Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
Quoted 4 lines
Quoted 4 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d9256

Quoted 14 lines
Quoted 14 lines

944e18c7c878a441606b1f121c

Hank

________________________________
From: Hank Liou (劉晉翰)
Sent: Monday, September 2, 2019 4:52 PM
To: Patrick Venture
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 5 lines
Quoted 5 lines

Hi Patrick,

Since we use phosphor-sel-logger [1] at the same time, we do assign min

and max of temp sensors to Dbus (max: 127, min: -128). So in the present case, our temp value will be divided by 0.255 (also due to exponent is -3 here). This will cause re-scaling problem. Therefore there should be an statement to distinguish sensor types. If it is "temp", then one assigns 0 to the min and max from Dbus.

Quoted 4 lines
Quoted 4 lines

[1]
https://github.com/openbmc/phosphor-sel-

logger/blob/3d300fca24b30864b

Quoted 13 lines
Quoted 13 lines

3e9a4f5768cfe5e769458ae/include/sensorutils.hpp#L59

Hank

________________________________
From: Patrick Venture <[email protected]>
Sent: Friday, August 30, 2019 1:47 AM
To: Hank Liou (劉晉翰)
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

PTAL - https://gerrit.openbmc-project.xyz/24827 - this is merged, and the srcrev bump should propagate into

openbmc/openbmc in a day or two.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 2 lines
Quoted 2 lines

On Wed, Aug 28, 2019 at 11:00 PM Hank Liou (劉晉翰)

Quoted 21 lines · <[email protected]> wrote:
Quoted 21 lines
Quoted 21 lines

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Any suggestion?

Thanks,
Hank

Quoted 11 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf bounces+Of Hank Liou
(劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Hi Patrick,

Quoted 4 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James

Feist

Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

<[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 6 lines · Hank Liou (劉晉翰)

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

normal behaviors?

Quoted 4 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your

config.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

info->min != conf::inheritValueFromDbus (in
info->dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan

control process.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit [1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the

temp reading since my min and max are 0 [6].

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see

[5]).

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Hence the fan input is 0 not percentage. Is there something

wrong?

Quoted 70 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancont

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

ro

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

lle
r.cpp#L86
[3]

       {
            "name": "fan1",
            "type": "fan",
            "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
            "writePath": "/sys/class/hwmon/hwmon1/pwm1",
            "min": 0,
            "max": 255
        },
        {
            "name": "temp1",
            "type": "temp",
            "readPath":

"/xyz/openbmc_project/sensors/temperature/temp1",

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
            "writePath": "",
            "min": 0,
            "max": 0
        }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancont

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

ro

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

lle
r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspa

Quoted 29 lines
Quoted 29 lines
Quoted 29 lines

ss

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

i
ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank

#20 lore raw
Quoted 4 lines · Hank Liou (劉晉翰)

Hi Patrick,

Thanks for your help. This change does solve the issue.

No problem! I enjoy it when someone hits an edge case or a situation not yet considered. We don't have nearly enough variety of configurations to really test quirks and unit-testing only covers so much.

I saw your review requesting the configuration change, and +1'd it. Presumably you're well on your way.

Thanks for your patience in this back-and-forth to resolve the issue.

Quoted 331 lines

Hank

Quoted 328 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, September 11, 2019 1:52 AM
To: Hank Liou (劉晉翰) <[email protected]>
Cc: James Feist <[email protected]>; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 2 lines · Patrick Venture

On Tue, Sep 10, 2019 at 7:39 AM Patrick Venture <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines

On Tue, Sep 10, 2019 at 1:02 AM Hank Liou (劉晉翰)

Quoted 9 lines · <[email protected]> wrote:
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: James Feist [mailto:[email protected]]
Sent: Tuesday, September 10, 2019 1:27 AM
To: Patrick Venture <[email protected]>; Hank Liou (劉晉翰) <[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Patrick Venture
Quoted 1 line

On Thu, Sep 5, 2019 at 12:25 AM Hank Liou (劉晉翰)

Quoted 5 lines · <[email protected]> wrote:
Quoted 5 lines

Hi Patrick,

Sorry for not clearly stating our problem. We have the following

issue:

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

temp sensor gets 31(C) -> 31 / 0.255 = 121.57 -> pid uses 127.57 as input for temp sensor ->

stepwise fan table output 100 duty -> full speed fan

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

Ok, so you're getting a dbus-based min/max value and you want to ignore it?

Yes, we want to ignore it.

It looks like the sensor value scaling should be ignored for non-fans. Per
https://github.com/openbmc/phosphor-pid-

control/commit/75eb769d35143

Quoted 10 lines
Quoted 10 lines

4547899186f73ff70ae00d7934a, this change was only meant to deal with a fan case where the goal looks like it was to treat the fan values as percentages on reading the sensors, and not only on writing them by leveraging the min/max json sometimes?

I can change the dbuspassive constructor to set the values back to their input values (ignoring dbus) if the type is not "fan", but I'm not sure that makes sense because the real use-case isn't clear to me, and I know the scaling from dbus is gone:
https://github.com/openbmc/phosphor-pid-

control/search?utf8=%E2%9C%9

Quoted 7 lines
Quoted 6 lines

3&q=inheritValueFromDbus&type=

I'll submit the patch real quick, but I'm not sure it's the right long-term fix. I'd like to clean this up if possible so that we don't leverage "unused" features of a configuration and instead explicitly use them (or not).

Quoted 5 lines

This patch should address what you're seeing. Overall, I think there should be a larger change addressing the goal of the original change.

https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-pid-control/+/25
070

I decided to take on the larger change because chances are we might hit it some other way:
https://gerrit.openbmc-project.xyz/c/25072/

This lets you specify a json configuration option that will ignore the MinValue/MaxValue properties on dbus.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

What is providing the dbus-based min/max?

We use dbus min/max for phosphor-sel-logger utility. The dbus min/max

is provided by config file of phosphor-hwmon.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

In our case, they are -128/127 respectively.

I have an observation:
I found that while fan readpath is of the form "/sys/...", the fan input

would not be rescaled. The same is for other sensors since the input value would not enter rescaling function.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

However, in our case we don't have a sys path for some thermal sensors.

Quoted 7 lines
Quoted 6 lines

In the json configuration, if you set the values to 0, they are set to the default (0), so there'd be no clean way to know to ignore dbus in this case, without adding a small check to only consider min/max from dbus when sensor is not temp/margin. Basically, only care about min/max on dbus if type is "fan"

I agree with the option to add a check since the min/max is only for fan

now.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Why is the dbus-based min/max even there if you don't plan on using it?

Quoted 5 lines

If that's right, James do you have a cycle to look at this one-liner?

Quoted 2 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

As a result, fan will be at full speed while temp is low. Before the commit

fc2e803 [1], this won't happen. The root cause is that, before fc2e803, pid will use config min/max, which is 0 in our case. This would not trigger scaling function, namely scaleSensorReading, in util.cpp. However, after such commit, min/max would be non-zero (-128/127 from DBus). This will trigger

scaling function.

Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
Quoted 4 lines
Quoted 4 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d9256

Quoted 14 lines
Quoted 14 lines

944e18c7c878a441606b1f121c

Hank

________________________________
From: Hank Liou (劉晉翰)
Sent: Monday, September 2, 2019 4:52 PM
To: Patrick Venture
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 5 lines
Quoted 5 lines

Hi Patrick,

Since we use phosphor-sel-logger [1] at the same time, we do assign min

and max of temp sensors to Dbus (max: 127, min: -128). So in the present case, our temp value will be divided by 0.255 (also due to exponent is -3 here). This will cause re-scaling problem. Therefore there should be an statement to distinguish sensor types. If it is "temp", then one assigns 0 to the min and max from Dbus.

Quoted 4 lines
Quoted 4 lines

[1]
https://github.com/openbmc/phosphor-sel-

logger/blob/3d300fca24b30864b

Quoted 13 lines
Quoted 13 lines

3e9a4f5768cfe5e769458ae/include/sensorutils.hpp#L59

Hank

________________________________
From: Patrick Venture <[email protected]>
Sent: Friday, August 30, 2019 1:47 AM
To: Hank Liou (劉晉翰)
Cc: James Feist; [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

PTAL - https://gerrit.openbmc-project.xyz/24827 - this is merged, and the srcrev bump should propagate into

openbmc/openbmc in a day or two.

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 2 lines
Quoted 2 lines

On Wed, Aug 28, 2019 at 11:00 PM Hank Liou (劉晉翰)

Quoted 21 lines · <[email protected]> wrote:
Quoted 21 lines
Quoted 21 lines

Hi Patrick,

I think it's OK to parse the config min&max for temp sensors.

Any suggestion?

Thanks,
Hank

Quoted 11 lines

-----Original Message-----
From: openbmc [mailto:openbmc- [email protected]] On Behalf bounces+Of Hank Liou
(劉晉翰)
Sent: Friday, August 23, 2019 4:31 PM
To: Patrick Venture <[email protected]>; James Feist <[email protected]>
Cc: [email protected]
Subject: RE: [phosphor-pid-control] scaling issue

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Hi Patrick,

Quoted 4 lines

-----Original Message-----
From: Patrick Venture [mailto:[email protected]]
Sent: Wednesday, August 21, 2019 10:32 PM
To: Hank Liou (劉晉翰) <[email protected]>; James

Feist

Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

<[email protected]>
Cc: [email protected]
Subject: Re: [phosphor-pid-control] scaling issue

Quoted 6 lines · Hank Liou (劉晉翰)

Hi All,

After commit [1], I found my temp sensor reading would be re-scaled by

multiplying 1 over 255, making temperature into unfamiliar unit. Also the fan rpm reading would lie in [0,1] interval, letting the fan input to be 0 (since the input value of fan is from an integer array [2]). Are these

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

normal behaviors?

Quoted 4 lines

Or do I miss something?

Are you using dbus configuration or json? If json, can you attach your

config.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Since you're saying it was working and now isn't, I'm assuming there's something about the config being treated differently with the code changes in an unexpected way.

I found pid control will first read min and max from dbus and then (before commit [1]) revise them if

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

info->min != conf::inheritValueFromDbus (in
info->dbus/dbuspassive.cpp)

After value initialization, the min and max would be the ones in json file (Json file [3]). However, after commit [1] the min and max values of config would not be fed into the fan

control process.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

The scaling issue is originated from commit [4] with the aim to treat fan rpm as percentage. It seems that commit [1] unexpectedly affects temp sensors in the sense that the temp is the integer reading not percentage. Before commit [1], it would not re-scale the

temp reading since my min and max are 0 [6].

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

There is another issue with commit [1]. Now the fan rpm would be something like

1500 / 20000 = 0.075

where rpm max 20000 is from dbus. However the fan input function would transfer double into int, which is 0 for 0.075 (see

[5]).

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Hence the fan input is 0 not percentage. Is there something

wrong?

Quoted 70 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

[1] https://github.com/openbmc/phosphor-pid-
control/commit/fc2e803f5d9256944e18c7c878a441606b1f121c
[2] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancont

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

ro

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

lle
r.cpp#L86
[3]

       {
            "name": "fan1",
            "type": "fan",
            "readPath": "/sys/class/hwmon/hwmon1/fan1_input",
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
            "writePath": "/sys/class/hwmon/hwmon1/pwm1",
            "min": 0,
            "max": 255
        },
        {
            "name": "temp1",
            "type": "temp",
            "readPath":

"/xyz/openbmc_project/sensors/temperature/temp1",

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
            "writePath": "",
            "min": 0,
            "max": 0
        }

[4] https://github.com/openbmc/phosphor-pid-
control/commit/75eb769d351434547899186f73ff70ae00d7934a
[5] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/pid/fancont

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

ro

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

lle
r.cpp#L64
[6] https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153cebe666d3fbe88bddd02a1a/dbus/dbuspa

Quoted 29 lines
Quoted 29 lines
Quoted 29 lines

ss

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

i
ve.cpp#L158

Quoted 22 lines
Quoted 5 lines

[1]
https://github.com/openbmc/phosphor-pid-

control/commit/fc2e803f5d92569

Quoted 4 lines

44e18c7c878a441606b1f121c

[2]
https://github.com/openbmc/phosphor-pid-

control/blob/a7ec8350d17b70153

Quoted 11 lines

cebe666d3fbe88bddd02a1a/pid/fancontroller.cpp#L86

Thanks,

Hank Liou

Quanta Computer Inc.

Sincerely,
Hank