From patchwork Sat May 21 14:54:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 9130589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2FBC760221 for ; Sat, 21 May 2016 14:54:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F6AC28137 for ; Sat, 21 May 2016 14:54:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 118F228138; Sat, 21 May 2016 14:54:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A37C228114 for ; Sat, 21 May 2016 14:54:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752053AbcEUOyn (ORCPT ); Sat, 21 May 2016 10:54:43 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34627 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751373AbcEUOym (ORCPT ); Sat, 21 May 2016 10:54:42 -0400 Received: by mail-wm0-f67.google.com with SMTP id n129so3914624wmn.1; Sat, 21 May 2016 07:54:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hTqCF9K39T7b/JbBcfMGd0RFGrjk9+yAT2MqiMAU3Po=; b=GYaGeoxlzYj+AyqLxbiwWeAvzeg5mDKOemv9WZRlSBdF6xlFFpQa3P+gh7f2vISF1S n9sDeH5ZXLAZNU7VQpLO3bJqCv+iMfyEFYK8JKIZt5Coz2eCl+MVul5dROvtAruRdKpy 8s5RnWNP9Fjcqxxolp4/lq5If6cv0zD8ZHf9mWWzQaJvk3+MEKz9hJOSM0NkImojG9Ug W6Ld60tuP3CYlQN95XryugfrtNXKmq6SzYYXjt5ThpingVlTVpkqZqeLvdho10jyB3AA mxPlTf/JOJfPZzi9BTcu4jvqAiJXFTyJWlN6wJjf4AVVwtKyHjmgS+9hqKipSUBUsV+T cjyA== 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:mime-version :content-transfer-encoding; bh=hTqCF9K39T7b/JbBcfMGd0RFGrjk9+yAT2MqiMAU3Po=; b=Pbzcw/qtVzdHTjIfgLtFU3JFpt57Id8yMmfn0d9l6glLC+87a2xVkwz/JCA3sD2rXO y5NPQkOE5gUH5KfXWBwcAHYW+oN6N2Sb1o2JnSX9aD6dgzie/bowG2DmRU8kUSG3Q0Wg XSPuK6RMQR0OJKBekitA2MysMa6lXVe9HFLBUxKRfX4tL3N4h6WG9yAaBF6KL9mMu5Jw vdbR6GF/iuUVIBMJdfc8r3ocGesedxtOo84bvajqVYTtzOTZv5VbR+lCHOnE8beuaxeT BKyAyRhdzgBqU4QxqOvwOzK3cbf34Pl8V0FSkZJ/kYC5nzMc4fmz8Zs95R3iZqPeeI+8 fDUA== X-Gm-Message-State: AOPr4FXc62Nfk9GYqxSomi4CcNfNsxbDQkdCDwfbjZ3Ckc3mzGi8zla2eJLtTQXfZuLX4A== X-Received: by 10.28.227.138 with SMTP id a132mr8390223wmh.35.1463842481360; Sat, 21 May 2016 07:54:41 -0700 (PDT) Received: from Pali-Latitude.lan (pali.kolej.mff.cuni.cz. [78.128.193.202]) by smtp.gmail.com with ESMTPSA id r75sm3725937wme.18.2016.05.21.07.54.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 May 2016 07:54:40 -0700 (PDT) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH] dell-smm-hwmon: In debug mode log duration of SMM calls Date: Sat, 21 May 2016 16:54:23 +0200 Message-Id: <1463842463-18025-1-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This allow us to debug how long take each SMM call and how long is system freezed in SMM handler. Signed-off-by: Pali Rohár --- drivers/hwmon/dell-smm-hwmon.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 7a2764a..8a66a42 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -137,6 +137,14 @@ static int i8k_smm(struct smm_regs *regs) int eax = regs->eax; cpumask_var_t old_mask; +#ifdef DEBUG + int ebx = regs->ebx; + unsigned long duration; + ktime_t calltime, delta, rettime; + + calltime = ktime_get(); +#endif + /* SMM requires CPU 0 */ if (!alloc_cpumask_var(&old_mask, GFP_KERNEL)) return -ENOMEM; @@ -208,6 +216,15 @@ static int i8k_smm(struct smm_regs *regs) out: set_cpus_allowed_ptr(current, old_mask); free_cpumask_var(old_mask); + +#ifdef DEBUG + rettime = ktime_get(); + delta = ktime_sub(rettime, calltime); + duration = ktime_to_ns(delta) >> 10; + pr_debug("smm(0x%.4x 0x%.4x) = 0x%.4x (took %7lu usecs)\n", eax, ebx, + (rc ? 0xffff : regs->eax & 0xffff), duration); +#endif + return rc; }