From: Tim Deegan Subject: Re: [PATCH] v2 (Re: cs:21768 causes guest spend more time on boot up) Date: Thu, 22 Jul 2010 14:41:03 +0100 Message-ID: <20100722134103.GO13291@whitby.uk.xensource.com> References: <5D8008F58939784290FAB48F549751981D10D5893E@shsmsx502.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: "Zhang, Yang Z" , "Zhang, Jianwu" , "xen-devel@lists.xensource.com" , "Xu, Jiajun" List-Id: xen-devel@lists.xenproject.org At 14:20 +0100 on 22 Jul (1279808457), Keir Fraser wrote: > I suggest to try zapping the entire shared-info page when hvmloader > finishes. There is nothing in there that is useful to keep across hvmloader > and guest OS; zapping will ensure that other flags with rising-edge > semantics such as per-vcpu evtchn selector words get reset; and doing > anything more than zeroing is pointless since e.g., the evtchn_mask array > offset and size is dependent on whether the guest OS is 32-bit or 64-bit. If > hvmloader were to set the mask to all 1s and then boot a 64-bit guest, the > rearranged shared_info would actually mean that hvmloader has set 1s in part > of the 64-bit extended evtchn_pending array! Good point. That seems to do the trick. hvmloader: clear the whole shared-info page when shutting down xenbus since the contents might be in the wrong word-size for later users. Signed-off-by: Tim Deegan diff -r e8dbc1262f52 tools/firmware/hvmloader/xenbus.c --- a/tools/firmware/hvmloader/xenbus.c Wed Jul 21 09:02:10 2010 +0100 +++ b/tools/firmware/hvmloader/xenbus.c Thu Jul 22 14:39:28 2010 +0100 @@ -63,9 +63,8 @@ void xenbus_shutdown(void) * having used the rings. */ memset(rings, 0, sizeof *rings); - /* Clear the xenbus event-channel too */ - get_shared_info()->evtchn_pending[event / sizeof (unsigned long)] - &= ~(1UL << ((event % sizeof (unsigned long)))); + /* Clear the event-channel state too. */ + memset(get_shared_info(), 0, PAGE_SIZE); rings = NULL; }