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

Re: [PATCH 03/12] libxenguest: short-circuit "all-dirty" handling


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 25 Jun 2021 18:02:08 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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-SenderADCheck; bh=l2YarMUpOQxZRELYwNTJRw5dWIndo6T3fl3kMbrqguU=; b=fdPqxlTQmvAfBXsHcIudVr1RpLTLIlhrKSS4RPsKQ/WqtIzupxZ3lsuX2D+tNO66np8WkcGzK6eEMvZZbF08P8IfYOKJy0jv01LOXWpO7emaut95kYj5cpS26aYEKgsq00W7EsqyTJ/bncxDmzG6YZKB8hE65luMtkO8MDqtNs+2wjOBpMrnfnYXNa8oprc4tj9rdbucq+H1/AQQJTj925P3Hy0dYYkKWNjyPXH0G/35IT/x8f2Yif0GxsNG/hdgigeN+uDxOBaZ3WRL6WTh6GU3+j5oe5KIsfGYj2LQy9SENXQq7wHnMlqqQoG4heOH4k2tJzcTg93+S6VIKWXikg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bLXR4XcqgvNDjDWErYcOMg5UHMS35Jk5ouQK7OA0JT0zUetQ0+JcoUg/hBAym4sdo1sGPQgJq8VAoibMd9S03v0aHwK/fSSK6ziEdJYeMLHnREBoIh/rT5cjmVcMPQzC2mmRKed/xZHt5VAAyVZnsJYdZ+8997yBIqfDnQgXjUcRXaI2P/GLW7WleZomv0ZHzf81f5WEXbgkWS3pSsaRoFTChdh25dRApMASW5jUnJqcldwy421cKg1DOSEld8xjpLi217+XDpt2ACWCyEU4jv9ppWPOl1rL+2D6VrHevgDJk7e29fgvl0F0xaSPCoIZGNKTLDy4FjhKCQy01t1Oxw==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Fri, 25 Jun 2021 17:10:21 +0000
  • Ironport-hdrordr: A9a23:5HZMDqOG5mIegMBcTyP155DYdb4zR+YMi2TDiHofdfUFSKClfp 6V8cjztSWUtN4QMEtQ/OxoS5PwPk80kqQFnbX5XI3SITUO3VHHEGgM1/qb/9SNIVyYygcZ79 YbT0EcMqyCMbEZt7eC3ODQKb9Jq7PmgcPY8Ns2jU0dKT2CA5sQnzuRYTzrdHGeKjM2Z6bRWK Dsnfau8FGbCAUqh4mAdzY4dtmGg+eOuIPtYBYACRJiwA6SjQmw4Lq/NxSDxB8RXx5G3L9nqA H+4k3Ez5Tml8v+5g7X1mfV4ZgTsNz9yuFbDMjJrsQOMD3jhiuheYwkcbyfuzIepv2p9T8R4Z fxiiZlG/42x2Laf2mzrxeo8RLnyiwS53jrzkLdqWf/oOTiLQhKSfZptMZ8SF/0+kAgtNZz3O ZgxGSCradaChvGgWDU+8XIbRd3jUC5yEBS0tL7t0YvFbf2VYUh6rD2pChuYdE99WPBmcAa+d BVfYThDK08SyLCU5ix1VMfsuBFXRwIb127qwY5y5SoO5U/pgEx86Ii/r1pop43zuN3d3B13Z WxDk1WrsA5ciY3V9MxOA5Te7r6NoTyKSi8eF56dm6Xap3vfUi98KLK3A==
  • Ironport-sdr: 0v8A0RUI265NXxX552RpXsXZyNEd5NTjWYD1t5olAYWEhG6GVGTleHVa0qvLh+YH+qMOmj8cZs NzhEA8k51jYwzbnurvgk3UUCrrmQ8V8BXDCUbU0TLI4ZuK6qony+u29rTAsSMbGI0S/0S9Uia4 i3Iz/XxtQ9jndkkcClMYoimbh9Y/CwjaRp9IV3EFSf6ROvwAtXtUmRwM5EBCO+PUggXFerYs+S dfxOAxKDwFd2juxf52jlBaBdpI7m8YeJ23mvebi7ADJwjvfVRQTxHmrO0fcjdNJ1Q+lWJJI+jU ghs=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 25/06/2021 14:18, Jan Beulich wrote:
> For one it is unnecessary to fill a perhaps large chunk of memory with
> all ones. Add a new parameter to send_dirty_pages() for callers to
> indicate so.
>
> Then it is further unnecessary to allocate the dirty bitmap altogether
> when all that's ever going to happen is a single all-dirty run.

The allocation is deliberate, and does want to stay where it is IMO.

Single all-dirty runs are a debugging technique only.  All production
cases are live, and you don't want to fail midway through because a
late, large, memory allocation failed.


As for the send_{dirty,all}_pages() split, that was deliberate to keep
the logic simple.  The logdirty bitmap is tiny (in comparison to other
structures) outside of artificial cases like this.

What you've done with this change is rendered send_all_pages()
redundant, but not actually taken it out of the code, thereby
complicating it.  At the moment, this doesn't look to be an improvement.

> @@ -807,8 +798,11 @@ static int setup(struct xc_sr_context *c
>      if ( rc )
>          goto err;
>  
> -    dirty_bitmap = xc_hypercall_buffer_alloc_pages(
> -        xch, dirty_bitmap, NRPAGES(bitmap_size(ctx->save.p2m_size)));
> +    dirty_bitmap = ctx->save.live || ctx->stream_type != XC_STREAM_PLAIN
> +        ? xc_hypercall_buffer_alloc_pages(
> +              xch, dirty_bitmap, NRPAGES(bitmap_size(ctx->save.p2m_size)))
> +        : (void *)-1L;

This is a pointer loaded with a timebomb, which doesn't trigger NULL
pointer checks, and for which {set,clear}_bit(dirty_bitmap, large_pfn)
won't fault and will instead corrupt random areas of the address space.

~Andrew




 


Rackspace

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