Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Pali Rohár" <pali@kernel.org>, "Armin Wolf" <W_Armin@gmx.de>
Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] hwmon: (dell-smm) Unify i8k_ioctl() and i8k_ioctl_unlocked()
Date: Mon, 22 Nov 2021 11:28:30 -0800	[thread overview]
Message-ID: <b73d5a00-ecce-0517-4fb5-4af451e1facb@roeck-us.net> (raw)
In-Reply-To: <20211122191008.uw2tk4orb7p2elb7@pali>

On 11/22/21 11:10 AM, Pali Rohár wrote:
> On Monday 22 November 2021 19:50:14 Armin Wolf wrote:
>> Am 22.11.21 um 18:55 schrieb Guenter Roeck:
>>> On 11/22/21 8:01 AM, Pali Rohár wrote:
>>>> On Saturday 20 November 2021 18:03:19 Armin Wolf wrote:
>>>>> The only purpose of i8k_ioctl() is to call i8k_ioctl_unlocked()
>>>>> with i8k_mutex held. Judging from the hwmon code, this mutex
>>>>> only needs to be held when setting the fan speed/mode.
>>>>
>>>> Really? I think that there is no difference between setting and getting
>>>> fan speed/mode. At least I do not see why 'set' needs mutex and 'get' do
>>>> not need it. Some more explanation is needed...
>>>>
>>> I8K_SET_FAN sets the fan speed and returns the current status. Without
>>> locking, the returned status may not match or be associated with the
>>> previous
>>> set operation.
>>>
>>> Maybe that doesn't matter, and the synchronization is not needed. If so,
>>> you can probably remove the locking entirely.
>>>
>>> Guenter
>>
>> That is the reason i kept the locking code. Since i do not want to break
>> the ioctl interfacein any way, removing the locking code seems too risky
>> to me.
> 
> I see. That is a good point.
> 
> But there is same race condition also when at the same time going to
> change speed via ioctl and also via hwmon sysfs.
> 

I thought the sysfs code does not change the fan speed and report the
fan status in the same request. Did I miss something ?

Guenter

  reply	other threads:[~2021-11-22 19:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-20 17:03 [PATCH 0/2] hwmon: (dell-smm) Improve ioctl handler Armin Wolf
2021-11-20 17:03 ` [PATCH 1/2] hwmon: (dell-smm) Simplify " Armin Wolf
2021-11-23 16:13   ` Pali Rohár
2021-11-29 20:57     ` Armin Wolf
2021-12-09 16:52       ` Pali Rohár
2021-11-20 17:03 ` [PATCH 2/2] hwmon: (dell-smm) Unify i8k_ioctl() and i8k_ioctl_unlocked() Armin Wolf
2021-11-22 16:01   ` Pali Rohár
2021-11-22 17:55     ` Guenter Roeck
2021-11-22 18:50       ` Armin Wolf
2021-11-22 19:10         ` Pali Rohár
2021-11-22 19:28           ` Guenter Roeck [this message]
2021-11-22 19:43             ` Pali Rohár
2021-11-23 16:00               ` Guenter Roeck
2021-11-23 16:02                 ` Pali Rohár
2021-11-23 16:04   ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b73d5a00-ecce-0517-4fb5-4af451e1facb@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=W_Armin@gmx.de \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pali@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox