From patchwork Fri Jun 16 19:12:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 21055 Received: (qmail 77566 invoked by alias); 16 Jun 2017 19:12:56 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 77556 invoked by uid 89); 16 Jun 2017 19:12:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-27.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f180.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=nxysfdLTat5Z6i0BGTvhxmog9ZVABQfm1WRsLrbh4eE=; b=fBhIY3Fw6MJPR6ZciwPVcxI+pn3rAe+O6n560R8MRq+EZwBb0R84cXplLdh84NSPLG r5J2f6AIWFbS7PuYWIiri638ya/u2+//E89DaA/xcT6gSf4TvaPSZYZ+1z4Yt+HJ9odq CXd8Iu9HlCqhe+xt9EroJeZOIWEIEKcNuxXLXLpFv5Z2CXbc9wn7EqfeNtfGnpYZ3fjw kxtpDbUHn5gNiqmLUYpvj1xZGlyaiIgsN2twTAQEXJc7jeROahE7zJ037Mnwa6nLzKFb 9T3CKw8icmEFWULN3SoCVB1HeYUYY8dr5Np5GSaIR6fXNtVqCuf0xOCeOtEnC/yTnMTC wGqA== X-Gm-Message-State: AKS2vOxheUdms2O5JV1P+NtvjhLPX7yFKRDMv4XnBC0K8PE14IyC1Osh PWXpfBoDMb2S1NEmktR58Q== X-Received: by 10.55.153.199 with SMTP id b190mr14890810qke.117.1497640376093; Fri, 16 Jun 2017 12:12:56 -0700 (PDT) Subject: Re: [PATCH v2] Enable tunables by default To: libc-alpha@sourceware.org References: <1497463683-18434-1-git-send-email-siddhesh@sourceware.org> <5944037B.5090602@arm.com> From: Adhemerval Zanella Message-ID: <755ad681-dc4f-2505-d103-11f3795cbf3e@linaro.org> Date: Fri, 16 Jun 2017 16:12:52 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <5944037B.5090602@arm.com> On 16/06/2017 13:12, Szabolcs Nagy wrote: > On 14/06/17 19:08, Siddhesh Poyarekar wrote: >> All of the major architectures are adopting tunables as a way to add >> tuning to the library, from hwcap_mask for aarch64 to HLE for s390 and >> ifunc and cache geometry for x86. Given this adoption and the fact >> that we don't want additional tuning knobs to be added outside of >> tunables, it makes sense to enable tunables by default using this >> trivial patch. >> >> Smoke tested on x86 to ensure that tunables code was built without >> specifying it as a configure flag. I have kept it as --enabled and >> not changed it to --disable since we want to still keep the option of >> different kinds of front-ends for tunables. >> >> * configure.ac(--enable-tunables): Enable by default. >> * configure: Regenerate. >> * NEWS: Mention change. >> * manual/install.texi (enable-tunables): Adjust documentation. >> * INSTALL: Regenerate. > > note that gen-tunables.awk does not work with gawk 3.1.8 > because it uses multi-dimensional arrays > > so this broke the build for me on x86. > This patch below seems to work on gawk 3.1.8. It changes the order or the elements in tunable_id_t and tunable_list, but as long both order match I think it should work. diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk index 93e5aff..ccdd0c6 100644 --- a/scripts/gen-tunables.awk +++ b/scripts/gen-tunables.awk @@ -39,20 +39,20 @@ $2 == "{" { $1 == "}" { if (tunable != "") { # Tunables definition ended, now fill in default attributes. - if (!types[top_ns][ns][tunable]) { - types[top_ns][ns][tunable] = "STRING" + if (!types[top_ns,ns,tunable]) { + types[top_ns,ns,tunable] = "STRING" } - if (!minvals[top_ns][ns][tunable]) { - minvals[top_ns][ns][tunable] = "0" + if (!minvals[top_ns,ns,tunable]) { + minvals[top_ns,ns,tunable] = "0" } - if (!maxvals[top_ns][ns][tunable]) { - maxvals[top_ns][ns][tunable] = "0" + if (!maxvals[top_ns,ns,tunable]) { + maxvals[top_ns,ns,tunable] = "0" } - if (!env_alias[top_ns][ns][tunable]) { - env_alias[top_ns][ns][tunable] = "NULL" + if (!env_alias[top_ns,ns,tunable]) { + env_alias[top_ns,ns,tunable] = "NULL" } - if (!security_level[top_ns][ns][tunable]) { - security_level[top_ns][ns][tunable] = "SXID_ERASE" + if (!security_level[top_ns,ns,tunable]) { + security_level[top_ns,ns,tunable] = "SXID_ERASE" } tunable = "" @@ -81,7 +81,7 @@ $1 == "}" { if (tunable == "") { # We encountered a tunable without any attributes, so note it with a # default. - types[top_ns][ns][$1] = "STRING" + types[top_ns,ns,$1] = "STRING" next } @@ -91,20 +91,20 @@ $1 == "}" { val = gensub(/^[ \t]+|[ \t]+$/, "", "g", arr[2]) if (attr == "type") { - types[top_ns][ns][tunable] = val + types[top_ns,ns,tunable] = val } else if (attr == "minval") { - minvals[top_ns][ns][tunable] = val + minvals[top_ns,ns,tunable] = val } else if (attr == "maxval") { - maxvals[top_ns][ns][tunable] = val + maxvals[top_ns,ns,tunable] = val } else if (attr == "env_alias") { - env_alias[top_ns][ns][tunable] = sprintf("\"%s\"", val) + env_alias[top_ns,ns,tunable] = sprintf("\"%s\"", val) } else if (attr == "security_level") { if (val == "SXID_ERASE" || val == "SXID_IGNORE" || val == "NONE") { - security_level[top_ns][ns][tunable] = val + security_level[top_ns,ns,tunable] = val } else { printf("Line %d: Invalid value (%s) for security_level: %s, ", NR, val, @@ -114,11 +114,11 @@ $1 == "}" { } } else if (attr == "default") { - if (types[top_ns][ns][tunable] == "STRING") { - default_val[top_ns][ns][tunable] = sprintf(".strval = \"%s\"", val); + if (types[top_ns,ns,tunable] == "STRING") { + default_val[top_ns,ns,tunable] = sprintf(".strval = \"%s\"", val); } else { - default_val[top_ns][ns][tunable] = sprintf(".numval = %s", val) + default_val[top_ns,ns,tunable] = sprintf(".numval = %s", val) } } } @@ -139,27 +139,27 @@ END { # Now, the enum names print "\ntypedef enum" print "{" - for (t in types) { - for (n in types[t]) { - for (m in types[t][n]) { - printf (" TUNABLE_ENUM_NAME(%s, %s, %s),\n", t, n, m); - } - } + for (tnm in types) { + split (tnm, indices, SUBSEP); + t = indices[1]; + n = indices[2]; + m = indices[3]; + printf (" TUNABLE_ENUM_NAME(%s, %s, %s),\n", t, n, m); } print "} tunable_id_t;\n" # Finally, the tunable list. print "\n#ifdef TUNABLES_INTERNAL" print "static tunable_t tunable_list[] attribute_relro = {" - for (t in types) { - for (n in types[t]) { - for (m in types[t][n]) { - printf (" {TUNABLE_NAME_S(%s, %s, %s)", t, n, m) - printf (", {TUNABLE_TYPE_%s, %s, %s}, {%s}, NULL, TUNABLE_SECLEVEL_%s, %s},\n", - types[t][n][m], minvals[t][n][m], maxvals[t][n][m], - default_val[t][n][m], security_level[t][n][m], env_alias[t][n][m]); - } - } + for (tnm in types) { + split (tnm, indices, SUBSEP); + t = indices[1]; + n = indices[2]; + m = indices[3]; + printf (" {TUNABLE_NAME_S(%s, %s, %s)", t, n, m) + printf (", {TUNABLE_TYPE_%s, %s, %s}, {%s}, NULL, TUNABLE_SECLEVEL_%s, %s},\n", + types[t,n,m], minvals[t,n,m], maxvals[t,n,m], + default_val[t,n,m], security_level[t,n,m], env_alias[t,n,m]); } print "};" print "#endif"