From patchwork Wed May 28 03:27:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gong X-Patchwork-Id: 4252481 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 14A679F32B for ; Wed, 28 May 2014 03:55:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 52ACF202C8 for ; Wed, 28 May 2014 03:55:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7AC25202B8 for ; Wed, 28 May 2014 03:54:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753845AbaE1Dy6 (ORCPT ); Tue, 27 May 2014 23:54:58 -0400 Received: from mga01.intel.com ([192.55.52.88]:58812 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753803AbaE1Dy6 (ORCPT ); Tue, 27 May 2014 23:54:58 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 27 May 2014 20:54:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,924,1392192000"; d="scan'208";a="538707742" Received: from gchen-sby.bj.intel.com (HELO localhost) ([10.238.158.82]) by fmsmga001.fm.intel.com with ESMTP; 27 May 2014 20:54:38 -0700 From: "Chen, Gong" To: bp@alien8.de Cc: tony.luck@intel.com, m.chehab@samsung.com, linux-acpi@vger.kernel.org, "Chen, Gong" Subject: [PATCH 6/7 v4] trace, eMCA: Add a knob to adjust where to save event log Date: Tue, 27 May 2014 23:27:02 -0400 Message-Id: <1401247622-21948-1-git-send-email-gong.chen@linux.intel.com> X-Mailer: git-send-email 2.0.0.rc2 In-Reply-To: <20140522111140.GH4383@pd.tnic> References: <20140522111140.GH4383@pd.tnic> 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. v4 -> v3: format adjustment. 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 8815b73..07a6fe8 100644 --- a/drivers/acpi/acpi_extlog.c +++ b/drivers/acpi/acpi_extlog.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -181,7 +182,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()) { + print_extlog_rcd(NULL, tmp, cpu); + goto out; + } /* log event via trace */ err_number++; @@ -198,6 +203,7 @@ static int extlog_print(struct notifier_block *nb, unsigned long val, (u8)gdata->error_severity, mem_err); } +out: return NOTIFY_STOP; }