Re: [PATCH v6 2/4] arm64: KVM: add accessors to track guest/host only counters

2018-12-10 Thread Christoffer Dall
On Mon, Dec 10, 2018 at 11:46:56PM +, Andrew Murray wrote: > On Mon, Dec 10, 2018 at 11:26:34AM +0100, Christoffer Dall wrote: > > On Mon, Dec 10, 2018 at 09:45:57AM +, Andrew Murray wrote: > > > In order to effeciently enable/disable guest/host only perf counters > > > at guest entry/exit

Re: [PATCH v6 0/4] arm64: Support perf event modifiers :G and :H

2018-12-10 Thread Andrew Murray
On Mon, Dec 10, 2018 at 06:19:33PM +, Will Deacon wrote: > Hi Andrew, > > On Mon, Dec 10, 2018 at 09:45:55AM +, Andrew Murray wrote: > > This patchset provides support for perf event modifiers :G and :H which > > allows for filtering of PMU events between host and guests when used > > with

Re: [PATCH v6 2/4] arm64: KVM: add accessors to track guest/host only counters

2018-12-10 Thread Andrew Murray
On Mon, Dec 10, 2018 at 11:26:34AM +0100, Christoffer Dall wrote: > On Mon, Dec 10, 2018 at 09:45:57AM +, Andrew Murray wrote: > > In order to effeciently enable/disable guest/host only perf counters > > at guest entry/exit we add bitfields to kvm_cpu_context for guest and > > host events as we

Re: [PATCH v5 5/7] iommu: Add virtio-iommu driver

2018-12-10 Thread Michael S. Tsirkin
On Mon, Dec 10, 2018 at 03:06:47PM +, Jean-Philippe Brucker wrote: > On 27/11/2018 18:53, Michael S. Tsirkin wrote: > > On Tue, Nov 27, 2018 at 06:10:46PM +, Jean-Philippe Brucker wrote: > >> On 27/11/2018 18:04, Michael S. Tsirkin wrote: > >>> On Tue, Nov 27, 2018 at 05:50:50PM +, Jean

Re: [PATCH v6 04/13] arm64/kvm: hide ptrauth from guests

2018-12-10 Thread Kristina Martsenko
On 10/12/2018 20:22, Richard Henderson wrote: > On 12/10/18 2:12 PM, Kristina Martsenko wrote: >> The plan was to disable trapping, yes. However, after that thread there >> was a retrospective change applied to the architecture, such that the >> XPACLRI (and XPACD/XPACI) instructions are no longer

Re: [PATCH v6 04/13] arm64/kvm: hide ptrauth from guests

