From patchwork Thu May 15 08:30:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gong X-Patchwork-Id: 4180101 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 57D46BFF02 for ; Thu, 15 May 2014 09:04:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9853220384 for ; Thu, 15 May 2014 09:04:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 71E6920379 for ; Thu, 15 May 2014 09:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751191AbaEOJEU (ORCPT ); Thu, 15 May 2014 05:04:20 -0400 Received: from mga09.intel.com ([134.134.136.24]:1435 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751000AbaEOJET (ORCPT ); Thu, 15 May 2014 05:04:19 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 15 May 2014 01:59:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,1057,1389772800"; d="scan'208";a="540818777" Received: from gchen-sby.bj.intel.com (HELO localhost) ([10.238.158.82]) by orsmga002.jf.intel.com with ESMTP; 15 May 2014 02:04:16 -0700 From: "Chen, Gong" To: tony.luck@intel.com, bp@alien8.de, m.chehab@samsung.com Cc: linux-acpi@vger.kernel.org, "Chen, Gong" Subject: [PATCH 6/7 v3] trace, eMCA: Add a knob to adjust where to save event log Date: Thu, 15 May 2014 04:30:45 -0400 Message-Id: <1400142646-10127-7-git-send-email-gong.chen@linux.intel.com> X-Mailer: git-send-email 2.0.0.rc0 In-Reply-To: <1400142646-10127-1-git-send-email-gong.chen@linux.intel.com> References: <1400142646-10127-1-git-send-email-gong.chen@linux.intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 To avoid saving two copies for one H/W event, add a new file under debugfs to control how to save event log. Once this file is opened, the perf/trace will be used, in the meanwhile, kernel will stop to print event log to the console. On the other hand, if this file is closed, kernel will print event log to the console again. v3 -> v2: minor adjustment to make flow cleanly. v2 -> v1: move counter operation from *read* to *open*. Signed-off-by: Chen, Gong --- drivers/acpi/acpi_extlog.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c index b1dcb5b..c1dab37 100644 --- a/drivers/acpi/acpi_extlog.c +++ b/drivers/acpi/acpi_extlog.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -185,7 +186,11 @@ static int extlog_print(struct notifier_block *nb, unsigned long val, estatus->block_status = 0; tmp = (struct acpi_generic_status *)elog_buf; - print_extlog_rcd(NULL, tmp, cpu); + + if (ras_userspace_consumers() == 0) { + print_extlog_rcd(NULL, tmp, cpu); + goto out; + } /* log event via trace */ err_count++; @@ -202,6 +207,7 @@ static int extlog_print(struct notifier_block *nb, unsigned long val, gdata->error_severity, mem_err); } +out: return NOTIFY_STOP; }