Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755190AbdLOJJR (ORCPT ); Fri, 15 Dec 2017 04:09:17 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52102 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755161AbdLOJJJ (ORCPT ); Fri, 15 Dec 2017 04:09:09 -0500 Subject: Re: [PATCH] KVM: arm/arm64: don't set vtimer->cnt_ctl in kvm_arch_timer_handler To: Jia He , Christoffer Dall Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, Jia He References: <1513148407-2611-1-git-send-email-hejianet@gmail.com> <20171213091803.GQ910@cbox> <20171214130954.GV910@cbox> <5615f3e1-756e-0537-f0b6-20ae8626ac87@gmail.com> <20171214154518.GX910@cbox> From: Marc Zyngier Organization: ARM Ltd Message-ID: <519f0e33-4419-68be-32b4-11bb5e19cf17@arm.com> Date: Fri, 15 Dec 2017 09:09:05 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1009 Lines: 32 On 15/12/17 02:27, Jia He wrote: > > [...] >> @@ -367,6 +368,7 @@ static void vtimer_save_state(struct kvm_vcpu *vcpu) >> >> /* Disable the virtual timer */ >> write_sysreg_el0(0, cntv_ctl); >> + isb(); > My only concern is whether this isb() is required here? > Sorryif this is a stupid question.I understand little about arm arch > memory barrier. But seems isb will flush all the instruction prefetch.Do > you think if an timer interrupt irq arrives, arm will use the previous > instruction prefetch? This barrier has little to do with prefetch. It just guarantees that the code after the isb() is now running with a disabled virtual timer. Otherwise, a CPU can freely reorder the write_sysreg() until the next context synchronization event. An interrupt coming between the write and the barrier will also act as a context synchronization event. For more details, see the ARMv8 ARM (the glossary has a section on the concept). Thanks, M. -- Jazz is not dead. It just smells funny...