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=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 40F93C433EB for ; Wed, 15 Jul 2020 15:09:11 +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 119B02065D for ; Wed, 15 Jul 2020 15:09:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="Qrmj0HvN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 119B02065D 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 1jvj1l-0002ne-8Z; Wed, 15 Jul 2020 15:08:57 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jvj1j-0002nX-OT for xen-devel@lists.xenproject.org; Wed, 15 Jul 2020 15:08:55 +0000 X-Inumbo-ID: 19262482-c6ad-11ea-bca7-bc764e2007e4 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 19262482-c6ad-11ea-bca7-bc764e2007e4; Wed, 15 Jul 2020 15:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1594825736; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=UkLPCuhQ/WsRka3FdyCpuF4/kTgr19gqQgiD7k0GE20=; b=Qrmj0HvNwqJMCOK7yHJUUtdaj/uHV4/MbbRwfU1flv7US2RV6vG31x1U 5lgUFERFXxFUlL672LQab0c17yKXzKYTXxy/gypkEDvpMsY+fi9/7Qnob 9lFqFLJ0k1egpa6jWBXxubt4Pu+/KLJoUKImO34q8NZnFSr21c2Z1PlZe I=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: fJ1kjlxO2FthyXKxezrLDLEPdr3FBerqSF8kS3NqyqKXs0egrj8AWWYk5WZ30G1heLDvTMglDT sfxnBK2Ag+sPLRo98u7JwisWG5X5xHCSuavWq8W64WGIgbeC3FpHhNF9nxVexQFYYQSsWuXYkH i5C6KiQFF0SqpjHnfXUYcoGD7ntWhGoW9QnMjfLYCUDuxVUAWkPi3VvW3y6Q0hhmWpM6eJNm4I ++ySy62Z9iAqB5wdiEO0UbDYzvTjbXkBMTg5zQDgQXMApcoG612mgyLG1YQsCNHQLoEpNY90bd Y3A= X-SBRS: 2.7 X-MesageID: 22449146 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.75,355,1589256000"; d="scan'208";a="22449146" Date: Wed, 15 Jul 2020 17:08:46 +0200 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: =?utf-8?Q?Micha=C5=82_Leszczy=C5=84ski?= Subject: Re: [PATCH v6 04/11] common: add vmtrace_pt_size domain parameter Message-ID: <20200715150846.GB7191@Air-de-Roger> References: <036bc768bfb074269d9bd4530304a11170b7142d.1594150543.git.michal.leszczynski@cert.pl> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <036bc768bfb074269d9bd4530304a11170b7142d.1594150543.git.michal.leszczynski@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: Julien Grall , Stefano Stabellini , tamas.lengyel@intel.com, Wei Liu , Andrew Cooper , Ian Jackson , George Dunlap , luwei.kang@intel.com, Jan Beulich , xen-devel@lists.xenproject.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On Tue, Jul 07, 2020 at 09:39:43PM +0200, Michał Leszczyński wrote: > From: Michal Leszczynski > > Add vmtrace_pt_size domain parameter in live domain and > vmtrace_pt_order parameter in xen_domctl_createdomain. > > Signed-off-by: Michal Leszczynski > --- > xen/arch/x86/domain.c | 6 ++++++ > xen/common/domain.c | 9 +++++++++ > xen/include/public/domctl.h | 1 + > xen/include/xen/sched.h | 3 +++ > 4 files changed, 19 insertions(+) > > diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c > index fee6c3931a..b75017b28b 100644 > --- a/xen/arch/x86/domain.c > +++ b/xen/arch/x86/domain.c > @@ -499,6 +499,12 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config) > */ > config->flags |= XEN_DOMCTL_CDF_oos_off; > > + if ( !hvm && config->processor_trace_buf_kb ) > + { > + dprintk(XENLOG_INFO, "Processor trace is not supported on non-HVM\n"); > + return -EINVAL; > + } > + > return 0; > } > > diff --git a/xen/common/domain.c b/xen/common/domain.c > index a45cf023f7..e6e8f88da1 100644 > --- a/xen/common/domain.c > +++ b/xen/common/domain.c > @@ -338,6 +338,12 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config) > return -EINVAL; > } > > + if ( config->processor_trace_buf_kb && !vmtrace_supported ) > + { > + dprintk(XENLOG_INFO, "Processor tracing is not supported\n"); > + return -EINVAL; > + } > + > return arch_sanitise_domain_config(config); > } > > @@ -443,6 +449,9 @@ struct domain *domain_create(domid_t domid, > d->nr_pirqs = min(d->nr_pirqs, nr_irqs); > > radix_tree_init(&d->pirq_tree); > + > + if ( config->processor_trace_buf_kb ) > + d->processor_trace_buf_kb = config->processor_trace_buf_kb; > } > > if ( (err = arch_domain_create(d, config)) != 0 ) > diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h > index 59bdc28c89..7681675a94 100644 > --- a/xen/include/public/domctl.h > +++ b/xen/include/public/domctl.h > @@ -92,6 +92,7 @@ struct xen_domctl_createdomain { > uint32_t max_evtchn_port; > int32_t max_grant_frames; > int32_t max_maptrack_frames; > + uint32_t processor_trace_buf_kb; > > struct xen_arch_domainconfig arch; > }; > diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h > index ac53519d7f..c046e59886 100644 > --- a/xen/include/xen/sched.h > +++ b/xen/include/xen/sched.h > @@ -457,6 +457,9 @@ struct domain > unsigned pbuf_idx; > spinlock_t pbuf_lock; > > + /* Used by vmtrace features */ > + uint32_t processor_trace_buf_kb; Any reason for adding it here instead of doing it at the end of the struct? Also I think this should be unsigned int, there's no reason to use a specific width type here. IMO it would be nice to have a Kconfig option for this, so that it can be build time disabled, and for example disabled by default on Arm (or on x86 if HVM is not built). Most recently added features have followed this model for example Argo, where a Kconfig option is added in order to build time disable the added feature. Let me know if you need some tips about it, I'm happy to help in order to try to get this in Kconfig. Thanks, Roger.