[dpdk-dev] [PATCH 1/2] power: switching to unbuffered stdio for /sys file access

Radoslaw Biernacki radoslaw.biernacki at linaro.org
Wed Oct 18 15:56:52 CEST 2017


Hi David,

Thank you for comments.

On 18 October 2017 at 12:33, Hunt, David <david.hunt at intel.com> wrote:

> Hi Radoslaw,
>
>
> On 16/10/2017 2:47 PM, Radoslaw Biernacki wrote:
>
>> This patch fixes the bug caused by improper use of buffered
>> stdio file access for switching the CPU frequency and
>> governor. Each write operation when using buffered stdio
>> must be flushed out and the return code from fflush() must
>> be verified. In buffered mode, write() syscall return value
>> is is not returned by fwrite()/fputs()/fprintf().
>> Since with buffered approatch, fflush() need to be done
>> every time it is better to use unbuffered mode or not use
>> stdio at all (instead use plain open/write functions). To
>> minimize amount of changes this fix use first approach.
>>
>> Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki at linaro.org>
>> ---
>>   lib/librte_power/rte_power_acpi_cpufreq.c | 18 +++++++++++++++++-
>>   1 file changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_power/rte_power_acpi_cpufreq.c
>> b/lib/librte_power/rte_power_acpi_cpufreq.c
>> index 01ac5ac..8bf5685 100644
>> --- a/lib/librte_power/rte_power_acpi_cpufreq.c
>> +++ b/lib/librte_power/rte_power_acpi_cpufreq.c
>> @@ -143,12 +143,13 @@ set_freq_internal(struct rte_power_info *pi,
>> uint32_t idx)
>>                                 "for setting frequency for lcore %u\n",
>> pi->lcore_id);
>>                 return -1;
>>         }
>> +       /* we use unbuffered mode so following will fail if kernel will
>> refuse
>> +        * freq setting */
>>
>
> Also, there's an issue with checkpatch on the comment here. Please make
> sure to run your patches through checkpatch. Typically a recent version of
> checkpatch should be used (4.1x).
>

I apologise for missing checkpatch, seems that problems with my environment
settings cause the silent output.
Will never happen again.

---snip---

For the option of using open/write: yes, as you agreed with that, let me
prepare V2 of those fixes.


More information about the dev mailing list