From: He Rongguang <herongguang@linux.alibaba.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: jacob.jun.pan@linux.intel.com, lenb@kernel.org,
linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org,
shannon.zhao@linux.alibaba.com
Subject: Re: [PATCH] x86/cstate: fix mwait hint target cstate calc
Date: Sun, 3 Mar 2024 12:13:18 +0800 [thread overview]
Message-ID: <2e00db1e-a9fc-4efb-b95b-b216125e105f@linux.alibaba.com> (raw)
In-Reply-To: <CAJZ5v0gqcN7F+xzXPdOnYV5m7Lvoa2q8Pftv6u0=_VVA6-FrHw@mail.gmail.com>
在 2024/3/1 19:04, Rafael J. Wysocki 写道:
> On Fri, Mar 1, 2024 at 11:02 AM He Rongguang
> <herongguang@linux.alibaba.com> wrote:
>>
>> 在 2024/3/1 1:22, Rafael J. Wysocki 写道:
>>> On Wed, Feb 28, 2024 at 8:28 AM He Rongguang
>>> <herongguang@linux.alibaba.com> wrote:
>>>>
>>>> According to x86 manual (Intel SDM Vol 2, Table 4-11. MWAIT Hints
>>>> Register (EAX) and AMD manual Vol 3, MWAIT), mwait hint[7:4] adds 1 is
>>>> the corresponding cstate, and 0xF means C0, so fix the handling of
>>>> 0xF -> C0.
>>>>
>>>> Intel: "Value of 0 means C1; 1 means C2 and so on
>>>> Value of 01111B means C0".
>>>>
>>>> AMD: "The processor C-state is EAX[7:4]+1, so to request C0 is to place
>>>> the value F in EAX[7:4] and to request C1 is to place the value 0 in
>>>> EAX[7:4].".
>>>
>>> Yes, 0x0F is defined to correspond to C0. However, the value in
>>> question is never equal to 0x0F in any of the functions modified by
>>> this patch.
>>>
>>> What's the purpose of the modification, then?
>>>
>>
>> Hi, this is found when I tweak ACPI cstate table qemu presenting to VM.
>>
>> Usually, ACPI cstate table only contains C1+, but nothing prevents ACPI
>> firmware from presenting a cstate (maybe C1+) but using a mwait address
>> C0 (i.e., 0xF in ACPI FFH MWAIT hint address). And if this is the case,
>> Linux erroneously treat this cstate as C16, while actually this should
>> be legal C0 state.
>>
>> As I think ACPI firmware is out of Linux kernel scope, so I think it’s
>> better for Linux kernel to implement here referring to spec, how do you
>> think? :)
>
> That's fair, but you need to put the above information into the patch
> changelog. Otherwise it is unclear why you want to make this change.
Ok, will send a V2 patch.
prev parent reply other threads:[~2024-03-03 4:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 7:28 [PATCH] x86/cstate: fix mwait hint target cstate calc He Rongguang
2024-02-29 17:22 ` Rafael J. Wysocki
2024-03-01 10:02 ` He Rongguang
2024-03-01 11:04 ` Rafael J. Wysocki
2024-03-03 4:13 ` He Rongguang [this message]
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=2e00db1e-a9fc-4efb-b95b-b216125e105f@linux.alibaba.com \
--to=herongguang@linux.alibaba.com \
--cc=jacob.jun.pan@linux.intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=shannon.zhao@linux.alibaba.com \
/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