This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] [PATCH] add support for XCHG instruction accessing APIC

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] add support for XCHG instruction accessing APIC
From: Boris Ostrovsky <bostrovsky@xxxxxxxxxxxxxxx>
Date: Wed, 05 Apr 2006 10:01:24 -0400
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 05 Apr 2006 07:02:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <93eed1ff132a9eaf49f74dd3c8d57f5b@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4432E412.1010200@xxxxxxxxxxxxxxx> <d43f9d2296eda37cc78c872788f160d8@xxxxxxxxxxxx> <93eed1ff132a9eaf49f74dd3c8d57f5b@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050716)
Keir Fraser wrote:

On 5 Apr 2006, at 10:50, Keir Fraser wrote:

32-bit SMP Linux uses xchg instruction to access APIC (see
apic_write_atomic()). Attached is patch that adds support for
this instruction.

The patch also fixes missed dependencies (in xen/Rules.mk) on
header files in include/asm-x86/hvm.

I wonder if it is worth adding the locking? xchg is only used to write to broken APICs -- the OS does not care about the returned value. The APIC is implemented entirely in Xen, so the lock isn't held across an ioreq round-trip to qemu-dm, right?

Yes, that's right --- we never leave Xen to handle APIC access.

In fact I'm pretty sure the locking is not needed even if we did care about atomicity. You're only protecting guest accesses from other guest accesses, and each VCPU has its own local APIC model, so there cannot be multiple simultaneous guest accesses to a single local APIC.

My only argument in favor of using the lock would be for completeness of the emulation. You are absolutely right in that for Linux there seems to be no need to hold the lock. My concern is that other OSs may treat this differently. And if we don't have sources, it may be somewhat difficult to figure out that the atomicity (or lack of it) was the cause of a problem.

If, however, there is a strong feeling that we don't need the lock, I am happy to drop it. I guess you are mostly unhappy about adding a new field to hvm_domain, not about performance


Xen-devel mailing list