From patchwork Fri Apr 15 20:28:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 65972 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp140364qge; Fri, 15 Apr 2016 13:53:46 -0700 (PDT) X-Received: by 10.67.3.234 with SMTP id bz10mr32347909pad.96.1460753626524; Fri, 15 Apr 2016 13:53:46 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hq1si430455pac.56.2016.04.15.13.53.46; Fri, 15 Apr 2016 13:53:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751827AbcDOUxo (ORCPT + 29 others); Fri, 15 Apr 2016 16:53:44 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:36327 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751520AbcDOUxn (ORCPT ); Fri, 15 Apr 2016 16:53:43 -0400 Received: by mail-pf0-f176.google.com with SMTP id e128so60014091pfe.3 for ; Fri, 15 Apr 2016 13:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=QQ+LSapyDL3uHGrc6DHUKixskWz7EAl0EegbgGrSUAA=; b=V/y3cle2mVec56H0nBBZ1wHiP7lXfPP8hEbmgfgSqJLlEpY0lqZjamASNOssjGEo34 zWqQKXiOn6wUdmLN1BDn98VtES2bG0uThjK0Ask2KozYdAcEKu47Vuu+2MidOe7BwCBp vO0lKfZ7t//eqsYpo/g2p8tgwPQQkv+Iy/SGg= 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; bh=QQ+LSapyDL3uHGrc6DHUKixskWz7EAl0EegbgGrSUAA=; b=lI5w4o0CXknvKMllDNUKCklQpR+yUkxI9OYIJ3CLYAY0PUD5bhSZ9vVQ+8NUBLhhP+ tP9bDR6eALP4+cxr0cbSV9ZzGLB2xCjJMYJIxUrvSdw2Pfebx7OcHG5yvmIrjxAP2P2Q CYnCxbQLeVhH/Vze8Ypx5wSVe3iH9fu1VKCzS3FLQRLRfd6gNLhHbR4C9V/BDj36Wrcd TjnvDA92cVTGBS/qE2NZEK0ujizcOT/i6sE6/tGQUnJHivEEJI3vPvRuRYKw5oTU6iYJ sHuPPy9rmGu+65l/rJKfDHC550YjAhcs6ym4ScDM9+yuferQ5wEauK1dZmLPq3o12FqI mqJg== X-Gm-Message-State: AOPr4FV+RVj5UuAksLPwuEj9V3ExFtkUQY80EUjHj43Kr+2ZDapnFUYo3HF7tWuIi9IGAYti X-Received: by 10.98.86.77 with SMTP id k74mr31597789pfb.28.1460753622199; Fri, 15 Apr 2016 13:53:42 -0700 (PDT) Received: from yshi-Precision-T5600.corp.ad.wrs.com (unknown-216-82.windriver.com. [147.11.216.82]) by smtp.gmail.com with ESMTPSA id bu17sm66847598pac.25.2016.04.15.13.53.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Apr 2016 13:53:41 -0700 (PDT) From: Yang Shi To: paulmck@linux.vnet.ibm.com Cc: linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, yang.shi@linaro.org Subject: [PATCH] locktorture: make verbose writable and control stats print Date: Fri, 15 Apr 2016 13:28:11 -0700 Message-Id: <1460752091-28023-1-git-send-email-yang.shi@linaro.org> X-Mailer: git-send-email 2.0.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When building locktorture test into kernel image, it keeps printing out stats information even though there is no lock type specified. There is already verbose parameter to control print, but it is read-only, so it can't be changed at runtime. Make verbose read-write and control stats print. Signed-off-by: Yang Shi --- include/linux/torture.h | 2 ++ kernel/locking/locktorture.c | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) -- 2.0.2 diff --git a/include/linux/torture.h b/include/linux/torture.h index 7759fc3..86d6e54 100644 --- a/include/linux/torture.h +++ b/include/linux/torture.h @@ -48,6 +48,8 @@ do { if (verbose) pr_alert("%s" TORTURE_FLAG " %s\n", torture_type, s); } while (0) #define VERBOSE_TOROUT_ERRSTRING(s) \ do { if (verbose) pr_alert("%s" TORTURE_FLAG "!!! %s\n", torture_type, s); } while (0) +#define VERBOSE_STRING(s) \ + do { if (verbose) pr_alert("%s", s); } while (0) /* Definitions for online/offline exerciser. */ int torture_onoff_init(long ooholdoff, long oointerval); diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index 8ef1919..d9838a3 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -55,8 +55,11 @@ torture_param(int, shutdown_secs, 0, "Shutdown time (j), <= zero to disable."); torture_param(int, stat_interval, 60, "Number of seconds between stats printk()s"); torture_param(int, stutter, 5, "Number of jiffies to run/halt test, 0=disable"); -torture_param(bool, verbose, true, - "Enable verbose debugging printk()s"); + +static bool verbose = true; +module_param(verbose, bool, 0644); +MODULE_PARM_DESC(verbose, + "Enable verbose debugging printk()s"); static char *torture_type = "spin_lock"; module_param(torture_type, charp, 0444); @@ -693,7 +696,7 @@ static void lock_torture_stats_print(void) } __torture_print_stats(buf, cxt.lwsa, true); - pr_alert("%s", buf); + VERBOSE_STRING(buf); kfree(buf); if (cxt.cur_ops->readlock) { @@ -705,7 +708,7 @@ static void lock_torture_stats_print(void) } __torture_print_stats(buf, cxt.lrsa, false); - pr_alert("%s", buf); + VERBOSE_STRING(buf); kfree(buf); } }