Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp529719ybl; Fri, 31 Jan 2020 03:24:47 -0800 (PST) X-Google-Smtp-Source: APXvYqw4GGG0YcYFkyZDiO66VaPC73mMgMEuAkvT1u0aHk2oP8FTJyAnfILHv+S3GXYqVD2Knd6k X-Received: by 2002:a9d:6290:: with SMTP id x16mr7066906otk.343.1580469887299; Fri, 31 Jan 2020 03:24:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580469887; cv=none; d=google.com; s=arc-20160816; b=UvRLoDeQAE9j3Wl/hQwqilb/ZjCZdRLrSUPv6KSGY74r5EkVkgS7qIlNdRtUr6LoVW ENgvGMuKsh2rwvkAWz6F2D2UFTKhZTasf51tqCwDY4c81on7DhPp4TVrwuja10dcHrWo SK0NamhwPb/LpCWvY4NNsOFxvWFzfoybdoL17LLRJILrqaB3OWFxCIsVc1rpDE0eEjvi ScAACLDTovUOAZb/jA5D/PaH82bMCf/EFXgnNMeYw8VRzilxhMeTqmXTjbYs9DLjKoW6 67sOOCtWQ/OxmKEND5CyYaFQIuYXku+QASb3ZAsKAY/9izRBZWOUtq/QO6RVYt2YVckW a7UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=XfiTN0BJfOgrv7nAN5xoTlpf87oyILezQoBQLhz/u3Y=; b=XB4QHEvIqKEhl4xqvbkkFRNxU7Anqem6sGAeZecGJuo+j6rUqar+iTHGU6B+VXStXq 3MbsP7pNaU97hBJXHtTKqFC+T4ok56saVAvlkQ2jYiMIZQzcKWHMMBnXClAEW2IQvFUu w+RbGlLtfC5tOQha4RyOxY4XdKXx7bZY9wDOZcQAI/xAvtvJNMcljDjNXVTjzDqupK09 VKG+qWzlV4JoIBVXeAXC6PhrdRlMg9fua4Me3O6Tonf3EXbCwcTbeHbzO91jNguuAIuQ ApNLsPOuJTjqW8MvflO2pCSipSoZwclUwxMI7m9BbJZjsIFc2/L+OS+267MhzX33F/7n VwpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g25si4906488otj.198.2020.01.31.03.24.33; Fri, 31 Jan 2020 03:24:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728402AbgAaLXh (ORCPT + 99 others); Fri, 31 Jan 2020 06:23:37 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:39968 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728268AbgAaLXh (ORCPT ); Fri, 31 Jan 2020 06:23:37 -0500 Received: by mail-ot1-f65.google.com with SMTP id i6so6221175otr.7; Fri, 31 Jan 2020 03:23:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XfiTN0BJfOgrv7nAN5xoTlpf87oyILezQoBQLhz/u3Y=; b=aA9rJUaOiED0pd1EuPZ5MqGHzsiGGgv3JmPGFnT4P0UOZgXhM7OQS7ZUigjUa2XCX8 HG5UsWXl7bcPIzKpgK4Jso4mc605SkT0+c885RVNVA3KnwXWFaDwqcLFzpPQMJq6P3sB kb28nTXW+mAiiLafXg+2iXbTkU25gmnuosdL5GvCtZTYjWZX1WTK+yjQqNzmpfJU+03x wgltHZFrydRHXf9DMX7dkuEa7+6EhlnOlD1I7GuYQ2wHVPerGEAebrClKA/e3VZVsjxZ rYG5NRjArHw4cpDt3VDlGFXGIIG9/YE2lNSdd+Ikf8quzGDV8y1LOA1T7caAOPbS3r4O cx6g== X-Gm-Message-State: APjAAAUhpqxw1Tt+3SzO3oFTeQUppwnCNbSqFon/UO9s1DptTcOsgWOh 0HRrA1g9Xdv3faazVTTX6x70jeNjqssq2vpi2/0= X-Received: by 2002:a9d:67d7:: with SMTP id c23mr7388808otn.262.1580469816212; Fri, 31 Jan 2020 03:23:36 -0800 (PST) MIME-Version: 1.0 References: <1720216.0Jr2BLnqKp@kreacher> <16995896.bQtfYxEEOs@kreacher> <86fb1cd10e344f76a3e96c4b6c722680@AcuMS.aculab.com> In-Reply-To: <86fb1cd10e344f76a3e96c4b6c722680@AcuMS.aculab.com> From: "Rafael J. Wysocki" Date: Fri, 31 Jan 2020 12:23:25 +0100 Message-ID: Subject: Re: [PATCH 2/2] intel_idle: Introduce 'states_off' module parameter To: David Laight Cc: "Rafael J. Wysocki" , Linux PM , Linux ACPI , LKML , Len Brown , Zhang Rui , David Box , Artem Bityutskiy , "Rafael J. Wysocki" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 31, 2020 at 12:07 PM David Laight wrote: > > From: Rafael J. Wysocki > > Sent: 30 January 2020 14:47 > > > > In certain system configurations it may not be desirable to use some > > C-states assumed to be available by intel_idle and the driver needs > > to be prevented from using them even before the cpuidle sysfs > > interface becomes accessible to user space. Currently, the only way > > to achieve that is by setting the 'max_cstate' module parameter to a > > value lower than the index of the shallowest of the C-states in > > question, but that may be overly intrusive, because it effectively > > makes all of the idle states deeper than the 'max_cstate' one go > > away (and the C-state to avoid may be in the middle of the range > > normally regarded as available). > > > > To allow that limitation to be overcome, introduce a new module > > parameter called 'states_off' to represent a list of idle states to > > be disabled by default in the form of a bitmask and update the > > documentation to cover it. > > The problem I see is that there are (at least) 3 different ways of > referring to the C-States: So the mask is not referring to the C-states in the first place. > 1) The state names, C1, C1E, C3, C7 etc. > I'm not sure these are visible outside intel_idle.c. Yes, they are, in sysfs. > 2) The maximum allowed latency in us. > 3) The index into the cpu-dependant tables in intel_idle.c. > > Boot parameters that set 3 are completely hopeless for normal > users. The C-state names might be - but they aren't documented. > > Unless you know exactly which cpu table is being used the > only constraint a user can request is the latency. So this mask refers to the idle states numbering in sysfs, as stated in the documentation update. That covers state0 which is not a C-state too. > (I've had the misfortune to read intel_idle.c in the last week. > Almost impenetrable TLA ridden uncommented code.) I have some patches to improve that, will post them after this is settled. > ... > > + * The positions of the bits that are set in the two's complement representation > > + * of this value are the indices of the idle states to be disabled by default > > + * (as reflected by the names of the corresponding idle state directories in > > + * sysfs, "state0", "state1" ... "state" ..., where is the index of the > > + * given state). > > What has 'two's complement' got to do with anything? Well, it is the representation in which bits are used. Kind of as opposed to decimal or hex digits. But I can replace that phrase with "bits that are set in this number" easily enough. > ... > > +The value of the ``states_off`` module parameter (0 by default) represents a > > +list of idle states to be disabled by default in the form of a bitmask. Namely, > > +the positions of the bits that are set in the two's complement representation of > > +that value are the indices of idle states to be disabled by default (as > > +reflected by the names of the corresponding idle state directories in ``sysfs``, > > +:file:`state0`, :file:`state1` ... :file:`state` ..., where ```` is the > > +index of the given idle state; see :ref:`idle-states-representation` in > > +:doc:`cpuidle`). For example, if ``states_off`` is equal to 3, the driver will > > +disable idle states 0 and 1 by default, and if it is equal to 8, idle state 3 > > +will be disabled by default and so on (bit positions beyond the maximum idle > > +state index are ignored). The idle states disabled this way can be enabled (on > > +a per-CPU basis) from user space via ``sysfs``. > > A few line breaks would make that easier to read. Fair enough. Thanks!