POWER9 : Enable Stop 0-2 with ESL=EC=0

Bug #1666197 reported by bugproxy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Undecided
Tim Gardner
Yakkety
Fix Released
Undecided
Tim Gardner
Zesty
Fix Released
Undecided
Tim Gardner

Bug Description

In Linux 4.10-rc8, the implementation to enable the "stop" instruction has the following shortcomings:

a) The code hand-codes the values for ESL, EC, TR, MTL bits of PSSCR and uses only the RL field from the firmware. While this is not incorrect, since the hand-coded values are legitimate, it is not a
 very flexible design since the firmware has the capability to communicate these values via the "ibm,cpu-idle-state-psscr" and "ibm,cpu-idle-state-psscr-mask" properties. In case where the firmware provides values for these fields that is different from the hand-coded values, the current code will not work as intended.

b) Due to issue a), the current code assumes that ESL=EC=1 for all the stop states and hence the wakeup from the stop instruction will happen at 0x100, the system-reset vector which also results in GPR state loss. However, the ISA v3.0 allows the ESL=EC=0 behaviour where the corresponding stop-states lose no GPR state and wakes up from the subsequent instruction. The code in 4.10-rc8 doesn't support these light-weight stop modes.

The following commits in the "next" branch of the powerpc-linux git tree (git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git) address these issues. These patches are needed in 17.04 to enable
light-weight stop modes

1) commit 823b7bd5156a93872d9561b3f033dfe5cb80204e, powernv:idle: Add IDLE_STATE_ENTER_SEQ_NORET macro

2)commit dd34c74c97b6c3ed1ac7caec0b46267142659aff, powernv:stop: Rename pnv_arch300_idle_init to pnv_power9_idle_init

3)commit 9e9fc6f00a54f7064dc681ac187be6498d566a4f, cpuidle:powernv: Add helper function to populate powernv idle states

4)commit 09206b600c76f20984e80d99f3b5343c79332a97, powernv: Pass PSSCR value and mask to power9_idle_stop

5)commit b48ff52043f489d594b989b318c120ca340a2e41, Documentation:powerpc: Add device-tree bindings for power-mgt

CVE References

bugproxy (bugproxy)
tags: added: architecture-ppc64le bugnameltc-151588 severity-high targetmilestone-inin1704
Changed in ubuntu:
assignee: nobody → Taco Screen team (taco-screen-team)
affects: ubuntu → linux (Ubuntu)
Tim Gardner (timg-tpi)
Changed in linux (Ubuntu Zesty):
assignee: Taco Screen team (taco-screen-team) → Tim Gardner (timg-tpi)
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (14.0 KiB)

This bug was fixed in the package linux - 4.10.0-11.13

---------------
linux (4.10.0-11.13) zesty; urgency=low

  [ Tim Gardner ]

  * Release Tracking Bug
    - LP: #1669127

  * linux-tools-common should Depends: lsb-release (LP: #1667571)
    - [Config] linux-tools-common depends on lsb-release

  * Ubuntu (Zesty): When we miss LSI/INTx interrupts on slot, message is too
    imprecise (LP: #1668382)
    - of/irq: improve error report on irq discovery process failure

  * Zesty update to v4.10.1 stable release (LP: #1668993)
    - ptr_ring: fix race conditions when resizing
    - ip: fix IP_CHECKSUM handling
    - net: socket: fix recvmmsg not returning error from sock_error
    - tty: serial: msm: Fix module autoload
    - USB: serial: mos7840: fix another NULL-deref at open
    - USB: serial: cp210x: add new IDs for GE Bx50v3 boards
    - USB: serial: ftdi_sio: fix modem-status error handling
    - USB: serial: ftdi_sio: fix extreme low-latency setting
    - USB: serial: ftdi_sio: fix line-status over-reporting
    - USB: serial: spcp8x5: fix modem-status handling
    - USB: serial: opticon: fix CTS retrieval at open
    - USB: serial: ark3116: fix register-accessor error handling
    - USB: serial: console: fix uninitialised spinlock
    - x86/platform/goldfish: Prevent unconditional loading
    - goldfish: Sanitize the broken interrupt handler
    - netfilter: nf_ct_helper: warn when not applying default helper assignment
    - ACPICA: Linuxize: Restore and fix Intel compiler build
    - block: fix double-free in the failure path of cgwb_bdi_init()
    - rtlwifi: rtl_usb: Fix for URB leaking when doing ifconfig up/down
    - xfs: clear delalloc and cache on buffered write failure
    - Linux 4.10.1

  * [UBUNTU Zesty] mlx5 - Improve OVS offload driver (LP: #1668019)
    - net/sched: cls_flower: Disallow duplicate internal elements
    - net/sched: cls_flower: Properly handle classifier flags dumping
    - net/sched: cls_matchall: Dump the classifier flags
    - net/sched: Reflect HW offload status
    - net/sched: cls_flower: Reflect HW offload status
    - net/sched: cls_matchall: Reflect HW offloading status
    - net/sched: cls_u32: Reflect HW offload status
    - net/sched: cls_bpf: Reflect HW offload status
    - net/mlx5: Push min-inline mode resolution helper into the core
    - IB/mlx5: Enable Eth VFs to query their min-inline value for user-space
    - net/mlx5: Use exact encap header size for the FW input buffer
    - net/mlx5e: Add TC offloads matching on IPv6 encapsulation headers
    - net/mlx5e: TC ipv4 tunnel encap offload cosmetic changes
    - net/mlx5e: Use the full tunnel key info for encapsulation offload house- keeping
    - net/mlx5e: Maximize ip tunnel key usage on the TC offloading path
    - net/mlx5e: Support SRIOV TC encapsulation offloads for IPv6 tunnels
    - net/mlx5: E-Switch, Enlarge the FDB size for the switchdev mode
    - net/mlx5: Fix static checker warnings

  * [Hyper-V] Ubuntu 14.04.2 LTS Generation 2 SCSI Errors on VSS Based Backups
    (LP: #1470250)
    - SAUCE: Tools: hv: vss: Thaw the filesystem and continue after freeze fails

  * Ubuntu17.04: Need more patches for aacraid to bring up Bost...

Changed in linux (Ubuntu Zesty):
status: Fix Committed → Fix Released
Revision history for this message
Breno Leitão (breno-leitao) wrote :

Tim, we would like to target this bug for Yakkety also, please.

Thanks,
Breno

Revision history for this message
Tim Gardner (timg-tpi) wrote :

Breno - this looks like a really big patchset for Yakkety. 60 patches so far and it still isn't compiling.

In file included from ubuntu-yakkety/arch/powerpc/lib/string.S:14:0:
./arch/powerpc/include/generated/asm/export.h:1:32: fatal error: asm-generic/export.h: No such file or directory
 #include <asm-generic/export.h>

Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2017-03-09 08:09 EDT-------
Hi Tim,

> Breno - this looks like a really big patchset for Yakkety. 60 patches so far
> and it still isn't compiling.

Ok. We are investigating it internally, we should have more news about it soon. Maybe Ranjal can help us to backport it.

Revision history for this message
bugproxy (bugproxy) wrote : 1: powernv:idle: Add IDLE_STATE_ENTER_SEQ_NORET macro

------- Comment on attachment From <email address hidden> 2017-03-10 04:47 EDT-------

Backport of commit 823b7bd5156a ("powernv:idle: Add IDLE_STATE_ENTER_SEQ_NORET macro")

Based on top of commit 57659ec12175e152c0915190b3c430fbd9c1401a ("UBUNTU: Ubuntu-4.8.0-42.45") in git://kernel.ubuntu.com/ubuntu/ubuntu-yakkety.git

Revision history for this message
bugproxy (bugproxy) wrote : 2: powernv:stop: Rename pnv_arch300_idle_init to pnv_power9_idle_init

------- Comment on attachment From <email address hidden> 2017-03-10 04:48 EDT-------

Patch 2 : For Yakkety

 Cherry-picked from upstream commit dd34c74c97b6 ("powernv:stop: Rename pnv_arch300_idle_init to pnv_power9_idle_init")

Revision history for this message
bugproxy (bugproxy) wrote : 3: cpuidle:powernv: Add helper function to populate powernv idle states.

------- Comment on attachment From <email address hidden> 2017-03-10 04:49 EDT-------

For Yakkety.

Cherry-picked from upstream commit 9e9fc6f00a54 ("cpuidle:powernv: Add helper function to populate powernv idle states.)

Revision history for this message
bugproxy (bugproxy) wrote : 4: powernv: Pass PSSCR value and mask to power9_idle_stop

------- Comment on attachment From <email address hidden> 2017-03-10 04:51 EDT-------

For Yakkety

Cherry-picked from upstream commit 09206b600c76 ("powernv: Pass PSSCR value and mask to power9_idle_stop")

Revision history for this message
bugproxy (bugproxy) wrote : 5: Documentation:powerpc: Add device-tree bindings for power-mgt

------- Comment on attachment From <email address hidden> 2017-03-10 04:52 EDT-------

For Yakkety.

Cherry-picked from upstream commit b48ff52043f4 ("Documentation:powerpc: Add device-tree bindings for power-mgt")

Revision history for this message
bugproxy (bugproxy) wrote : 6: powerpc/powernv: Fix bug due to labeling ambiguity in power_enter_stop

------- Comment on attachment From <email address hidden> 2017-03-10 04:53 EDT-------

For Yakkety and Zesty.

Cherry-picked from commit 424f8acd328a ("powerpc/powernv: Fix bug due to labeling ambiguity in power_enter_stop")

Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2017-03-10 05:01 EDT-------
Hi Tim, Breno,

The attached patches in Comment #12 to Comment#17 apply cleanly on the Yakkety kernel git tree with top commit 57659ec12175 ("UBUNTU: Ubuntu-4.8.0-42.45").

Of the six patches, except for Patch 1, the rest of the patches were cherry-picked from their corresponding commits upstream. Cherry-picking Patch 1 "powernv:idle: Add IDLE_STATE_ENTER_SEQ_NORET macro" from the upstream commit 823b7bd5156a ("powernv:idle: Add
IDLE_STATE_ENTER_SEQ_NORET macro") didn't apply cleanly on the Ubuntu tree. So this patch is a backport.

All the six patches compile on the Yakkety tree.

The sixth patch ("powerpc/powernv: Fix bug due to labeling ambiguity in power_enter_stop") is cherry-picked from the upstream commit 424f8acd328a and is a bug fix that needs to be applied to Yakkety as well as Zesty.

Revision history for this message
Tim Gardner (timg-tpi) wrote :

https://lists.ubuntu.com/archives/kernel-team/2017-March/082931.html

I guess that wasn't as hard as I thought. Not sure where I went off into the weeds on my attempts to backport this patch set. Anyway, thanks for doing the heavy lifting. I also applied and pushed to Zesty commit 424f8acd328a .

Changed in linux (Ubuntu Yakkety):
assignee: nobody → Tim Gardner (timg-tpi)
status: New → In Progress
Changed in linux (Ubuntu Yakkety):
status: In Progress → Fix Committed
Revision history for this message
Kleber Sacilotto de Souza (kleber-souza) wrote :

This bug is awaiting verification that the kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-yakkety' to 'verification-done-yakkety'. If the problem still exists, change the tag 'verification-needed-yakkety' to 'verification-failed-yakkety'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: verification-needed-yakkety
bugproxy (bugproxy)
tags: added: verification-done-yakkety
removed: verification-needed-yakkety
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (14.5 KiB)

This bug was fixed in the package linux - 4.8.0-49.52

---------------
linux (4.8.0-49.52) yakkety; urgency=low

  * linux: 4.8.0-49.52 -proposed tracker (LP: #1684427)

  * [Hyper-V] hv: util: move waiting for release to hv_utils_transport itself
    (LP: #1682561)
    - Drivers: hv: util: move waiting for release to hv_utils_transport itself

linux (4.8.0-48.51) yakkety; urgency=low

  * linux: 4.8.0-48.51 -proposed tracker (LP: #1682034)

  * [Hyper-V] hv: vmbus: Raise retry/wait limits in vmbus_post_msg()
    (LP: #1681893)
    - Drivers: hv: vmbus: Raise retry/wait limits in vmbus_post_msg()

linux (4.8.0-47.50) yakkety; urgency=low

  * linux: 4.8.0-47.50 -proposed tracker (LP: #1679678)

  * CVE-2017-6353
    - sctp: deny peeloff operation on asocs with threads sleeping on it

  * CVE-2017-5986
    - sctp: avoid BUG_ON on sctp_wait_for_sndbuf

  * vfat: missing iso8859-1 charset (LP: #1677230)
    - [Config] NLS_ISO8859_1=y

  * [Hyper-V] pci-hyperv: Use device serial number as PCI domain (LP: #1667527)
    - net/mlx4_core: Use cq quota in SRIOV when creating completion EQs

  * Regression: KVM modules should be on main kernel package (LP: #1678099)
    - [Config] powerpc: Add kvm-hv and kvm-pr to the generic inclusion list

  * linux-lts-xenial 4.4.0-63.84~14.04.2 ADT test failure with linux-lts-xenial
    4.4.0-63.84~14.04.2 (LP: #1664912)
    - SAUCE: apparmor: fix link auditing failure due to, uninitialized var

  * regession tests failing after stackprofile test is run (LP: #1661030)
    - SAUCE: fix regression with domain change in complain mode

  * Permission denied and inconsistent behavior in complain mode with 'ip netns
    list' command (LP: #1648903)
    - SAUCE: fix regression with domain change in complain mode

  * unexpected errno=13 and disconnected path when trying to open /proc/1/ns/mnt
    from a unshared mount namespace (LP: #1656121)
    - SAUCE: apparmor: null profiles should inherit parent control flags

  * apparmor refcount leak of profile namespace when removing profiles
    (LP: #1660849)
    - SAUCE: apparmor: fix ns ref count link when removing profiles from policy

  * tor in lxd: apparmor="DENIED" operation="change_onexec"
    namespace="root//CONTAINERNAME_<var-lib-lxd>" profile="unconfined"
    name="system_tor" (LP: #1648143)
    - SAUCE: apparmor: Fix no_new_privs blocking change_onexec when using stacked
      namespaces

  * apparmor oops in bind_mnt when dev_path lookup fails (LP: #1660840)
    - SAUCE: apparmor: fix oops in bind_mnt when dev_path lookup fails

  * apparmor auditing denied access of special apparmor .null fi\ le
    (LP: #1660836)
    - SAUCE: apparmor: Don't audit denied access of special apparmor .null file

  * apparmor label leak when new label is unused (LP: #1660834)
    - SAUCE: apparmor: fix label leak when new label is unused

  * apparmor reference count bug in label_merge_insert() (LP: #1660833)
    - SAUCE: apparmor: fix reference count bug in label_merge_insert()

  * apparmor's raw_data file in securityfs is sometimes truncated (LP: #1638996)
    - SAUCE: apparmor: fix replacement race in reading rawdata

  * unix domain socket cross permission check failing with n...

Changed in linux (Ubuntu Yakkety):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.