From patchwork Wed Apr 15 08:53:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11490579 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A82A112C for ; Wed, 15 Apr 2020 08:55:09 +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 E4D5C20737 for ; Wed, 15 Apr 2020 08:55:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E4D5C20737 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.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.89) (envelope-from ) id 1jOdnj-0001xo-Eh; Wed, 15 Apr 2020 08:53:43 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jOdni-0001xY-1F for xen-devel@lists.xenproject.org; Wed, 15 Apr 2020 08:53:42 +0000 X-Inumbo-ID: 9a9864fc-7ef6-11ea-9e09-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9a9864fc-7ef6-11ea-9e09-bc764e2007e4; Wed, 15 Apr 2020 08:53:41 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 80423AF92; Wed, 15 Apr 2020 08:53:39 +0000 (UTC) Subject: [PATCH 3/3] xenoprof: limit scope of types and #define-s From: Jan Beulich To: "xen-devel@lists.xenproject.org" References: <25c5b76f-4f95-3ba9-0ae0-dd0c1f3f8496@suse.com> Message-ID: <61ac5f46-fd43-e173-202e-9de46755d604@suse.com> Date: Wed, 15 Apr 2020 10:53:38 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <25c5b76f-4f95-3ba9-0ae0-dd0c1f3f8496@suse.com> Content-Language: en-US X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Paul Durrant , Andrew Cooper , Ian Jackson , George Dunlap Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Quite a few of the items are used by xenoprof.c only, so move them there to limit their visibility as well as the amount of re-building needed in case of changes. Also drop the inclusion of the public header there. Signed-off-by: Jan Beulich Acked-by: Wei Liu --- a/xen/arch/x86/oprofile/nmi_int.c +++ b/xen/arch/x86/oprofile/nmi_int.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include --- a/xen/common/xenoprof.c +++ b/xen/common/xenoprof.c @@ -23,6 +23,32 @@ #undef virt_to_mfn #define virt_to_mfn(va) _mfn(__virt_to_mfn(va)) +#define XENOPROF_DOMAIN_IGNORED 0 +#define XENOPROF_DOMAIN_ACTIVE 1 +#define XENOPROF_DOMAIN_PASSIVE 2 + +#define XENOPROF_IDLE 0 +#define XENOPROF_INITIALIZED 1 +#define XENOPROF_COUNTERS_RESERVED 2 +#define XENOPROF_READY 3 +#define XENOPROF_PROFILING 4 + +#ifndef CONFIG_COMPAT +#define XENOPROF_COMPAT(x) false +typedef struct xenoprof_buf xenoprof_buf_t; +#define xenoprof_buf(d, b, field) ACCESS_ONCE((b)->field) +#else +#include +#define XENOPROF_COMPAT(x) ((x)->is_compat) +typedef union { + struct xenoprof_buf native; + struct compat_oprof_buf compat; +} xenoprof_buf_t; +#define xenoprof_buf(d, b, field) ACCESS_ONCE(*(!(d)->xenoprof->is_compat \ + ? &(b)->native.field \ + : &(b)->compat.field)) +#endif + /* Limit amount of pages used for shared buffer (per domain) */ #define MAX_OPROF_SHARED_PAGES 32 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include --- a/xen/include/asm-x86/xenoprof.h +++ b/xen/include/asm-x86/xenoprof.h @@ -26,6 +26,8 @@ struct vcpu; #ifdef CONFIG_XENOPROF +#include + int nmi_reserve_counters(void); int nmi_setup_events(void); int nmi_enable_virq(void); --- a/xen/include/xen/xenoprof.h +++ b/xen/include/xen/xenoprof.h @@ -11,7 +11,6 @@ #define __XEN_XENOPROF_H__ #include -#include #include #define PMU_OWNER_NONE 0 @@ -20,37 +19,9 @@ #ifdef CONFIG_XENOPROF -#define XENOPROF_DOMAIN_IGNORED 0 -#define XENOPROF_DOMAIN_ACTIVE 1 -#define XENOPROF_DOMAIN_PASSIVE 2 - -#define XENOPROF_IDLE 0 -#define XENOPROF_INITIALIZED 1 -#define XENOPROF_COUNTERS_RESERVED 2 -#define XENOPROF_READY 3 -#define XENOPROF_PROFILING 4 - -#ifndef CONFIG_COMPAT -typedef struct xenoprof_buf xenoprof_buf_t; -#else -#include -typedef union { - struct xenoprof_buf native; - struct compat_oprof_buf compat; -} xenoprof_buf_t; -#endif - -#ifndef CONFIG_COMPAT -#define XENOPROF_COMPAT(x) 0 -#define xenoprof_buf(d, b, field) ACCESS_ONCE((b)->field) -#else -#define XENOPROF_COMPAT(x) ((x)->is_compat) -#define xenoprof_buf(d, b, field) ACCESS_ONCE(*(!(d)->xenoprof->is_compat \ - ? &(b)->native.field \ - : &(b)->compat.field)) -#endif - struct domain; +struct vcpu; +struct cpu_user_regs; int acquire_pmu_ownership(int pmu_ownership); void release_pmu_ownership(int pmu_ownership);