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

Re: [PATCH v3 1/5] x86/mwait-idle: add 'preferred-cstates' command line option


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 12 Oct 2022 15:46:24 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6QiShWwjdzjchzvdOjo90MiNbU72PRGGkQNLl+VmQa0=; b=QqtXRsoFkEeSAjWy5piIlgjS5qPfz7SeaKtplQzgRaC0srGl74dyeOafvXoR3SUugSHTBRd48JiGWVhMHXxOSsh1oGPgGe/ytpaTIgMssXe4p0PM+W6vmUDeDqxuWfbGCi/0dHP8jLq9cSE2aqw7ydjZuom+Lrgr0VhclqTdwrQz7pL3Z1s9rDPswI1FeNfQSU/uR0pJPGtoRM5U+4taNtVj60nqlXV0Cksd/PBEOkQRzvpDKdbiEbahNQy35CNQ4OaOYy/Nz2gOaZ4to02EtEu6DHJxq9SWgmNpmPPjdb2b08ZDp2Slmqg0ngrH0OeAHEcmqvjhlqmtVWH9EZk2TA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lO7Cc5MWsbaEKan4P6F5d51QXMuj0DS9Psf95qeNzPG1uazTXtBmwqCnqyRxQgUzdFRaJR9HTpJVpUTbLEDj/I77j33k69p1DdWqXVc4+BpIj4Oc7GyVRRP5TsPUBF6XLhitpyGw3I4/sYz1KWjI2977yxCwL/isJdn5MzPcldcypQRO10O2b1zdiiJNvGCyDu50bgljOA5nAqp0YJFh9XHwoIocVXgA4VfiSgu07kVAmdblkogb4GCh0/EdsSyUKSt5qhAADnKNHiMUOOD7Hy2uRyofU6HXi8eTyIParhVyrBEskpD/yNiSPEQcTiO8vrlzgN8JgiXImnpOiu08zA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Wed, 12 Oct 2022 13:46:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 11.10.2022 18:22, Roger Pau Monné wrote:
> On Thu, Aug 18, 2022 at 03:03:33PM +0200, Jan Beulich wrote:
>> @@ -1309,6 +1360,39 @@ static int __init mwait_idle_probe(void)
>>      pr_debug(PREFIX "lapic_timer_reliable_states %#x\n",
>>               lapic_timer_reliable_states);
>>  
>> +    str = preferred_states;
>> +    if (isdigit(str[0]))
>> +            preferred_states_mask = simple_strtoul(str, &str, 0);
>> +    else if (str[0])
>> +    {
>> +            const char *ss;
>> +
>> +            do {
>> +                    const struct cpuidle_state *state = icpu->state_table;
>> +                    unsigned int bit = 1;
>> +
>> +                    ss = strchr(str, ',');
>> +                    if (!ss)
>> +                            ss = strchr(str, '\0');
>> +
>> +                    for (; state->name[0]; ++state) {
>> +                            bit <<= 1;
>> +                            if (!cmdline_strcmp(str, state->name)) {
>> +                                    preferred_states_mask |= bit;
>> +                                    break;
>> +                            }
>> +                    }
>> +                    if (!state->name[0])
>> +                            break;
>> +
>> +                    str = ss + 1;
>> +        } while (*ss);
>> +
>> +        str -= str == ss + 1;
> 
> I would add parentheses to the sum for clarity.

If I was to add parentheses here, then like this:

    str -= (str == ss + 1);

Looks like I've screwed up with indentation here, though.

>> @@ -1400,8 +1484,18 @@ static int cf_check mwait_idle_cpu_init(
>>      if (icpu->byt_auto_demotion_disable_flag)
>>              on_selected_cpus(cpumask_of(cpu), byt_auto_demotion_disable, 
>> NULL, 1);
>>  
>> -    if (icpu->disable_promotion_to_c1e)
>> +    switch (icpu->c1e_promotion) {
>> +    case C1E_PROMOTION_DISABLE:
>>              on_selected_cpus(cpumask_of(cpu), c1e_promotion_disable, NULL, 
>> 1);
>> +            break;
>> +
>> +    case C1E_PROMOTION_ENABLE:
>> +            on_selected_cpus(cpumask_of(cpu), c1e_promotion_enable, NULL, 
>> 1);
>> +            break;
>> +
>> +    case C1E_PROMOTION_PRESERVE:
>> +            break;
>> +    }
> 
> I find it kind of weird to user a notifier for this, won't it be
> easier to set the C1E promotion as part of the CPU bringup process?

A CPU notifier _is_ part of the CPU bringup process, isn't it? So it's
not clear to me what alternative you're thinking of.

> I see we also set other bits in the same way.

Well, yes - right here I only extend what we already have in place.
Re-working that in whichever way ought to be a separate topic imo, and
preferably not be part of a port of a commit coming from Linux.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.