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] Re: [PATCH 2/3] xenoprof fixes: active_domains races

To: Markus Armbruster <armbru@xxxxxxxxxx>
Subject: Re: [Xen-devel] Re: [PATCH 2/3] xenoprof fixes: active_domains races
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Tue, 16 May 2006 09:09:01 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 16 May 2006 01:13:55 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <87ac9j19b1.fsf@xxxxxxxxxxxxxxxxx>
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: <87hd3r2qst.fsf@xxxxxxxxxxxxxxxxx> <878xp32qqf.fsf@xxxxxxxxxxxxxxxxx> <87ac9j19b1.fsf@xxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

On 15 May 2006, at 18:34, Markus Armbruster wrote:

The active_domains code has race conditions:

* oprofile_set_active() calls set_active() method without holding
  start_sem.  This is clearly wrong, as xenoprof_set_active() makes
  several hypercalls.  oprofile_start(), for instance, could run in
  the middle of xenoprof_set_active().

* adomain_write(), adomain_read() and xenoprof_set_active() access
  global active_domains[] and adomains without synchronization.  I
  went for a simple, obvious fix and created another mutex.  Instead,
  one could move the shared data into oprof.c and protect it with
  start_sem, but that's more invasive.

Signed-off-by: Markus Armbruster <armbru@xxxxxxxxxx>

Apart from updating to use the new mutex operations, patches 2 and 3 of your submitted set should be applied to patches/linux- (yes, they need to be a patch of patch: sorry about that!). However, feel free to submit one mega-patch that merges both patches into one patch-of-a-patch.

 -- Keir

Xen-devel mailing list