2018-12-10 Thread Richard Henderson
On 12/10/18 2:12 PM, Kristina Martsenko wrote: > The plan was to disable trapping, yes. However, after that thread there > was a retrospective change applied to the architecture, such that the > XPACLRI (and XPACD/XPACI) instructions are no longer trapped by > HCR_EL2.API. (The public documentation

Re: [PATCH v6 04/13] arm64/kvm: hide ptrauth from guests

2018-12-10 Thread Kristina Martsenko
On 09/12/2018 14:53, Richard Henderson wrote: > On 12/7/18 12:39 PM, Kristina Martsenko wrote: >> From: Mark Rutland >> >> In subsequent patches we're going to expose ptrauth to the host kernel >> and userspace, but things are a bit trickier for guest kernels. For the >> time being, let's hide ptr

Re: [PATCH v6 02/13] arm64: add pointer authentication register bits

2018-12-10 Thread Kristina Martsenko
On 09/12/2018 14:24, Richard Henderson wrote: > On 12/7/18 12:39 PM, Kristina Martsenko wrote: >> #define SCTLR_ELx_DSSBS (1UL << 44) >> +#define SCTLR_ELx_ENIA (1 << 31) > > 1U or 1UL lest you produce signed -0x8000. Thanks, this was setting all SCTLR bits above 31 as well... Now f

Re: [PATCH v7 22/25] ACPI / APEI: Kick the memory_failure() queue for synchronous errors

2018-12-10 Thread James Morse
Hi Xie XiuQi, On 05/12/2018 02:02, Xie XiuQi wrote: > On 2018/12/4 2:06, James Morse wrote: >> memory_failure() offlines or repairs pages of memory that have been >> discovered to be corrupt. These may be detected by an external >> component, (e.g. the memory controller), and notified via an IRQ.

Re: [PATCH v6 0/4] arm64: Support perf event modifiers :G and :H

2018-12-10 Thread Will Deacon
Hi Andrew, On Mon, Dec 10, 2018 at 09:45:55AM +, Andrew Murray wrote: > This patchset provides support for perf event modifiers :G and :H which > allows for filtering of PMU events between host and guests when used > with KVM. > > As the underlying hardware cannot distinguish between guest an

Re: [PATCH v6 08/13] arm64: expose user PAC bit positions via ptrace

2018-12-10 Thread Catalin Marinas
On Mon, Dec 10, 2018 at 02:29:45PM +, Will Deacon wrote: > On Mon, Dec 10, 2018 at 08:22:06AM -0600, Richard Henderson wrote: > > On 12/10/18 6:03 AM, Catalin Marinas wrote: > > >> However, it won't be too long before someone implements support for > > >> ARMv8.2-LVA, at which point, without ch

Re: [PATCH 00/12] arm64: Paravirtualized time support

2018-12-10 Thread Steven Price
On 10/12/2018 11:40, Mark Rutland wrote: > On Wed, Nov 28, 2018 at 02:45:15PM +, Steven Price wrote: >> This series add support for paravirtualized time for Arm64 guests and >> KVM hosts following the specification in Arm's document DEN 0057A: >> >> https://developer.arm.com/docs/den0057/a >> >

Re: [PATCH 06/12] KVM: arm64: Support Live Physical Time reporting

2018-12-10 Thread Steven Price
On 10/12/2018 10:56, Mark Rutland wrote: > On Wed, Nov 28, 2018 at 02:45:21PM +, Steven Price wrote: >> Provide a method for a guest to derive a paravirtualized counter/timer >> which isn't dependent on the host's counter frequency. This allows a >> guest to be migrated onto a new host which do

Re: [PATCH v5 5/7] iommu: Add virtio-iommu driver

2018-12-10 Thread Jean-Philippe Brucker
On 27/11/2018 18:53, Michael S. Tsirkin wrote: > On Tue, Nov 27, 2018 at 06:10:46PM +, Jean-Philippe Brucker wrote: >> On 27/11/2018 18:04, Michael S. Tsirkin wrote: >>> On Tue, Nov 27, 2018 at 05:50:50PM +, Jean-Philippe Brucker wrote: On 23/11/2018 22:02, Michael S. Tsirkin wrote: >>

Re: [PATCH v6 08/13] arm64: expose user PAC bit positions via ptrace

2018-12-10 Thread Will Deacon
On Mon, Dec 10, 2018 at 08:22:06AM -0600, Richard Henderson wrote: > On 12/10/18 6:03 AM, Catalin Marinas wrote: > >> However, it won't be too long before someone implements support for > >> ARMv8.2-LVA, at which point, without changes to mandatory pointer tagging, > >> we > >> will only have 3 au

Re: [PATCH v6 08/13] arm64: expose user PAC bit positions via ptrace

2018-12-10 Thread Richard Henderson
On 12/10/18 6:03 AM, Catalin Marinas wrote: >> However, it won't be too long before someone implements support for >> ARMv8.2-LVA, at which point, without changes to mandatory pointer tagging, we >> will only have 3 authentication bits: [54:52]. This seems useless and easily >> brute-force-able. >

Re: [PATCH 05/12] KVM: arm64: Implement PV_FEATURES call

2018-12-10 Thread Steven Price
On 10/12/2018 10:39, Mark Rutland wrote: > On Wed, Nov 28, 2018 at 02:45:20PM +, Steven Price wrote: >> This provides a mechanism for querying which paravirtualized features >> are available in this hypervisor. >> >> Also add the header file which defines the ABI for the paravirtualized >> cloc

Re: [PATCH 03/12] arm/arm64: Provide a wrapper for SMCCC 1.1 calls

2018-12-10 Thread Steven Price
On 10/12/2018 10:27, Mark Rutland wrote: > On Wed, Nov 28, 2018 at 02:45:18PM +, Steven Price wrote: >> SMCCC 1.1 calls may use either HVC or SMC depending on the PSCI >> conduit. Rather than coding this in every call site provide a macro >> which uses the correct instruction. The macro also ha

Re: KVM arm realtime performance optimization

2018-12-10 Thread Christoffer Dall
On Mon, Dec 10, 2018 at 05:36:09AM +, Steven Miao (Arm Technology China) wrote: > > From: kvmarm-boun...@lists.cs.columbia.edu > On Behalf Of Steven Miao (Arm > Technology China) > Sent: Thursday, December 6, 2018 3:05 PM > To: kvmarm@lists.cs.columbia.edu > Subject: KVM arm realtime perfo

Re: [PATCH] kvm/arm: return 0 when the number of objects is not lessthan min

2018-12-10 Thread Christoffer Dall
On Thu, Dec 06, 2018 at 09:56:30AM +0800, peng.h...@zte.com.cn wrote: > >On Wed, Dec 05, 2018 at 09:15:51AM +0800, Peng Hao wrote: > >> Return 0 when there is enough kvm_mmu_memory_cache object. > >> > >> Signed-off-by: Peng Hao > >> --- > >> virt/kvm/arm/mmu.c | 2 +- > >> 1 file changed, 1 inse

Re: [PATCH v3 2/8] KVM: arm64: Rework detection of SVE, !VHE systems

2018-12-10 Thread Will Deacon
On Mon, Dec 10, 2018 at 10:28:05AM +, Marc Zyngier wrote: > On 10/12/2018 10:13, Christoffer Dall wrote: > > On Thu, Dec 06, 2018 at 05:31:20PM +, Marc Zyngier wrote: > >> diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c > >> index 23774970c9df..1db4c15edcdd 100644 > >> --- a/virt/kvm/a

Re: [PATCH v6 08/13] arm64: expose user PAC bit positions via ptrace

2018-12-10 Thread Catalin Marinas
On Sun, Dec 09, 2018 at 09:41:31AM -0600, Richard Henderson wrote: > On 12/7/18 12:39 PM, Kristina Martsenko wrote: > > When pointer authentication is in use, data/instruction pointers have a > > number of PAC bits inserted into them. The number and position of these > > bits depends on the configu

Re: [PATCH v3 7/8] arm64: KVM: Handle ARM erratum 1165522 in TLB invalidation

2018-12-10 Thread Christoffer Dall
On Mon, Dec 10, 2018 at 11:15:00AM +, James Morse wrote: > Hi Marc, Christoffer, > > On 10/12/2018 10:46, Marc Zyngier wrote: > > On 10/12/2018 10:19, Christoffer Dall wrote: > >> On Thu, Dec 06, 2018 at 05:31:25PM +, Marc Zyngier wrote: > >>> In order to avoid TLB corruption whilst invali

Re: [PATCH 00/12] arm64: Paravirtualized time support

2018-12-10 Thread Mark Rutland
On Wed, Nov 28, 2018 at 02:45:15PM +, Steven Price wrote: > This series add support for paravirtualized time for Arm64 guests and > KVM hosts following the specification in Arm's document DEN 0057A: > > https://developer.arm.com/docs/den0057/a > > It implements support for Live Physical Time

Re: [PATCH v3 7/8] arm64: KVM: Handle ARM erratum 1165522 in TLB invalidation

2018-12-10 Thread James Morse
Hi Marc, Christoffer, On 10/12/2018 10:46, Marc Zyngier wrote: > On 10/12/2018 10:19, Christoffer Dall wrote: >> On Thu, Dec 06, 2018 at 05:31:25PM +, Marc Zyngier wrote: >>> In order to avoid TLB corruption whilst invalidating TLBs on CPUs >>> affected by erratum 1165522, we need to prevent S

Re: [PATCH v9 1/8] KVM: arm/arm64: Share common code in user_mem_abort()

2018-12-10 Thread Christoffer Dall
On Mon, Dec 10, 2018 at 10:47:42AM +, Suzuki K Poulose wrote: > > > On 10/12/2018 08:56, Christoffer Dall wrote: > >On Mon, Dec 03, 2018 at 01:37:37PM +, Suzuki K Poulose wrote: > >>Hi Anshuman, > >> > >>On 03/12/2018 12:11, Anshuman Khandual wrote: > >>> > >>> > >>>On 10/31/2018 11:27 PM

Re: [PATCH 06/12] KVM: arm64: Support Live Physical Time reporting

2018-12-10 Thread Mark Rutland
On Wed, Nov 28, 2018 at 02:45:21PM +, Steven Price wrote: > Provide a method for a guest to derive a paravirtualized counter/timer > which isn't dependent on the host's counter frequency. This allows a > guest to be migrated onto a new host which doesn't have the same > frequency without the vi

Re: [PATCH v3 1/8] arm64: KVM: Make VHE Stage-2 TLB invalidation operations non-interruptible

2018-12-10 Thread Christoffer Dall
On Mon, Dec 10, 2018 at 10:24:31AM +, Marc Zyngier wrote: > Hi Christoffer, > > On 10/12/2018 10:03, Christoffer Dall wrote: > > On Thu, Dec 06, 2018 at 05:31:19PM +, Marc Zyngier wrote: > >> Contrary to the non-VHE version of the TLB invalidation helpers, the VHE > >> code has interrupts

Re: [PATCH v9 1/8] KVM: arm/arm64: Share common code in user_mem_abort()

2018-12-10 Thread Suzuki K Poulose
On 10/12/2018 08:56, Christoffer Dall wrote: On Mon, Dec 03, 2018 at 01:37:37PM +, Suzuki K Poulose wrote: Hi Anshuman, On 03/12/2018 12:11, Anshuman Khandual wrote: On 10/31/2018 11:27 PM, Punit Agrawal wrote: The code for operations such as marking the pfn as dirty, and dcache/icac

Re: [PATCH v3 7/8] arm64: KVM: Handle ARM erratum 1165522 in TLB invalidation

2018-12-10 Thread Marc Zyngier
On 10/12/2018 10:19, Christoffer Dall wrote: > On Thu, Dec 06, 2018 at 05:31:25PM +, Marc Zyngier wrote: >> In order to avoid TLB corruption whilst invalidating TLBs on CPUs >> affected by erratum 1165522, we need to prevent S1 page tables >> from being usable. >> >> For this, we set the EL1 S1

Re: [PATCH 05/12] KVM: arm64: Implement PV_FEATURES call

2018-12-10 Thread Mark Rutland
On Wed, Nov 28, 2018 at 02:45:20PM +, Steven Price wrote: > This provides a mechanism for querying which paravirtualized features > are available in this hypervisor. > > Also add the header file which defines the ABI for the paravirtualized > clock features we're about to add. > > Signed-off-

Re: [PATCH v3 2/8] KVM: arm64: Rework detection of SVE, !VHE systems

2018-12-10 Thread Marc Zyngier
On 10/12/2018 10:13, Christoffer Dall wrote: > On Thu, Dec 06, 2018 at 05:31:20PM +, Marc Zyngier wrote: >> An SVE system is so far the only case where we mandate VHE. As we're >> starting to grow this requirements, let's slightly rework the way we >> deal with that situation, allowing for easy

Re: [PATCH 03/12] arm/arm64: Provide a wrapper for SMCCC 1.1 calls

2018-12-10 Thread Mark Rutland
On Wed, Nov 28, 2018 at 02:45:18PM +, Steven Price wrote: > SMCCC 1.1 calls may use either HVC or SMC depending on the PSCI > conduit. Rather than coding this in every call site provide a macro > which uses the correct instruction. The macro also handles the case > where no PSCI conduit is conf

Re: [PATCH v9 1/8] KVM: arm/arm64: Share common code in user_mem_abort()

2018-12-10 Thread Suzuki K Poulose
On 10/12/2018 08:56, Christoffer Dall wrote: On Mon, Dec 03, 2018 at 01:37:37PM +, Suzuki K Poulose wrote: Hi Anshuman, On 03/12/2018 12:11, Anshuman Khandual wrote: On 10/31/2018 11:27 PM, Punit Agrawal wrote: The code for operations such as marking the pfn as dirty, and dcache/icac

Re: [PATCH v6 2/4] arm64: KVM: add accessors to track guest/host only counters

2018-12-10 Thread Christoffer Dall
On Mon, Dec 10, 2018 at 09:45:57AM +, Andrew Murray wrote: > In order to effeciently enable/disable guest/host only perf counters > at guest entry/exit we add bitfields to kvm_cpu_context for guest and > host events as well as accessors for updating them. > > Signed-off-by: Andrew Murray > --

Re: [PATCH v3 1/8] arm64: KVM: Make VHE Stage-2 TLB invalidation operations non-interruptible

2018-12-10 Thread Marc Zyngier
Hi Christoffer, On 10/12/2018 10:03, Christoffer Dall wrote: > On Thu, Dec 06, 2018 at 05:31:19PM +, Marc Zyngier wrote: >> Contrary to the non-VHE version of the TLB invalidation helpers, the VHE >> code has interrupts enabled, meaning that we can take an interrupt in >> the middle of such a

Re: [PATCH v3 7/8] arm64: KVM: Handle ARM erratum 1165522 in TLB invalidation

2018-12-10 Thread Christoffer Dall
On Thu, Dec 06, 2018 at 05:31:25PM +, Marc Zyngier wrote: > In order to avoid TLB corruption whilst invalidating TLBs on CPUs > affected by erratum 1165522, we need to prevent S1 page tables > from being usable. > > For this, we set the EL1 S1 MMU on, and also disable the page table > walker (

Re: [PATCH v3 6/8] arm64: KVM: Add synchronization on translation regime change for erratum 1165522

2018-12-10 Thread Christoffer Dall
On Thu, Dec 06, 2018 at 05:31:24PM +, Marc Zyngier wrote: > In order to ensure that slipping HCR_EL2.TGE is done at the right > time when switching translation regime, let insert the required ISBs > that will be patched in when erratum 1165522 is detected. > > Take this opportunity to add the

Re: [PATCH v3 3/8] arm64: KVM: Install stage-2 translation before enabling traps

2018-12-10 Thread Christoffer Dall
On Thu, Dec 06, 2018 at 05:31:21PM +, Marc Zyngier wrote: > It is a bit odd that we only install stage-2 translation after having > cleared HCR_EL2.TGE, which means that there is a window during which > AT requests could fail as stage-2 is not configured yet. > > Let's move stage-2 configurati

Re: [PATCH v3 2/8] KVM: arm64: Rework detection of SVE, !VHE systems

2018-12-10 Thread Christoffer Dall
On Thu, Dec 06, 2018 at 05:31:20PM +, Marc Zyngier wrote: > An SVE system is so far the only case where we mandate VHE. As we're > starting to grow this requirements, let's slightly rework the way we > deal with that situation, allowing for easy extension of this check. > > Signed-off-by: Marc

Re: [PATCH v3 1/8] arm64: KVM: Make VHE Stage-2 TLB invalidation operations non-interruptible

2018-12-10 Thread Christoffer Dall
On Thu, Dec 06, 2018 at 05:31:19PM +, Marc Zyngier wrote: > Contrary to the non-VHE version of the TLB invalidation helpers, the VHE > code has interrupts enabled, meaning that we can take an interrupt in > the middle of such a sequence, and start running something else with > HCR_EL2.TGE clea

[PATCH v6 0/4] arm64: Support perf event modifiers :G and :H

2018-12-10 Thread Andrew Murray
This patchset provides support for perf event modifiers :G and :H which allows for filtering of PMU events between host and guests when used with KVM. As the underlying hardware cannot distinguish between guest and host context, the performance counters must be stopped and started upon entry/exit

[PATCH v6 3/4] arm64: arm_pmu: Add support for exclude_host/exclude_guest attributes

2018-12-10 Thread Andrew Murray
Add support for the :G and :H attributes in perf by handling the exclude_host/exclude_guest event attributes. We notify KVM of counters that we wish to be enabled or disabled on guest entry/exit and thus defer from starting or stopping :G events as per the events exclude_host attribute. With both

[PATCH v6 4/4] arm64: KVM: Enable support for :G/:H perf event modifiers

2018-12-10 Thread Andrew Murray
Enable/disable event counters as appropriate when entering and exiting the guest to enable support for guest or host only event counting. For both VHE and non-VHE we switch the counters between host/guest at EL2. EL2 is filtered out by the PMU when we are using the :G modifier. The PMU may be on

[PATCH v6 1/4] arm64: arm_pmu: remove unnecessary isb instruction

2018-12-10 Thread Andrew Murray
The armv8pmu_enable_event_counter function issues an isb instruction after enabling a pair of counters - this doesn't provide any value and is inconsistent with the armv8pmu_disable_event_counter. In any case armv8pmu_enable_event_counter is always called with the PMU stopped. Starting the PMU wit

[PATCH v6 2/4] arm64: KVM: add accessors to track guest/host only counters

2018-12-10 Thread Andrew Murray
In order to effeciently enable/disable guest/host only perf counters at guest entry/exit we add bitfields to kvm_cpu_context for guest and host events as well as accessors for updating them. Signed-off-by: Andrew Murray --- arch/arm64/include/asm/kvm_host.h | 24 1 file

Re: [PATCH v9 5/8] KVM: arm64: Support PUD hugepage in stage2_is_exec()

2018-12-10 Thread Christoffer Dall
On Wed, Dec 05, 2018 at 05:57:51PM +, Suzuki K Poulose wrote: > > > On 01/11/2018 13:38, Christoffer Dall wrote: > >On Wed, Oct 31, 2018 at 05:57:42PM +, Punit Agrawal wrote: > >>In preparation for creating PUD hugepages at stage 2, add support for > >>detecting execute permissions on PUD

Re: [PATCH v9 3/8] KVM: arm/arm64: Introduce helpers to manipulate page table entries

2018-12-10 Thread Christoffer Dall
On Mon, Dec 03, 2018 at 07:20:08PM +0530, Anshuman Khandual wrote: > > > On 10/31/2018 11:27 PM, Punit Agrawal wrote: > > Introduce helpers to abstract architectural handling of the conversion > > of pfn to page table entries and marking a PMD page table entry as a > > block entry. > > Why is th

Re: [PATCH v9 2/8] KVM: arm/arm64: Re-factor setting the Stage 2 entry to exec on fault

2018-12-10 Thread Christoffer Dall
On Wed, Dec 05, 2018 at 10:47:10AM +, Suzuki K Poulose wrote: > > > On 03/12/2018 13:32, Anshuman Khandual wrote: > > > > > >On 10/31/2018 11:27 PM, Punit Agrawal wrote: > >>Stage 2 fault handler marks a page as executable if it is handling an > >>execution fault or if it was a permission fau

Re: [PATCH v9 2/8] KVM: arm/arm64: Re-factor setting the Stage 2 entry to exec on fault

2018-12-10 Thread Christoffer Dall
On Mon, Dec 03, 2018 at 07:02:23PM +0530, Anshuman Khandual wrote: > > > On 10/31/2018 11:27 PM, Punit Agrawal wrote: > > Stage 2 fault handler marks a page as executable if it is handling an > > execution fault or if it was a permission fault in which case the > > executable bit needs to be pres

Re: [PATCH v9 1/8] KVM: arm/arm64: Share common code in user_mem_abort()

2018-12-10 Thread Christoffer Dall
On Mon, Dec 03, 2018 at 01:37:37PM +, Suzuki K Poulose wrote: > Hi Anshuman, > > On 03/12/2018 12:11, Anshuman Khandual wrote: > > > > > >On 10/31/2018 11:27 PM, Punit Agrawal wrote: > >>The code for operations such as marking the pfn as dirty, and > >>dcache/icache maintenance during stage 2