From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PART1 RFC 9/9] svm: Manage vcpu load/unload when enable AVIC Date: Fri, 12 Feb 2016 16:46:44 +0100 Message-ID: <56BDFE63.7010608@redhat.com> References: <1455285574-27892-1-git-send-email-suravee.suthikulpanit@amd.com> <1455285574-27892-10-git-send-email-suravee.suthikulpanit@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wei@redhat.com, sherry.hurwitz@amd.com To: Suravee Suthikulpanit , joro@8bytes.org, alex.williamson@redhat.com, gleb@kernel.org Return-path: In-Reply-To: <1455285574-27892-10-git-send-email-suravee.suthikulpanit@amd.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 12/02/2016 14:59, Suravee Suthikulpanit wrote: > + > + if (is_running) { > + phys_addr_t pa = PFN_PHYS(page_to_pfn(svm->avic_bk_page)); > + > + entry->bk_pg_ptr = (pa >> 12) & 0xffffffffff; > + entry->valid = 1; > + entry->host_phy_apic_id = h_phy_apic_id; > + barrier(); > + entry->is_running = is_running; I'm not sure if you can rely on the compiler doing the right thing here. I would prefer something like: new_entry = READ_ONCE(entry); new_entry.bk_pg_ptr = (pa >> 12) & 0xffffffffff; new_entry.valid = 1; new_entry.host_phy_apic_id = h_phy_apic_id; new_entry.is_running = is_running; WRITE_ONCE(entry, new_entry); Paolo