From patchwork Fri Jun 17 22:54:49 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: 9185109 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 D41D6608A9 for ; Fri, 17 Jun 2016 22:55:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C442327EE2 for ; Fri, 17 Jun 2016 22:55:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B172D28327; Fri, 17 Jun 2016 22:55:49 +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 57A6127EE2 for ; Fri, 17 Jun 2016 22:55:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964879AbcFQWzq (ORCPT ); Fri, 17 Jun 2016 18:55:46 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33298 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964835AbcFQWzo (ORCPT ); Fri, 17 Jun 2016 18:55:44 -0400 Received: by mail-wm0-f67.google.com with SMTP id r201so1054294wme.0; Fri, 17 Jun 2016 15:55:44 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=m0A3/gJ1Q/6B8ayIKiXhCQk6w8jEL8pzJpNGIAafVW4=; b=B7Fnb4Effc2kFkjrseCYqgDt53PUR296Ga2YM3vS7E6gcY7Lnv3AOZ7GnkY5VtTdtj xMpdZZmp2zCd+VXJ1wHHNhcELZ1CdWNUrlnqL2ku8iAiBniUvH0wRzSau91s+PSlS/45 MlCp6y2W4+VY0NQK8vBWar2LdQ+Ph84VGOxHc/NVmgnXuU5WfyWvPUDLfRWEsJTTgMRU wL/tIGCH+nZJBGR3dZx1dUeLYSgBFFp/F3BZ+07GM1ljKMJCHsKSXVtHDkvuIpzd+61E ypiVtv1DC9pl2r4as5XUlPyex4VABzntScezI3ajHowGKYuSW20HmS9LtpEcfjSAxek/ 1DBQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=m0A3/gJ1Q/6B8ayIKiXhCQk6w8jEL8pzJpNGIAafVW4=; b=QWgsuQfyaur34yD96G7rURa6Nmhp1rejcysVLYjexkpqEPieFVUpjEx6F61Q59gRRd dG2OzDxjxiaFCTGmMQmLAGaRn/mUySAbH55xTTksH8LVAAKzGxIrMz+378oWXSNgFxUx YRq4DqzRi3MlhsDE0mArg8lsKbmq23JiXvX5LGvxv7HZBqoMi+MwCUmFNI41F/hJpfDP lZ+RPlqKj3HUuQ5anlFpuDSUf6n16WHzHR1g2M9rsmTTEvR1Az0rNx5f9Y47lvkm2pb4 UGFFVDMHIPd85Nr1cAnW7jbVeQXkelvVoK3/Ry8khO/d63oS3ThsIZjd5o1ApL1vISJZ 0loQ== X-Gm-Message-State: ALyK8tKWYS0oFH7qvxtYgXkXc/DCnQs9nCpKG2TNLRXrwj56urOIpNEYL63bLDE4abFLqQ== X-Received: by 10.28.176.7 with SMTP id z7mr616601wme.17.1466204138293; Fri, 17 Jun 2016 15:55:38 -0700 (PDT) Received: from Pali-Latitude.lan (pali.kolej.mff.cuni.cz. [78.128.193.202]) by smtp.gmail.com with ESMTPSA id d137sm806128wmd.12.2016.06.17.15.55.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jun 2016 15:55:37 -0700 (PDT) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Jean Delvare , Guenter Roeck , Jan C Peters , Thorsten Leemhuis , =?UTF-8?q?David=20Santamar=C3=ADa=20Rogado?= , Peter Saunderson , Tolga Cakir , "Austin S. Hemmelgarn" , Mario_Limonciello@dell.com, Gabriele Mazzotta , =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= , Dakota Whipple , Leon Yu Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH 6/6] hwmon: (dell-smm) In debug mode log duration of SMM calls Date: Sat, 18 Jun 2016 00:54:49 +0200 Message-Id: <1466204089-17030-7-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1466204089-17030-1-git-send-email-pali.rohar@gmail.com> References: <1466204089-17030-1-git-send-email-pali.rohar@gmail.com> 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 frozen 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 571d498..acf9c03 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -140,6 +140,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; @@ -211,6 +219,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; }