From patchwork Wed Mar 16 19:18:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Goldstein X-Patchwork-Id: 8603531 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0DCFCC0553 for ; Wed, 16 Mar 2016 19:21:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 251E1201ED for ; Wed, 16 Mar 2016 19:21:32 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3E28D2021B for ; Wed, 16 Mar 2016 19:21:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1agGyF-0005Ev-Ks; Wed, 16 Mar 2016 19:19:03 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1agGyE-0005Ec-NZ for xen-devel@lists.xen.org; Wed, 16 Mar 2016 19:19:02 +0000 Received: from [193.109.254.147] by server-1.bemta-14.messagelabs.com id 84/3D-02901-6A1B9E65; Wed, 16 Mar 2016 19:19:02 +0000 X-Env-Sender: cardoe@cardoe.com X-Msg-Ref: server-10.tower-27.messagelabs.com!1458155940!31758300!1 X-Originating-IP: [209.85.161.196] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 37477 invoked from network); 16 Mar 2016 19:19:01 -0000 Received: from mail-yw0-f196.google.com (HELO mail-yw0-f196.google.com) (209.85.161.196) by server-10.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 16 Mar 2016 19:19:01 -0000 Received: by mail-yw0-f196.google.com with SMTP id f6so4534601ywa.1 for ; Wed, 16 Mar 2016 12:19:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cardoe.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U/Ya3fcildWSNJbiAzStbhGpH3k/isRM9Taz0+DQ+cg=; b=hxmlIg0h14qwh4IGu9RZJKFiOxKJXJwR9c9FYik3KS4LmJLouaD237KTVeyDnftNo5 EbTkvFyniPgUe6NT0jnt78sFytCKh8k7Dxxhez2XcIDxHkI0JF6oOO6GcRdIe4L7OKZy QaOJBsBPu7KErxD+7IHSfrUR15mqFjFFCn97Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=U/Ya3fcildWSNJbiAzStbhGpH3k/isRM9Taz0+DQ+cg=; b=i+ml8muvgev8TkAaK0yGyS00ixClF3dTnJYralEPjRfkJdEazCvS3Q1GGrNHMfg173 DSBTMEryR/Wo+bZGzmF4Gios0SlYyHdRLMXZJQQrlgpSKhsV1FO+naKJ8t2n8QlQ4fk8 dyDfItOtNdJLMYB/YC3l63mi+Mbdg442PrLwYpTD8Ku0UJXyfBHQCfBgQULYHjbo4z2j e+KvjLA/0ylLtFiBDbR+gskABnHyXhw5YRjNMu2o4F4jTOCU3w5Dpbg9p6gY/K4MiYfF LU5AoVIIqii9WQdyiO+1hjeW4Dqb5CPanbAxr2Pw53erRY59xCKUyVriUJ3i1mOsWNPw GoZw== X-Gm-Message-State: AD7BkJJ3ysr/UllIQVLK59meMAo+h6upSTa8O726XSDKVtmIRAEm89F0V7GgZu3Yphnnzg== X-Received: by 10.129.120.133 with SMTP id t127mr2528085ywc.204.1458155940082; Wed, 16 Mar 2016 12:19:00 -0700 (PDT) Received: from swanson.lan (c-68-46-196-185.hsd1.al.comcast.net. [68.46.196.185]) by smtp.gmail.com with ESMTPSA id x7sm2721541ywf.35.2016.03.16.12.18.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Mar 2016 12:18:57 -0700 (PDT) From: Doug Goldstein To: xen-devel@lists.xen.org Date: Wed, 16 Mar 2016 14:18:43 -0500 Message-Id: <1458155923-15648-2-git-send-email-cardoe@cardoe.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1458155923-15648-1-git-send-email-cardoe@cardoe.com> References: <1458155923-15648-1-git-send-email-cardoe@cardoe.com> Cc: Daniel De Graaf , Doug Goldstein Subject: [Xen-devel] [PATCH v2 2/2] xsm: move FLASK_AVC_STATS to Kconfig X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_BL_SPAMCOP_NET, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Have Kconfig set CONFIG_FLASK_AVC_STATS and prefix all uses with CONFIG_ to use the Kconfig variable. Signed-off-by: Doug Goldstein Acked-by: Daniel De Graaf --- CC: Daniel De Graaf --- xen/common/Kconfig | 6 ++++++ xen/include/xen/config.h | 5 ----- xen/xsm/flask/avc.c | 4 ++-- xen/xsm/flask/flask_op.c | 4 ++-- xen/xsm/flask/include/avc.h | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 3522ecb..ad9f7bf 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -23,6 +23,12 @@ config FLASK If unsure, say N. +config FLASK_AVC_STATS + def_bool y + depends on FLASK + ---help--- + Maintain statistics on the access vector cache + # Select HAS_DEVICE_TREE if device tree is supported config HAS_DEVICE_TREE bool diff --git a/xen/include/xen/config.h b/xen/include/xen/config.h index 3f8c53d..ef6e5ee 100644 --- a/xen/include/xen/config.h +++ b/xen/include/xen/config.h @@ -78,11 +78,6 @@ #define __STR(...) #__VA_ARGS__ #define STR(...) __STR(__VA_ARGS__) -#ifdef CONFIG_FLASK -/* Maintain statistics on the access vector cache */ -#define FLASK_AVC_STATS 1 -#endif - /* allow existing code to work with Kconfig variable */ #define NR_CPUS CONFIG_NR_CPUS diff --git a/xen/xsm/flask/avc.c b/xen/xsm/flask/avc.c index 31bc702..7764379 100644 --- a/xen/xsm/flask/avc.c +++ b/xen/xsm/flask/avc.c @@ -56,7 +56,7 @@ const struct selinux_class_perm selinux_class_perm = { #define AVC_DEF_CACHE_THRESHOLD 512 #define AVC_CACHE_RECLAIM 16 -#ifdef FLASK_AVC_STATS +#ifdef CONFIG_FLASK_AVC_STATS #define avc_cache_stats_incr(field) \ do { \ __get_cpu_var(avc_cache_stats).field++; \ @@ -101,7 +101,7 @@ struct avc_callback_node { /* Exported via Flask hypercall */ unsigned int avc_cache_threshold = AVC_DEF_CACHE_THRESHOLD; -#ifdef FLASK_AVC_STATS +#ifdef CONFIG_FLASK_AVC_STATS DEFINE_PER_CPU(struct avc_cache_stats, avc_cache_stats); #endif diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c index f4f5dd1..3c9c99e 100644 --- a/xen/xsm/flask/flask_op.c +++ b/xen/xsm/flask/flask_op.c @@ -469,7 +469,7 @@ static int flask_security_make_bools(void) return ret; } -#ifdef FLASK_AVC_STATS +#ifdef CONFIG_FLASK_AVC_STATS static int flask_security_avc_cachestats(struct xen_flask_cache_stats *arg) { @@ -761,7 +761,7 @@ ret_t do_flask_op(XEN_GUEST_HANDLE_PARAM(xsm_op_t) u_flask_op) rv = avc_get_hash_stats(&op.u.hash_stats); break; -#ifdef FLASK_AVC_STATS +#ifdef CONFIG_FLASK_AVC_STATS case FLASK_AVC_CACHESTATS: rv = flask_security_avc_cachestats(&op.u.cache_stats); break; diff --git a/xen/xsm/flask/include/avc.h b/xen/xsm/flask/include/avc.h index 4283562..729856e 100644 --- a/xen/xsm/flask/include/avc.h +++ b/xen/xsm/flask/include/avc.h @@ -108,7 +108,7 @@ struct xen_flask_hash_stats; int avc_get_hash_stats(struct xen_flask_hash_stats *arg); extern unsigned int avc_cache_threshold; -#ifdef FLASK_AVC_STATS +#ifdef CONFIG_FLASK_AVC_STATS DECLARE_PER_CPU(struct avc_cache_stats, avc_cache_stats); #endif