Re: [PATCH] PM / devfreq: Fix atomicity violation in devfreq_update_interval()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi MyungJoo Ham,

Based on our understanding of the code, the variable cur_delay stores
the old value of devfreq->profile->polling_ms. We also agree that
reading from *delay does not need to be protected by the lock. The
reason we moved both definitions inside the lock is to maintain the
original order of the code. We apologize for the misunderstanding this
may have caused.

If the read of devfreq->profile->polling_ms is not protected by the
lock, the cur_delay that enters the critical section would not store
the actual old value of devfreq->profile->polling_ms, which would
affect the subsequent checks like if (!cur_delay) and if (cur_delay >
new_delay), potentially causing the driver to perform incorrect
operations.

We believe that moving the read of devfreq->profile->polling_ms inside
the lock is beneficial as it ensures that cur_delay stores the true
old value of devfreq->profile->polling_ms, ensuring the correctness of
the later checks.

As for acquiring the lock in the caller, we believe that this is not
suitable in this case because it may require introducing a new lock.
Furthermore, the function takes a struct devfreq *devfreq as a
parameter and accesses devfreq->profile->polling_ms, so holding
devfreq->lock prevents devfreq->profile->polling_ms from being
modified. Protecting the read operation with devfreq->lock seems
natural and ensures that the retrieved value is the real old value of
devfreq->profile->polling_ms, which we believe is effective.

Thank you for your response, and we welcome further discussion.

Qiu-ji Chen




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux