Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2820373ybl; Thu, 29 Aug 2019 13:25:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOjUwKmR2N4auVV/HTg98XW1wkfyMf47UJkON8PqcVugoGA0K7XTKge8vG/xPAsNKq4WwN X-Received: by 2002:a17:902:76c2:: with SMTP id j2mr7648068plt.305.1567110330381; Thu, 29 Aug 2019 13:25:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567110330; cv=none; d=google.com; s=arc-20160816; b=rBPES0f8rlk/eIJ+hyeoYfx6uGhj5CjV8kXE7iEe6OjVfxYdUWrkHICLyE5jZLJ3Ua u6nZjfc3xMKMpkoLvdDhwsGhIJ4dN6jBMCOQ4HTKf6KYYuK9aJ3QuIF0j1KXxU2UbbrU xgM/j3pYQPvDyLU9gcQZT1wsWHbyFy0Nt+/Z5xd9rpeIOxdsOTetEDx4Orv1d9t5LPgm Zk6a+qu+WoXYkXH2yjlekMCjNYgGrbea8xQspVviJsyYgVvJv0oWsz8KWSTngppQb9sC ezLdsebSn929lp9/q6xKXgb5CSIyo4QjpVoOfPCaKDElzQGrf4qFtE/C63WydjuFoYt0 JSFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=r+qCAPQ3NqgeYdXXxqhqH68ikIu0Viwjapx5ijxXjyU=; b=pbHUrgULP3dnxepPgev3ORnorFKKS8R5iHqMbw3RlfWOfe7CyPZeQrz0gfvPLK7l2z bSpuCkR4b7w26bE7xfF+2xLlrPlPy1hN5ooiyFkK1MWMYR3skhw/puGxzq9n2bUo42bS vAy9Xjq5LdN8KFQL7xavP01dQh5pR4wcvcsn8bUNPR0ZUmZTaZpZ1/VZsQK8gK3qahzw CumHW55j6EJ5FL8f5tWz+WwAn7B6nkhAB1pWtCeoOL58uQTjBL54c5bnI13vEvmn9HMA Rn0ApVesOcFXVGP+ZSnNE09BalDzb3QLxLZTN1b3An9o/zAi5Nkv/FTJ8xLjZEj4yAbR 8/2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qSAyYuEF; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g4si2776326pgf.383.2019.08.29.13.25.14; Thu, 29 Aug 2019 13:25:30 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=qSAyYuEF; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728026AbfH2UWq (ORCPT + 99 others); Thu, 29 Aug 2019 16:22:46 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36108 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727234AbfH2UWp (ORCPT ); Thu, 29 Aug 2019 16:22:45 -0400 Received: by mail-wr1-f67.google.com with SMTP id y19so4740062wrd.3 for ; Thu, 29 Aug 2019 13:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=r+qCAPQ3NqgeYdXXxqhqH68ikIu0Viwjapx5ijxXjyU=; b=qSAyYuEFzHTuSEpnmD5y/VU7xrnlGWh/FpHOaFJ4fWXyG7iOqs/jtiZFRUND2b+piz b6yzEZO5nM2z3QQm9GUhwUpzC4zTJn2MAP+GJSDlCvoDGNQu3ZyPLqJCFdEEOtrBC8Ho hSxaONG+N+OIezUJAUAu2dMdmRkh6ovH8+2d9kwOGcCmnxYqq8oMMzo5OgtaJ2EoGAgK Ujzyg71zDi1PkAea9386nhQM0EgpirlTM7aE/FjVAP2Lbp4iW50j6ihu/zPdnZapksl5 s/s7L15Rl5H1wfRLMnz8vVFrYwWzfFavY5y9PkBGHtcm8wUhC0l1PZUrdGzs1KYWYumI jonQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=r+qCAPQ3NqgeYdXXxqhqH68ikIu0Viwjapx5ijxXjyU=; b=DWVGZb9ECsgWL0jmAp8kRefsReo/ycTaTDaxKZHzEDDTikq1bvZrBQTcKLcKYnBnvz wdQH+CBZyLzwa2Rhg0owzIxJO98wS1JgGziEJPuqBE7ngpyvklNmzKMhkm/mlgfExYWc Rw1PR4FpU/3zZShYfCKGyCOZEa6Xr208/D7wE1k4I9bGZUwnEAOX7Jhzr3ouA3lh1+qF hzugMu2fVdcGGeSXWBU+T7RfmWmTT7jyDuNVc2oYjcyhtlPQfUnPqUCpy+dWHzrCNBuI jZvfuXIDz7wkJ2T/AgGWBFYeGM1vKcaAndfZQB9KqPIJbKPV9/iwxQ2iqF5J/ld6k+kl EQcw== X-Gm-Message-State: APjAAAUTjCVGO4hf2cuWesIZyVUBx+eeuGw3LWBtiiPD0XBtRc8fqq0J /kXdXAFCz1hDz8vjTKTepg9X1A== X-Received: by 2002:adf:f3d1:: with SMTP id g17mr13955054wrp.38.1567110162171; Thu, 29 Aug 2019 13:22:42 -0700 (PDT) Received: from ?IPv6:2a01:e34:ed2f:f020:d9ce:7caa:c9ba:7f4c? ([2a01:e34:ed2f:f020:d9ce:7caa:c9ba:7f4c]) by smtp.googlemail.com with ESMTPSA id m23sm4942510wml.41.2019.08.29.13.22.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Aug 2019 13:22:41 -0700 (PDT) Subject: Re: Default governor regardless of cpuidle driver To: Joao Martins , Marcelo Tosatti , "Rafael J. Wysocki" Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-pm@vger.kernel.org, Boris Ostrovsky References: <20190829151027.9930-1-joao.m.martins@oracle.com> <6c8816af-934a-5bf7-6fb9-f67c05e2c8aa@oracle.com> <901ab688-5548-cf96-1dcb-ce50e617e917@linaro.org> <722bd6f6-6eee-b24b-9704-c9aecc06302f@oracle.com> From: Daniel Lezcano Openpgp: preference=signencrypt Autocrypt: addr=daniel.lezcano@linaro.org; prefer-encrypt=mutual; keydata= mQINBFv/yykBEADDdW8RZu7iZILSf3zxq5y8YdaeyZjI/MaqgnvG/c3WjFaunoTMspeusiFE sXvtg3ehTOoyD0oFjKkHaia1Zpa1m/gnNdT/WvTveLfGA1gH+yGes2Sr53Ht8hWYZFYMZc8V 2pbSKh8wepq4g8r5YI1XUy9YbcTdj5mVrTklyGWA49NOeJz2QbfytMT3DJmk40LqwK6CCSU0 9Ed8n0a+vevmQoRZJEd3Y1qXn2XHys0F6OHCC+VLENqNNZXdZE9E+b3FFW0lk49oLTzLRNIq 0wHeR1H54RffhLQAor2+4kSSu8mW5qB0n5Eb/zXJZZ/bRiXmT8kNg85UdYhvf03ZAsp3qxcr xMfMsC7m3+ADOtW90rNNLZnRvjhsYNrGIKH8Ub0UKXFXibHbafSuq7Rqy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1tKhQl+j6G/l2lDYsqKeRG55TXbu9M LqJYccPJ85B0PXcy63fL9U5DTysmxKQ5RgaxcxIZCM528ULFQs3dfEx5euWTWnnh7pN30RLg a+0AjSGd886Bh0kT1Dznrite0dzYlTHlacbITZG84yRk/gS7DkYQdjL8zgFr/pxH5CbYJDk0 tYUhisTESeesbvWSPO5uNqqy1dAFw+dqRcF5gXIh3NKX0gqiAA87NM7nL5ym/CNpJ7z7nRC8 qePOXubgouxumi5RQs1+crBmCDa/AyJHKdG2mqCt9fx5EPbDpw6Zzx7hgURh4ikHoS7/tLjK iqWjuat8/HWc01yEd8rtkGuUcMqbCi1XhcAmkaOnX8FYscMRoyyMrWClRZEQRokqZIj79+PR adkDXtr4MeL8BaB7Ij2oyRVjXUwhFQNKi5Z5Rve0a3zvGkkqw8Mz20BOksjSWjAF6g9byukl CUVjC03PdMSufNLK06x5hPc/c4tFR4J9cLrV+XxdCX7r0zGos9SzTPGNuIk1LK++S3EJhLFj 4eoWtNhMWc1uiTf9ENza0ntqH9XBWEQ6IA1gubCniGG+Xg== Message-ID: <2e2a35c8-7f03-d7c8-4701-3bc9d91c1255@linaro.org> Date: Thu, 29 Aug 2019 22:22:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <722bd6f6-6eee-b24b-9704-c9aecc06302f@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/08/2019 21:11, Joao Martins wrote: > On 8/29/19 7:28 PM, Daniel Lezcano wrote: >> On 29/08/2019 20:07, Joao Martins wrote: >>> On 8/29/19 6:42 PM, Daniel Lezcano wrote: >>>> On 29/08/2019 19:16, Joao Martins wrote: >>>>> On 8/29/19 4:10 PM, Joao Martins wrote: >>>>>> When cpus != maxcpus cpuidle-haltpoll will fail to register all vcpus >>>>>> past the online ones and thus fail to register the idle driver. >>>>>> This is because cpuidle_add_sysfs() will return with -ENODEV as a >>>>>> consequence from get_cpu_device() return no device for a non-existing >>>>>> CPU. >>>>>> >>>>>> Instead switch to cpuidle_register_driver() and manually register each >>>>>> of the present cpus through cpuhp_setup_state() callback and future >>>>>> ones that get onlined. This mimmics similar logic that intel_idle does. >>>>>> >>>>>> Fixes: fa86ee90eb11 ("add cpuidle-haltpoll driver") >>>>>> Signed-off-by: Joao Martins >>>>>> Signed-off-by: Boris Ostrovsky >>>>>> --- >>>>> >>>>> While testing the above, I found out another issue on the haltpoll series. >>>>> But I am not sure what is best suited to cpuidle framework, hence requesting >>>>> some advise if below is a reasonable solution or something else is preferred. >>>>> >>>>> Essentially after haltpoll governor got introduced and regardless of the cpuidle >>>>> driver the default governor is gonna be haltpoll for a guest (given haltpoll >>>>> governor doesn't get registered for baremetal). Right now, for a KVM guest, the >>>>> idle governors have these ratings: >>>>> >>>>> * ladder -> 10 >>>>> * teo -> 19 >>>>> * menu -> 20 >>>>> * haltpoll -> 21 >>>>> * ladder + nohz=off -> 25 >>>>> >>>>> When a guest is booted with MWAIT and intel_idle is probed and sucessfully >>>>> registered, we will end up with a haltpoll governor being used as opposed to >>>>> 'menu' (which used to be the default case). This would prevent IIUC that other >>>>> C-states get used other than poll_state (state 0) and state 1. >>>>> >>>>> Given that haltpoll governor is largely only useful with a cpuidle-haltpoll >>>>> it doesn't look reasonable to be the default? What about using haltpoll governor >>>>> as default when haltpoll idle driver registers or modload. >>>> >>>> Are the guest and host kernel the same? IOW compiled with the same >>>> kernel config? >>>> >>> You just need to toggle this (regardless off CONFIG_HALTPOLL_CPUIDLE): >>> >>> CONFIG_CPU_IDLE_GOV_HALTPOLL=y >>> >>> And *if you are a KVM guest* it will be the default (unless using nohz=off in >>> which case ladder gets the highest rating -- see the listing right above). >>> >>> Host will just behave differently because the haltpoll governor is checking if >>> it is running as kvm guest, and only registering in that case. >> >> I understood the problem. Actually my question was about if the kernels >> are compiled for host and guest, and can be run indifferently. > > /nods Correct. > >> In this >> case a runtime detection must be done as you propose, otherwise that can >> be done at config time. I pretty sure it is the former but before >> thinking about the runtime side, I wanted to double check. >> > Hmm, but even with separate kernels/configs for guest and host I think we would > still have the same issue. > > What I was trying to convey is that even when running with a config solely for > KVM guests (that is different than baremetal) you can have today various ways of > idling. An Intel x86 kvm guest can have no idle driver (but arch-specific), > intel_idle (like baremetal config) and haltpoll. There are usecases for these > three, and makes sense to consolidate all. > > Say you wanted to have a kvm specific config, you would still see the same > problem if you happen to compile intel_idle together with haltpoll > driver+governor. Can a guest work with an intel_idle driver? > Creating two separate configs here, with and without haltpoll > for VMs doesn't sound effective for distros. Agree > Perhaps decreasing the rating of > haltpoll governor, but while a short term fix it wouldn't give much sensible > defaults without the one-off runtime switch. -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog