[Hyper-V] x86/hyperv: Stop suppressing X86_FEATURE_PCID

Bug #1745247 reported by Joshua R. Poulson
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linux
Confirmed
Undecided
Unassigned
linux (Ubuntu)
New
Undecided
Unassigned
Trusty
Invalid
Undecided
Marcelo Cerri
Xenial
Invalid
Undecided
Marcelo Cerri
Artful
Invalid
Undecided
Marcelo Cerri
linux-azure (Ubuntu)
New
Undecided
Unassigned
Xenial
Fix Released
Undecided
Marcelo Cerri
linux-azure-edge (Ubuntu)
New
Undecided
Unassigned
Xenial
Fix Committed
Undecided
Marcelo Cerri

Bug Description

Anywhere where Meltdown fixes have gone in have likely also picked up upstream work on TLB flushes. This is an important performance change.

x86/hyperv: Stop suppressing X86_FEATURE_PCIDx86/hyperv

When hypercall-based TLB flush was enabled for Hyper-V guests PCID feature
was deliberately suppressed as a precaution: back then PCID was never
exposed to Hyper-V guests and it wasn't clear what will happen if some day
it becomes available. The day came and PCID/INVPCID features are already
exposed on certain Hyper-V hosts.

From TLFS (as of 5.0b) it is unclear how TLB flush hypercalls combine with
PCID. In particular the usage of PCID is per-cpu based: the same mm gets
different CR3 values on different CPUs. If the hypercall does exact
matching this will fail. However, this is not the case. David Zhang
explains:

 "In practice, the AddressSpace argument is ignored on any VM that supports
  PCIDs.

  Architecturally, the AddressSpace argument must match the CR3 with PCID
  bits stripped out (i.e., the low 12 bits of AddressSpace should be 0 in
  long mode). The flush hypercalls flush all PCIDs for the specified
  AddressSpace."

With this, PCID can be enabled.

Upstream commit link: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=04651dd978a8749e59065df14b970a127f219ac2

Joshua R. Poulson (jrp)
Changed in linux-lts-vivid (Ubuntu):
status: New → Confirmed
Changed in linux:
status: New → Confirmed
Joshua R. Poulson (jrp)
Changed in linux-lts-xenial (Ubuntu):
status: New → Confirmed
Revision history for this message
Marcelo Cerri (mhcerri) wrote :

Josh. Is that intended to be included in both the custom kernels as well in the regular kernels?

Revision history for this message
Marcelo Cerri (mhcerri) wrote :
Revision history for this message
Joshua R. Poulson (jrp) wrote :

Anywhere where you've patched for Meltdown. If PCID is not visible to the guest, there's a TLB flush on every syscall, even when it's not necessary.

Revision history for this message
Marcelo Cerri (mhcerri) wrote :

Will this patch land for 4.15? Otherwise I will include it to bionic too.

no longer affects: linux-azure (Ubuntu Trusty)
no longer affects: linux-azure (Ubuntu Artful)
no longer affects: linux-azure-edge (Ubuntu Trusty)
no longer affects: linux-azure-edge (Ubuntu Artful)
Marcelo Cerri (mhcerri)
no longer affects: linux-lts-xenial (Ubuntu Artful)
no longer affects: linux-lts-vivid (Ubuntu Artful)
no longer affects: linux-lts-vivid (Ubuntu)
no longer affects: linux-lts-vivid (Ubuntu Trusty)
no longer affects: linux-lts-vivid (Ubuntu Xenial)
no longer affects: linux-lts-xenial (Ubuntu Xenial)
no longer affects: linux-lts-xenial (Ubuntu Trusty)
no longer affects: linux-lts-xenial (Ubuntu)
Marcelo Cerri (mhcerri)
no longer affects: linux-azure (Ubuntu Trusty)
no longer affects: linux-azure (Ubuntu Artful)
no longer affects: linux-azure-edge (Ubuntu Trusty)
no longer affects: linux-azure-edge (Ubuntu Artful)
Changed in linux-azure (Ubuntu Xenial):
status: New → Fix Committed
Revision history for this message
Marcelo Cerri (mhcerri) wrote :

Xenial and trusty kernels do not support TLB flush via Hyper-V hypercalls, thus the fix is not necessary on those kernels.

Changed in linux (Ubuntu Trusty):
status: New → In Progress
Changed in linux (Ubuntu Xenial):
status: New → In Progress
Changed in linux (Ubuntu Artful):
status: New → In Progress
Changed in linux (Ubuntu Trusty):
assignee: nobody → Marcelo Cerri (mhcerri)
Changed in linux (Ubuntu Xenial):
assignee: nobody → Marcelo Cerri (mhcerri)
Changed in linux (Ubuntu Artful):
assignee: nobody → Marcelo Cerri (mhcerri)
Changed in linux-azure (Ubuntu Xenial):
assignee: nobody → Marcelo Cerri (mhcerri)
Changed in linux-azure-edge (Ubuntu Xenial):
assignee: nobody → Marcelo Cerri (mhcerri)
Changed in linux (Ubuntu Trusty):
status: In Progress → Invalid
Changed in linux (Ubuntu Xenial):
status: In Progress → Invalid
Revision history for this message
Marcelo Cerri (mhcerri) wrote :

The same is true for artful.

Changed in linux (Ubuntu Artful):
status: In Progress → Invalid
Changed in linux-azure-edge (Ubuntu Xenial):
status: New → In Progress
Marcelo Cerri (mhcerri)
Changed in linux-azure-edge (Ubuntu Xenial):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux-azure - 4.13.0-1009.12

---------------
linux-azure (4.13.0-1009.12) xenial; urgency=low

  * linux-azure: 4.13.0-1009.12 -proposed tracker (LP: #1746726)

  * libata: apply MAX_SEC_1024 to all LITEON EP1 series devices (LP: #1743053)
    - libata: apply MAX_SEC_1024 to all LITEON EP1 series devices

linux-azure (4.13.0-1008.11) xenial; urgency=low

  * linux-azure: 4.13.0-1008.11 -proposed tracker (LP: #1745669)

  * [Hyper-V] x86/hyperv: Stop suppressing X86_FEATURE_PCID (LP: #1745247)
    - x86/hyperv: Stop suppressing X86_FEATURE_PCID

  * [Hyper-V] scsi: storvsc: Spread interrupts when picking a channel for I/O
    requests (LP: #1745260)
    - SAUCE: scsi: storvsc: Spread interrupts when picking a channel for I/O
      requests

  * [Hyper-V] scsi: storvsc: Increase cmd_per_lun for higher speed devices
    (LP: #1745261)
    - SAUCE: scsi: storvsc: Increase cmd_per_lun for higher speed devices
    - [Config] CONFIG_SCSI_MQ_DEFAULT=y

 -- Marcelo Henrique Cerri <email address hidden> Thu, 01 Feb 2018 11:13:09 -0200

Changed in linux-azure (Ubuntu Xenial):
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.