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

Re: [PATCH v7 08/10] tools/misc: Add xen-vmtrace tool


  • To: Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 25 Jan 2021 15:30:11 +0000
  • 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=3T61N48GyogQOoSfD/NmhJvoK/5T3siskCClhiMeEIo=; b=ll3cY+xKE0/NNZgVyb+qR+IVj1X8elBOkcf61upcFTIsW6EAYgANlFI5uSIxrxvFHuUtVy6PcHRx9lQ7IuRHqGYl9MYiCIuhoQd0E2qMq6gzKNof0CyPQ8CB47hEpy06pNNmVGDxuTiVbRMO1GJ1WLQ73ts4O5OTpjwWNGVg6liMiP2JuS01+iBBqEkF83OoVjoYLWtccrS46QycdoZOVCEl0gOm6mJsxwKIiZPG1pw6jZLuWGVHy9I3GR/Gy8d6VTzB3IK9CD2NVmNX6fHpBG+7f4Ys0zNhb3Q2ZgDJoW3Y5wGyt3KpEyrV1pIxsG727Pvz1VWLXoz02auMj/i8gA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HKVdNBFMmA9HAl3PT/K8D55pBNhFZpozKlbLL9wL6hE79ATHyrJBFWs5IT/MddghCAjG7/ZU6lgx1EcOMBmWjyFIfNAIDF6kpas/YSWCkC1PLUrLLjd19oftZ71n5kyQZam2XtGLo2l0vhaqzl4GnyZogkNebBJLAI/50esR8ow2RmuOZwHCOU/f55E72eFFlUr8l0noQfbjKtpKTsLwuQJdKuTknNYqTt4zFY92v7KAuLs2cPhOiRWGsNGGKsFIa6o5kwfJrw/CFf14b2vZQ927XF8ToTf0rJKDZWaU+E3eQ/weFfVsxzQ9ZUJ/oaynHAASMGlFW0sfal3gHC1eVA==
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=hardfail (body hash did not verify [final]) header.i=@citrix.onmicrosoft.com
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Michał Leszczyński <michal.leszczynski@xxxxxxx>, Wei Liu <wl@xxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
  • Delivery-date: Mon, 25 Jan 2021 15:30:38 +0000
  • Ironport-sdr: 96c9SwjyNFah8PPL/jXYfbl8Vx4B+gRhpMFvZ20dIorN69naRNIYg5/Fnrn0epdF/R70slo0bj r7i1BbN7qtf4m23SHtjLxQaxohUwnBkvzbalFf1+kcDnkJnThiwFLWk0MxO689YgoSB0u4IPX+ AAnYN4GsTPdDT/gtJjFZEh/z+o8t9x+gYeZDMP7JjXPhwyLGXIR+6zv/aF/igAYwSvFFGOKVW/ UvCi5v6sqBCfBYGCCZfIjk+kDmhwTaAXnFe5klSoN0utiVG+uvfc+k5IJwuyiTJx+rvh9qNJ8N 2wE=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 22/01/2021 15:33, Ian Jackson wrote:
> Andrew Cooper writes ("[PATCH v7 08/10] tools/misc: Add xen-vmtrace tool"):
>> From: Michał Leszczyński <michal.leszczynski@xxxxxxx>
> ...
>> +    if ( signal(SIGINT, int_handler) == SIG_ERR )
>> +        err(1, "Failed to register signal handler\n");
> How bad is it if this signal handler is not effective ?

I believe far less so now that I've fixed up everything to use a (fixed)
XENMEM_acquire_resource, so Xen doesn't crash if this process dies in
the wrong order WRT the domain shutting down.

But I would have to defer to Michał on that.

>> +    if ( xc_vmtrace_disable(xch, domid, vcpu) )
>> +        perror("xc_vmtrace_disable()");
> I guess the tracing will remain on, pointlessly, which has a perf
> impact but nothing else ?

The perf hit is substantial, but it is safe to leave enabled.

> How is it possible for the user to clean this up ?

For now, enable/disable can only fail with -EINVAL for calls made in the
wrong context, so a failure here is benign in practice.

I specifically didn't opt for reference counting the enable/disable
calls, because there cannot (usefully) be two users of this interface.

>
> Also: at the very least, you need to trap SIGTERM SIGHUP SIGPIPE.
>
> It would be good to exit with the right signal by re-raising it.

This is example code, not a production utility.

Anything more production-wise using this needs to account for the fact
that Intel Processor Trace can't pause on a full buffer.  (It ought to
be able to on forthcoming hardware, but this facility isn't available yet.)

The use-cases thus far are always "small delta of execution between
introspection events", using a massive buffer as the mitigation for
hardware wrapping.

No amount of additional code here can prevent stream corruption problems
with the buffer wrapping.  As a result, it is kept as simple as possible
as a demonstration of how to use the API.

~Andrew



 


Rackspace

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