[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH RFC 2/4] xen: add bitmap to indicate per-domain state changes


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 22 Nov 2021 11:41:41 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=903V5XqFxwppyZ+F1F1M2UDREa8nuIivWzixj+CU9Ic=; b=TZ5x6ut10FipeHCDajwSZLtA6po4EBLHjdwiYAtTz/wCBI8p+HjxAIuQiUwOx51E5iOfLGhZm6KAdJMAwgo82RG/0mgb2JoDpwseMgponhnPLC53EDhOi5wIxhRMdEiaBs1VuP3wT3s9JJ1fTfGlOzeJDHQV9n2BJdFiWzZdQ+/8tYHtVBpLThJ0BRIsqZxhdR+lIjYwguKAeLNNi33xoz8NC9ZzmlH9GPFjoYVxqhU1S3bVMq5f1Yq/RxptZXtiz1wBpvRjtiL+HrNSI58nZHzoSJi3QhOlwHkQpDDsK4eyz3isEnpC+pyqGfIoVEAhU7mKAdzA4CYaxgxmubZOOw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KKCzgL1xlSSPYxBwD56BDKAwjYzUx1mqMtG5i/TEl5NmSuPnw4QPkCzNmzSoo+l2K3X+mr0so1UL9y2OHn0lxWXBml4DtkGtB+oB70aMqWuFRTcy6K4MQogGuX7awGN2hkWV+9shpdG0s8V0uFRGeecyFUscxgOv7SXdRZ4KqY8QTUz7kyY9sbqHGg7mHGM6uIc9IbuWdV6c2V1+rbV9d0s2UJHS6+1Ohw4P0TG2HHf8y91YzYu8x4Gswq02OsrrtGUXbkkeeVNm0VIpk4ZMss4GxsrytjRuGwIAR82Evz4TIM7UqZxFIY4gSMTSPyi81rxxP6RwN4DVHRvsEKqDVA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 22 Nov 2021 10:41:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.09.2021 14:35, Juergen Gross wrote:
> Add a bitmap with one bit per possible domid indicating the respective
> domain has changed its state (created, deleted, dying, crashed,
> shutdown).
> 
> Registering the VIRQ_DOM_EXC event will result in setting the bits for
> all existing domains and resetting all other bits.

Generally I view VIRQ_DOM_EXC as overly restrictive already - what if both
a xenstore domain and a control domain want respective notification? Hence
similarly I'm not convinced a single, global instance will do here. Which
in turn raises the question whether the approach chosen may not take us
far enough, and we wouldn't instead want a more precise notification model
(i.e. not just "something has changed").

> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -87,6 +87,22 @@ bool __read_mostly vmtrace_available;
>  /* Unique domain identifier, protected by domctl lock. */
>  static uint64_t unique_id;
>  
> +static DECLARE_BITMAP(dom_state_changed, DOMID_MASK + 1);

While not really making a difference to the size of the bitmap, afaict up
to DOMID_FIRST_RESERVED would do. Neither system domains nor idle ones
will reach, in particular, the set_bit() in domain_create(). And none of
them can be subject to destruction.

Also I think this could do with a brief comment as to what causes bits
to be set. This would avoid readers having to go hunt down all the
set_bit() (or the commit introducing the bitmap).

> +void domain_reset_states(void)
> +{
> +    struct domain *d;
> +
> +    bitmap_zero(dom_state_changed, DOMID_MASK + 1);

While this looks to be fine with the present updates of the bitmap, I
still wonder about the non-atomicity here vs the atomic updates
everywhere else. It feels like there's some locking needed to be future
proof. Since you come here from VIRQ_DOM_EXC binding, it could be that
domain's per-domain lock.

> @@ -1141,6 +1161,8 @@ static void complete_domain_destroy(struct rcu_head 
> *head)
>  
>      xfree(d->vcpu);
>  
> +    set_bit(d->domain_id, dom_state_changed);
> +
>      _domain_destroy(d);
>  
>      send_global_virq(VIRQ_DOM_EXC);

Wouldn't this better be in domain_destroy() immediately after the domain
has been taken off the list, and hence is no longer "discoverable"?

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.