Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5303753ybl; Tue, 27 Aug 2019 02:33:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzrGIzgI2GL96vki/NJJJDo46fWmJOdt6tguCDAgFNBXktvAqhFo6WZdHEp+Uh/EyXbYQ6r X-Received: by 2002:a17:902:6b81:: with SMTP id p1mr23290348plk.91.1566898392043; Tue, 27 Aug 2019 02:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566898392; cv=none; d=google.com; s=arc-20160816; b=szAWjNWqmgwWvvKocS1Gg6eoIgY8GQ8BPuIQe/VAbiagV+aPTlUsUbHbgmrC5WdZb2 Hh6BcesX43Sxnbu8rJhei0sYDBySgX6ZeWlYR6fYZJgH96P4VGAEvewVRdJgjQu3+XFs +kSm2Fq23lLD3yqyFslxQJKVHKNK0tcGo1l19+GevVjpFHIjNSZ02JjQtiAFt6Yr7Yv+ p9SIizBqFPcsVqx7qm/SQJzKPIR/5KhAUnN8ictyCvNsS0XsZCd5oVy9HOicn0QBgShQ lXwVdiEKmkO5j7RTYTdNXL5Tg/goVPWz61LhEk/wUClmiFXL6Qz/tvH+YhKxL436CJtk nEXQ== 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:message-id :user-agent:mime-version:in-reply-to:references:cc:to:subject:from :date:dkim-signature; bh=5MtLSAT1Tzreq71yap21NOgQKtdyfFLfctGgPcM22Ac=; b=ILRjeyPejPAS5uo0GXUjqlRKx6fIxRIiNvBEhCVqnNty2oBnsWCBK/4hYlkHKYcYZq kPtP1ngAHmLZcuRdiKBJp6oRSB0ZwdzSeeci+gwBHIdcfQuoiQc9umegjNa/fgSLqwCt gggH+CGnnGSmQH0D8sWi9EjlQ/jdbBi4ScBw+irWfnqpp13VGK26wAa0snxY/bkzq0oW exFeZyfmGjNUqdmCEdwIY8/P88bqbDGX7eTbh2iUzvfqE2sPkw9CuC0Ai1I4OKsoYg+n M1olDQrffvWqWu9Aau7X2bIaWJessNUI1zBbRlrv/7rszyu3dHsBY46CsleqkHIpPHkP S9kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WJ2iFn7a; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x126si11796145pgx.356.2019.08.27.02.32.56; Tue, 27 Aug 2019 02:33:12 -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=@gmail.com header.s=20161025 header.b=WJ2iFn7a; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730030AbfH0Jbm (ORCPT + 99 others); Tue, 27 Aug 2019 05:31:42 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:41513 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729784AbfH0Jbk (ORCPT ); Tue, 27 Aug 2019 05:31:40 -0400 Received: by mail-pg1-f194.google.com with SMTP id x15so12362241pgg.8; Tue, 27 Aug 2019 02:31:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :user-agent:message-id:content-transfer-encoding; bh=5MtLSAT1Tzreq71yap21NOgQKtdyfFLfctGgPcM22Ac=; b=WJ2iFn7a4d3B1jfWkj5NB6w9UELUqGuxBy8jHmT3dPX0RHhuG/77r0Yc/jV6YAT5ko ktemwF5n8CFmGSN/rGtJuEnXtS3sAeh/cM8ggJt+1dCwapM9BsAlBF46X1pmZ0hOjK87 4pQEIXdmYheYx1tELuDdQqOhLpTslNKH8dMG7ySRIv5lB0yhlt63dj8nrvc3pzyHg7pN OTr3btE5/znCf4SXO09lXXdwtmOrfw5R8MRROnwK6VqVc3r03aMSmkE/9g1kxIpZoJq/ yIVZ2V6erW8n8hN2n8D4PfCCKLZrn7Fg9UpqWFm1R2680PBFtdV+Y+6TrTevUOTWOITC L/6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:user-agent:message-id:content-transfer-encoding; bh=5MtLSAT1Tzreq71yap21NOgQKtdyfFLfctGgPcM22Ac=; b=jIa1FTypTs0htNj7LjFliYm22PI3LLcG3A6hjP+E8xxi6NzamHOTSXH4TEaV9ZMrUb q2eP351kzzuJH4FttmfhWH1t1+58S5ZxqMX/A955Sn0lZqHYu9/1BUXwJg6ecM5dkshf tjPhWSdmMTM25mKC0K7AdDrAG+z84Zl34xSG92Zqhvaz5v0/IQb+hioj5elzGd6Hf6AC u0EN9TYv39YJ8Qzeqg9wyBxZjLc97QOhs/w5RW1Tfb/q81djbf4ZEyusQM8MkJ4OZRIF /YlmaAJ6dtLhbQSqRXoJvAaMTO/y3YSruRV2BEldQKf1TzOQ9Spg+jB4zoqHhjCL71zh T1jQ== X-Gm-Message-State: APjAAAVXaZHx58JrTQw8SqUWZCoO2L744gmAkXnaK9CDsWN3DBZhefkB PnbJVPTDKq+pnfprJ83Bhhhx5GgH X-Received: by 2002:aa7:8a04:: with SMTP id m4mr24834217pfa.65.1566898299133; Tue, 27 Aug 2019 02:31:39 -0700 (PDT) Received: from localhost (14-202-91-55.tpgi.com.au. [14.202.91.55]) by smtp.gmail.com with ESMTPSA id l7sm9826287pff.35.2019.08.27.02.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Aug 2019 02:31:38 -0700 (PDT) Date: Tue, 27 Aug 2019 19:31:02 +1000 From: Nicholas Piggin Subject: Re: [RFC 0/3] New idle device-tree format and support for versioned stop state To: devicetree@vger.kernel.org, Abhishek Goel , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, paulus@samba.org Cc: daniel.lezcano@linaro.org, ego@linux.vnet.ibm.com, mikey@neuling.org, mpe@ellerman.id.au, rjw@rjwysocki.net, svaidy@linux.ibm.com References: <20190823070940.43220-1-huntbag@linux.vnet.ibm.com> In-Reply-To: <20190823070940.43220-1-huntbag@linux.vnet.ibm.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1566894003.kb57vy8ri2.astroid@bobo.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Abhishek Goel's on August 23, 2019 5:09 pm: > Background > ------------------ >=20 > Previously if a older kernel runs on a newer firmware, it may enable > all available states irrespective of its capability of handling it. > Consider a case that some stop state has a bug, we end up disabling all > the stop states. This patch introduces selective control to solve this > problem. >=20 > Previous version of these patches can be found at: > https://lkml.org/lkml/2018/10/11/544 > These patch however also had patches for support of opal save-restore > which now I am decoupling and will take them seperately. > I have posted the corresponding skiboot patches for this kernel patchset > here : https://patchwork.ozlabs.org/cover/1144587/ >=20 > What's new? > -------------------- >=20 > Add stop states under ibm,idle-states in addition to the current array > based device tree properties. >=20 > New device tree format adds a compatible flag which has version > corresponding to every state, so that only kernel which has the capabilit= y > to handle the version of stop state will enable it. Drawback of the array > based dt node is that versioning of idle states is not possible. >=20 > Older kernel will still see stop0 and stop0_lite in older format and we > will deprecate it after some time. >=20 > Consider a case that stop4 has a bug. We take the following steps to > mitigate the problem. >=20 > 1) Change compatible string for stop4 in OPAL to "stop4,v2" from > "stop4,v1", i.e. basicallly bump up the previous version and ship the > new firmware. >=20 > 2) The kernel will ignore stop4 as it won't be able to recognize this > new version. Kernel will also ignore all the deeper states because its > possible that a cpu have requested for a deeper state but was never able > to enter into it. But we will still have shallower states that are there > before stop 4. This, thus prevents from completely disabling stop states. >=20 > Linux kernel can now look at the version string and decide if it has the > ability to handle that idle state. Henceforth, if kernel does not know > about a version, it will skip that state and all the deeper state. >=20 > Once when the workaround are implemented into the kernel, we can bump up > the known version in kernel for that state, so that support can be > enabled once again in kernel. >=20 > New Device-tree : >=20 > Final output > power-mgt { > ... > ibm,enabled-stop-levels =3D <0xec000000>; > ibm,cpu-idle-state-psscr-mask =3D <0x0 0x3003ff 0x0 0x3003ff>; > ibm,cpu-idle-state-latencies-ns =3D <0x3e8 0x7d0>; > ibm,cpu-idle-state-psscr =3D <0x0 0x330 0x0 0x300330>; > ibm,cpu-idle-state-flags =3D <0x100000 0x101000>; > ibm,cpu-idle-state-residency-ns =3D <0x2710 0x4e20>; > ibm,idle-states { > stop4 { > flags =3D <0x207000>; > compatible =3D "stop4,v1", > psscr-mask =3D <0x0 0x3003ff>; > latency-ns =3D <0x186a0>; > residency-ns =3D <0x989680>; > psscr =3D <0x0 0x300374>; > ... > }; > ... > stop11 { > ... > compatible =3D "stop11,v1", > ... > }; > }; I'm not sure about this. I think the real problem we have is that the OPAL stop API is not actually implementation independent. Because we *can* selectively disable stop states in the firmware if there is a hardware/firmware problem with them. So we need a way to rev ISA/Book4/OPAL stuff so the kernel won't try to use it if it's incapable. We have that today in dt-cpu-ftrs. POWER9 advertises the "idle-stop" feature. An incompatible implementation could advertise idle-stop-v4. That won't allow individual states to remain back compatible, but if=20 there is a new implementation which changes any behaviour it needs to be=20 incopmatible, even if Linux happens to not rely on said behaviour yet. =20 So I don't think we can keep any of them (except stop0 lite) compatible,=20 so I don't see a real downside (we'll have to discuss this offline). Thanks, Nick =