[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56BDFE63.7010608@redhat.com>
Date: Fri, 12 Feb 2016 16:46:44 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Suravee Suthikulpanit <suravee.suthikulpanit@....com>,
joro@...tes.org, alex.williamson@...hat.com, gleb@...nel.org
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org, wei@...hat.com,
sherry.hurwitz@....com
Subject: Re: [PART1 RFC 9/9] svm: Manage vcpu load/unload when enable AVIC
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
Powered by blists - more mailing lists