From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E83BC433E0 for ; Thu, 18 Jun 2020 08:26:29 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06098208DB for ; Thu, 18 Jun 2020 08:26:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06098208DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jlprv-0002LS-29; Thu, 18 Jun 2020 08:25:55 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jlpru-0002LN-Ah for xen-devel@lists.xenproject.org; Thu, 18 Jun 2020 08:25:54 +0000 X-Inumbo-ID: 529870ba-b13d-11ea-bb8b-bc764e2007e4 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 529870ba-b13d-11ea-bb8b-bc764e2007e4; Thu, 18 Jun 2020 08:25:53 +0000 (UTC) Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: aUzc8Ydkiseqfeq4nFLSZUDWWcmloLHuLBYYqBl0Io+PGkCEaQbMmNeBdQRwjcafxXNUqfR/mZ ZoJ2rdDztBdhKLIteYIiVvMYpmxHjxmuUgMYo04zGasWtZpiV7+rRVlV74XpEOqw2VPp6/BsL9 A8RCFf4CipTWeWoIkF0SCJ5QZoa8vPBR1RDuQETD/K8M6rPbY+qxAsVVj1+iFzL4b2gZ/ukF9y b79mynIbqnzHHmt9CPVgF2cSSpLLIBjez+wsAxiP2Ti5fZ1kI+Mc+mj+0Fuz16PL3wK2uE/o3q kug= X-SBRS: 2.7 X-MesageID: 20345651 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.73,526,1583211600"; d="scan'208";a="20345651" Date: Thu, 18 Jun 2020 10:25:39 +0200 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: =?utf-8?Q?Micha=C5=82_Leszczy=C5=84ski?= Subject: Re: [PATCH v1 0/7] Implement support for external IPT monitoring Message-ID: <20200618082539.GE735@Air-de-Roger> References: <1548605014.8764792.1592320576239.JavaMail.zimbra@cert.pl> <1555629278.8787770.1592333278517.JavaMail.zimbra@cert.pl> <6da28899-25ae-7355-fa0a-70fac44f597e@citrix.com> <1348695738.9265003.1592425220928.JavaMail.zimbra@cert.pl> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1348695738.9265003.1592425220928.JavaMail.zimbra@cert.pl> X-ClientProxiedBy: AMSPEX02CAS01.citrite.net (10.69.22.112) To AMSPEX02CL02.citrite.net (10.69.22.126) X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Stefano Stabellini , Julien Grall , Jun Nakajima , Wei Liu , Andrew Cooper , Ian Jackson , George Dunlap , Jan Beulich , Tamas K Lengyel , Xen-devel Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On Wed, Jun 17, 2020 at 10:20:20PM +0200, Michał Leszczyński wrote: > ----- 17 cze 2020 o 18:19, Andrew Cooper andrew.cooper3@citrix.com napisał(a): > > > On 17/06/2020 04:02, Tamas K Lengyel wrote: > >> On Tue, Jun 16, 2020 at 2:17 PM Andrew Cooper wrote: > >>> On 16/06/2020 19:47, Michał Leszczyński wrote: > >>>> ----- 16 cze 2020 o 20:17, Andrew Cooper andrew.cooper3@citrix.com napisał(a): > >>>> > >>>>> Are there any restrictions on EPT being enabled in the first place? I'm > >>>>> not aware of any, and in principle we could use this functionality for > >>>>> PV guests as well (using the CPL filter). Therefore, I think it would > >>>>> be helpful to not tie the functionality to HVM guests, even if that is > >>>>> the only option enabled to start with. > >>>> I think at the moment it's not required to have EPT. This patch series doesn't > >>>> use any translation feature flags, so the output address is always a machine > >>>> physical address, regardless of context. I will check if it could be easily > >>>> used with PV. > >>> If its trivial to add PV support then please do. If its not, then don't > >>> feel obliged, but please do at least consider how PV support might look > >>> in the eventual feature. > >>> > >>> (Generally speaking, considering "how would I make this work in other > >>> modes where it is possible" leads to a better design.) > >>> > >>>>> The buffer mapping and creation logic is fairly problematic. Instead of > >>>>> fighting with another opencoded example, take a look at the IOREQ > >>>>> server's use of "acquire resource" which is a mapping interface which > >>>>> supports allocating memory on behalf of the guest, outside of the guest > >>>>> memory, for use by control tools. > >>>>> > > > One thing that remains unclear to me is the "acquire resource" part. Could you give some more details on that? > > Assuming that buffers are allocated right from the domain creation, what mechanism (instead of xc_map_foreign_range) should I use to map the IPT buffers into Dom0? Take a look at demu's demu_initialize function [0] (and it's usage of xenforeignmemory_map_resource), you likely need something similar for the trace buffers, introducing a new XENMEM_resource_trace_data kind of resource (naming subject to change), and use the id field in xen_mem_acquire_resource to signal which vCPU buffer you want to map. That's usable by both PV and HVM guests. Roger. [0] http://xenbits.xen.org/gitweb/?p=people/pauldu/demu.git;a=blob;f=demu.c;h=f785b394d0cf141dffa05bdddecf338214358aea;hb=refs/heads/master#l453