Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1496857lqa; Mon, 29 Apr 2024 10:02:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX4n0y9ejYLzn5EfHWIuwZXjlK74i6yJ8gltpT+PBpx/8A4GQBxJvt+pndMjwLf0cyrO8ldOA2uuMhf9E4qPCzx6tpR9/n2+hzdC+Wp5w== X-Google-Smtp-Source: AGHT+IHNUxX59nIsgw/W5Om2lM6MyYp9I7AtpXnU1v7AIyTiKdIQwKOpsDDjs8H3/AJSIi7blmO3 X-Received: by 2002:a17:907:724a:b0:a58:ec3c:d2fa with SMTP id ds10-20020a170907724a00b00a58ec3cd2famr5465219ejc.57.1714410148832; Mon, 29 Apr 2024 10:02:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714410148; cv=pass; d=google.com; s=arc-20160816; b=SG36Fg9qQrYsrlY1M2fk6mGMHlgWgucQfxx9bgWo+NeO8F+F70mY+PlByH8zL7YzYY vf17ukuxri5C0bBjAohnJ+48q3TteZlLzqyIlZbhkkB3TWlC3dShPhasExuAbH1OVsIN bDLMeo6Qpbat1awDnB72PmwZsMq56Z0LxoksfRg65qhcmPbLBaNNzF2bDoVmypH29JVw +u9WAWES9l3YOJYi8CQgBDzqRhXQ4l4bNnIHnDQHPGWhAsieNLEtpA4Ajko/ORBpOJZs gYvEXigLLaP0V2UsGQUeiFpgN+pULJGx3lA2I2QhZrG0asjn75S4csKUQk+/7H+cAfng Aajw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=5t+dz2D3s226nBt/gzMXuiadHsPgYJR/HH6E+RwRjOA=; fh=CnJz/cLTnb0C+r1XYeO84iAIoVGMp82yPumZuEWeFYA=; b=mFgDhL9tuTTNCq0yEXmbXn50SVQ6yl/G7eI8jUXHvdhjl8X3sRyuwqnnIviZgBD9Qr 3NncVG3gc1rSNH2/Cn71MzD07xEN2hnoZxrYegbmiS0QdbJ57Uld7mvi54X4nmr/GW6V YUiXTRFSzTFSUiAy0CN1ir3e2DsQPWkr7H6tLmn/3+YoHyV3e8YueYRLt2+voUmeYPdj iHd588wqpJnaGaW8WNG0Lw5bcgF9zReOfSG6cG/VEQkmLMgq8uz0L0k0SbrS6MKk/3n8 mx84XHrfAg6HFAL9YgU6tRJxM1KJxKCVZ/wHrCtvrZIv/jM/bamwA6O4aTGnTIZX06eE yOEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N4asB7LY; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-162718-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162718-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id m26-20020a1709062ada00b00a5575cdf052si14817831eje.367.2024.04.29.10.02.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 10:02:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162718-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N4asB7LY; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-162718-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162718-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 679D31F21FC5 for ; Mon, 29 Apr 2024 17:02:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4C3B8627D; Mon, 29 Apr 2024 17:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="N4asB7LY" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B523F86136; Mon, 29 Apr 2024 17:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714410136; cv=none; b=T4NfknMtFSwWBbetzV+Qyqp6eq+5yyokCwXIsrW4cAyma5aXs9DmAqTbx/tFE2Dq5Dj7bb3Vz6WRGnkjmf+4H52ihxl/REVhAtwq3ykWGLFdqgytqo5dHE7xkTfFzMd7/ui/AdM14yrshvLpcVltoLsO+ruBfSwmnZPLS+m379U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714410136; c=relaxed/simple; bh=mf+Frf7fl4octShqGzqgSvfIMtLGvDDcUQwMkYwh52w=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=f7GZhmub1F3M6OSZ0xVcIFlMcmxGNq180ING5E3ciLlETV0kimWJHdh2EDsn2M5XQ5IaPIMxU0ig5YAFIoZf7YAScZ3DHdM/WFEOf+gP21af/Tk3MBM8Mvj+7LZtb3SjrnbGnBfLhkYHA4RALSCTgy2ul9oSTMwJlu2PC8C9VJU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N4asB7LY; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49588C113CD; Mon, 29 Apr 2024 17:02:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714410136; bh=mf+Frf7fl4octShqGzqgSvfIMtLGvDDcUQwMkYwh52w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=N4asB7LYM7edUrYg20DFQhFxA5xHp7KBeRiplnxz42b/zY597qXOefd92XaaFjLX7 SjUxtQRFjNs8cIIJoxAN36VhzCgvUz39Vzk/7tidvIZP7DBf31OF7jk1f+cZA6FPPL Vpt7jxNDq5vYzSMC+xYn+uartn7aX7P8rR4D6rV0nqiQf9UqOERu8uaVCMybeMbhYG EAsIZr1KG/KbhgdqpKv0qlipw04BC5TuWX3Uqa3ikgQ4sHQcFaQECH3IsYf3JDq2+p B8krtSnmepcwItO2p50wzQDxv3YqxZZH/LVNGgpvUtFD1ZSyzzdC3jC39Kt4ZxNtsD NPkPZ0NmU6saQ== Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-5afbcf8059cso92494eaf.1; Mon, 29 Apr 2024 10:02:16 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCU6zCKVv2gj1Fqg0G/W5ia1H2cSE6G9MlGs7ccrnzUtUZKo/Jzdq+2CfAfSua3/SJr3U5kFvtBg6dMZZ66O5i5FEDfKuHn0gl4eCa++7WqKOn4GuoT3eVlKM/ZZF7e577vhJy0Aarw= X-Gm-Message-State: AOJu0YxjxceqjjLcT/FwlkqsU1BpJOK0+tDbSDNdtj60F2WNQpxNiJ6D 7GDeRPJ8L7V5+YXwBZ6Ca5q0AX505CFYmVhIYrwEXZb0qQxTbnBCOVhtfShKj1mpvSoSsSGbNAD CRVdpAwFrlSIOiDfvYPWS5ZuXsms= X-Received: by 2002:a4a:a882:0:b0:5aa:241a:7f4b with SMTP id q2-20020a4aa882000000b005aa241a7f4bmr12779394oom.1.1714410135568; Mon, 29 Apr 2024 10:02:15 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <87zfth3l6y.fsf@somnus> <3aba1a1d-8ebc-4ee0-9caf-d9baae586db7@arm.com> <87zftcy0xt.fsf@somnus> <87sez4xxhn.fsf@somnus> In-Reply-To: <87sez4xxhn.fsf@somnus> From: "Rafael J. Wysocki" Date: Mon, 29 Apr 2024 19:02:03 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [linus:master] [timers] 7ee9887703: stress-ng.uprobe.ops_per_sec -17.1% regression To: Anna-Maria Behnsen Cc: Lukasz Luba , "Rafael J. Wysocki" , Oliver Sang , oe-lkp@lists.linux.dev, lkp@intel.com, linux-kernel@vger.kernel.org, Thomas Gleixner , ying.huang@intel.com, feng.tang@intel.com, fengwei.yin@intel.com, Frederic Weisbecker , Daniel Lezcano , linux-pm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 29, 2024 at 12:40=E2=80=AFPM Anna-Maria Behnsen wrote: > > Anna-Maria Behnsen writes: > > > Hi, > > > > Lukasz Luba writes: > >> On 4/26/24 17:03, Rafael J. Wysocki wrote: > >>> On Thu, Apr 25, 2024 at 10:23=E2=80=AFAM Anna-Maria Behnsen > >>> wrote: > > > > [...] > > > >>>> So my assumption here is, that cpuidle governors assume that a deepe= r > >>>> idle state could be choosen and selecting the deeper idle state make= s an > >>>> overhead when returning from idle. But I have to notice here, that I= 'm > >>>> still not familiar with cpuidle internals... So I would be happy abo= ut > >>>> some hints how I can debug/trace cpuidle internals to falsify or ver= ify > >>>> this assumption. > >>> > >>> You can look at the "usage" and "time" numbers for idle states in > >>> > >>> /sys/devices/system/cpu/cpu*/cpuidle/state*/ > >>> > >>> The "usage" value is the number of times the governor has selected th= e > >>> given state and the "time" is the total idle time after requesting th= e > >>> given state (ie. the sum of time intervals between selecting that > >>> state by the governor and wakeup from it). > >>> > >>> If "usage" decreases for deeper (higher number) idle states relative > >>> to its value for shallower (lower number) idle states after applying > >>> the test patch, that will indicate that the theory is valid. > >> > >> I agree with Rafael here, this is the first thing to check, those > >> statistics. Then, when you see difference in those stats in baseline > >> vs. patched version, we can analyze the internal gov decisions > >> with help of tracing. > >> > >> Please also share how many idle states is in those testing platforms. > > > > Thanks Rafael and Lukasz, for the feedback here! > > > > So I simply added the state usage values for all 112 CPUs and calculate= d > > the diff before and after the stress-ng call. The values are from a > > single run. > > > > Now here are the values of the states and the time because I forgot to > track also the time in the first run: > > USAGE good bad bad+patch > ---- --- --------- > state0 115 137 234 > state1 450680 354689 420904 > state2 3092092 2687410 3169438 > > > TIME good bad bad+patch > ---- --- --------- > state0 9347 9683 18378 > state1 626029557 562678907 593350108 > state2 6130557768 6201518541 6150403441 > > > > good: 57e95a5c4117 ("timers: Introduce function to check timer base > > is_idle flag") > > bad: v6.9-rc4 > > bad+patch: v6.9-rc4 + patch > > > > I choosed v6.9-rc4 for "bad", to make sure all the timer pull model fix= es > > are applied. > > > > If I got Raphael right, the values indicate, that my theory is not > > right... It appears so. However, the hardware may refuse to enter a deeper idle state in some cases= . It would be good to run the test under turbostat and see what happens to hardware C-state residencies. I would also like to have a look at the CPU frequencies in use in all of the cases above. > ... but with the time values: CPUs are less often but in total longer in = state2. I have divided the total residency numbers above by the corresponding usage numbers and got the below: state1: 1389,08 1586,40 1409,70 state2: 1982,66 2307,62 1940,53 for "good", "bad" and "bad+patch" , respectively. This shows that, on the average, after entering an idle state, a CPU spends more time in it in the "bad" case than in the other cases. To me, this means that, on the average, in the "bad" case there are fewer wakeups from idle states (or IOW the wakeups occur less frequently) and that seems to affect the benchmark in question adversely. Thanks!