From patchwork Thu Nov 11 20:41:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 520116 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AD73C433F5 for ; Thu, 11 Nov 2021 20:42:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D9076120D for ; Thu, 11 Nov 2021 20:42:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233372AbhKKUpR (ORCPT ); Thu, 11 Nov 2021 15:45:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232970AbhKKUpR (ORCPT ); Thu, 11 Nov 2021 15:45:17 -0500 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAB0EC061766 for ; Thu, 11 Nov 2021 12:42:27 -0800 (PST) Received: by mail-qk1-x735.google.com with SMTP id bk22so7054141qkb.6 for ; Thu, 11 Nov 2021 12:42:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IWkwSvOMrUHP+BW4pVYcw37m7qJM+gx7dB5W+YZNYOY=; b=HroXzu0/F69BnPBC/MNC+rFFrYTy9g3P3GW1T6+erD11b/07Bds4rEqDb0awc/yGkz pNV10JyMS6K0lZXk/5O5czBGjZutAR3Pam5pjBS45irQC/8vkGBVyo5kSP8/hZi1Op0X lEnrL0bffqnqFXWcpG12ztc1FeISJpzg/97iT/HNvSf9PlT15zpPXE/8/zA6DB0lNKx2 ougXxmXp0GXxxN/5pNfHWDuLry0v6DuFIqC0DiFt1CBAX70DhPtPRUN25ESrDQ8+6OJ3 msjU4IWMT5Ncbu0qseSKPWt6qvNUY3iEwoN6XApf9ENFugyvUh24W3H4HGoyCmIhxQDB mpTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=IWkwSvOMrUHP+BW4pVYcw37m7qJM+gx7dB5W+YZNYOY=; b=3EODdNIpM7ckgl9Hbem6n52Hv7jKAllopKDGwaRwIxHO8+Pz1rtxyP4nCf8LkuNqyj 4O3ErSOP0IQdonhy9K2057WkjZn/n7RtySjfGStJJ2KaLWJWnBu9A9LYb5x8E+6IhimR R+cKdiqGdEKYXPOiGB+sf3Y5qhmY6welcY+OnA18gsELOE2NoE6WT1NC+F7S6OQ8mW/2 tLI64/maMfdfm7BFB5luJkF6EsJX3tj1Wdy8euPDRysw85QR+xNXzrDX6xJHYQwtVQp0 uIw157wS8x29eBEUNfGfR5QpIKNYQsosRlrT1RzKWUh4EwkNKMLzsYiBK/LYJBa4qGm2 p4Qw== X-Gm-Message-State: AOAM530vs58fYAMQZYxR8e4mK70HUHYfrCzOG5zclbpcsfcbALUYNNL0 f6jl/iz+CZJBwyYhnjsxSpM9sE7mxAc= X-Google-Smtp-Source: ABdhPJzavavxIn5zMi8GhL7rBSAYGUszmW1LEb98ct23sYsjTB5FGl41lkEppGdkU6QjNoYl/iEUGw== X-Received: by 2002:a05:620a:2e3:: with SMTP id a3mr8238425qko.451.1636663346594; Thu, 11 Nov 2021 12:42:26 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:26 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 01/17] rt-tests:hwlatdetect: Remove useless object in class declaration Date: Thu, 11 Nov 2021 15:41:51 -0500 Message-Id: <20211111204207.10167-1-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org There is no need to specify object in python3 when creating a class Signed-off-by: John Kacur --- src/hwlatdetect/hwlatdetect.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index 56fd2af8641d..ac87036d4c08 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -31,7 +31,7 @@ def info(str): # discovers that debugfs is already mounted, it will leave # it mounted. # -class DebugFS(object): +class DebugFS: '''class to manage mounting/umounting the debugfs''' def __init__(self): self.premounted = False @@ -116,7 +116,7 @@ class DetectorNotAvailable(Exception): # above, if the module is already loaded, this class will # leave it alone when cleaning up. # -class Kmod(object): +class Kmod: ''' class to manage loading and unloading of kernel modules''' names = ("hwlat_detector", "smi_detector") @@ -184,7 +184,7 @@ class Kmod(object): # # base class for detection modules # -class Detector(object): +class Detector: '''base class for detector modules''' def __init__(self): self.type = "unknown" @@ -293,7 +293,7 @@ class Tracer(Detector): 'threshold' : "tracing_thresh", } - class Sample(object): + class Sample: 'private class for tracer sample data' __slots__ = 'timestamp', 'inner', 'outer', def __init__(self, line): From patchwork Thu Nov 11 20:41:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 517444 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 137FCC433EF for ; Thu, 11 Nov 2021 20:42:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5BFE6120D for ; Thu, 11 Nov 2021 20:42:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233593AbhKKUpS (ORCPT ); Thu, 11 Nov 2021 15:45:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232970AbhKKUpS (ORCPT ); Thu, 11 Nov 2021 15:45:18 -0500 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A13F4C061766 for ; Thu, 11 Nov 2021 12:42:28 -0800 (PST) Received: by mail-qt1-x82c.google.com with SMTP id z9so6489795qtj.9 for ; Thu, 11 Nov 2021 12:42:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kjiL7SuI/grP29vHh7MKCCeptCljIVYsQ+EpHkyl8zk=; b=mIDBqQQJGwqZQflByjr1SvLGuDByvae9o77S9JNu6ooMxynzWgC556mRLxBtx5fr2h MB4d1QnnURKrft2EFE27kQuNdCRHlfzLQ9L4f0+za1vH8dCbhRuZPlDr40/QPN7ouA8C 3hSpN2x6fT1fKj+30maT4Q4B7QkPJQsfruq1zEsVUSViFO+T4W2WUMXdO19DiXx6Pv6E XF+BcCNIR6uAup2xaDuMWaxAisV4hhlWxwhrSkXdd9rc2EJ2IcnHc+wHrMk/5nafRIl3 AVebjePUAktRWFNDcIuNl11Nf4mCG3nlAW4s957YAVHJNwPbLH/wM4DJrTbYfa4WNujY sAkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=kjiL7SuI/grP29vHh7MKCCeptCljIVYsQ+EpHkyl8zk=; b=1o4JPxnbpm9jkaY0YvIRFt4tyc2TfQlpmp3pqzPlYAL2TZsTcsWrV+DJYFcult+Y/6 0Q145r2iNzd8y1INbH2Wwy5OEslrka3Hs3lf4Hv7yE7mmD3wBy41HchuB767KYh0HO24 4FbRTEjXL/6uutSJbfkEa5etR8HbCHyzguQjYRLnXJ4lJBG8849IGFJUd3cHQoalj53R wQT3T3WbbRkV8Pmm8YDGmcayVg9cahu5U0PvST+a09EXBkDoKUwiVQa/uLGKdvAGa9cP 9NHWgbDAKfWDwAvYojDDw55tl8Xgipozzy/a7Z4nBbp7pi2mJnetHrZg6pduAK+FyXQw Fceg== X-Gm-Message-State: AOAM531V8sJzgR03U2UwvOnLJSp//pSP33StfAZ1PagYoshmGnV0m71M yCO1AIPkXTPN8MSH/48m5ha8cABaG44= X-Google-Smtp-Source: ABdhPJw2AN9EkvZAc/SOEUgWfwctWz/Tr/qN+y7jRgsQgBU5eefMLOQIHHdu8xkSRjMgec+XqpMhbA== X-Received: by 2002:a05:622a:246:: with SMTP id c6mr10837635qtx.305.1636663347515; Thu, 11 Nov 2021 12:42:27 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:27 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 02/17] rt-tests:hwlatdetect.py: Remove multiple statements on one line Date: Thu, 11 Nov 2021 15:41:52 -0500 Message-Id: <20211111204207.10167-2-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Remove multiple statements on one line Signed-off-by: John Kacur --- src/hwlatdetect/hwlatdetect.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index ac87036d4c08..66e132b8c2a5 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -19,10 +19,12 @@ quiet = False watch = False def debug(str): - if debugging: print(str) + if debugging: + print(str) def info(str): - if not quiet: print(str) + if not quiet: + print(str) # # Class used to manage mounting and umounting the debugfs @@ -358,7 +360,8 @@ class Tracer(Detector): val = self.get_sample() while val: self.samples.append(val) - if watch: val.display() + if watch: + val.display() val = self.get_sample() time.sleep(0.1) except KeyboardInterrupt as e: @@ -425,7 +428,8 @@ class Hwlat(Detector): while val: val = val.strip() self.samples.append(val) - if watch: print(val) + if watch: + print(val) val = self.get_sample() time.sleep(0.1) except KeyboardInterrupt as e: From patchwork Thu Nov 11 20:41:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 520115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D21FCC433FE for ; Thu, 11 Nov 2021 20:42:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B469961267 for ; Thu, 11 Nov 2021 20:42:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233735AbhKKUpT (ORCPT ); Thu, 11 Nov 2021 15:45:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233717AbhKKUpS (ORCPT ); Thu, 11 Nov 2021 15:45:18 -0500 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 678BAC061766 for ; Thu, 11 Nov 2021 12:42:29 -0800 (PST) Received: by mail-qv1-xf34.google.com with SMTP id b17so4847391qvl.9 for ; Thu, 11 Nov 2021 12:42:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RCr04HCF5hZaZp2AKkVfQMUO0Oovq89CKtfLUbyGQtU=; b=nI0SYUX534mp3LsgeweuxoZBXjbP4SB99Fnu8nmrywmhgZ3mJ/f0QZLWI3Tx9YpM2+ C79qjZHvSWy/XpjCSogrGDCpfa1z2vxBdGdcSL/pf54SE53zCjLeVwTE7lpobGSZdIzV eGCJVn/nQpScTNHiHYeFulBEHhsTl1nrZb3eurbQwcDaGme5GQQZD7iCMM/rIqLwUz3h sFxsr57kqFRNv7pGeEBZx6k9tawgPwhvlBXq6ngchhHg25rw39qkcVY9W+s/6n+tGwAt lpiOnQHhaWzXFT1TqrcJ5MKC/1Lf9YwJp3GwP578W3fFn4d7hsLHY3zOyDsndMzHUIeF 9c/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=RCr04HCF5hZaZp2AKkVfQMUO0Oovq89CKtfLUbyGQtU=; b=vs+FOzzdXbj7RVSIp5sBeeN4ls9X+MUGiiGZAHBzrP6e7bPwySfgxmkYKVs6dYx7Ek fzmzTjneGGR2AAI4epB7le9N6G2Gz7Ww4J0kyhL7D48jhTsj2Uux1S67UnaBvYgB0/Zw F23uwLeREhln9qDaMz+xUfzg6L0n3ZtAfvMHHTjRQMvTuN8pmtOlLpE4cRFHQU+WGZ2N /fy9gR5rRvSifsdP8U3VNgs8+9WF3muUYgaP80E+s8zNWBjtX5Sz8S8Bi+OmW9yeHRK9 7ykP2gZHNxhUrP1UR1BY+Z73yJygdDCEk0dhKNy9OB18Fcx+RvvFSc9woHivXaELI69S KDfw== X-Gm-Message-State: AOAM533pcd4zlT49LuDbEe+YdWeLV9YldOWyIvo5iQtUK0GxfYcpvy1y ZDxhyjJ1yAV3CKDAkPSONo57qOGnPkc= X-Google-Smtp-Source: ABdhPJwrDmIIBKEHmQVmQu1Jk/w/RSPyJ06f1cWHFml2fDBnxiAqkH0Z/fCU2rpFLJ4uV/L//CzjbA== X-Received: by 2002:a05:6214:29c5:: with SMTP id gh5mr9645656qvb.10.1636663348334; Thu, 11 Nov 2021 12:42:28 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:28 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 03/17] rt-tests:hwlatdetect.py: Remove unnecessary 'not' Date: Thu, 11 Nov 2021 15:41:53 -0500 Message-Id: <20211111204207.10167-3-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Remove unnecessary 'not' Signed-off-by: John Kacur --- src/hwlatdetect/hwlatdetect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index 66e132b8c2a5..5a66280fb01c 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -66,7 +66,7 @@ class DebugFS: return True debug("umounting debugfs") cmd = ['/bin/umount', self.mountpoint] - self.mounted = not (subprocess.call(cmd) == 0) + self.mounted = subprocess.call(cmd) != 0 if self.mounted: raise RuntimeError("Failed to umount debugfs") return not self.mounted From patchwork Thu Nov 11 20:41:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 517443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19DECC433EF for ; Thu, 11 Nov 2021 20:42:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F234A61267 for ; Thu, 11 Nov 2021 20:42:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233799AbhKKUpU (ORCPT ); Thu, 11 Nov 2021 15:45:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233717AbhKKUpT (ORCPT ); Thu, 11 Nov 2021 15:45:19 -0500 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 415EBC061766 for ; Thu, 11 Nov 2021 12:42:30 -0800 (PST) Received: by mail-qt1-x833.google.com with SMTP id j17so6527471qtx.2 for ; Thu, 11 Nov 2021 12:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=46vtULk9l03ohV75J2qJG7sIz/1R6e6jU3tG3Bv73cE=; b=HhsmqLBQ1tx6rrnnh0oP1PX2FN0dJMO5OJ+y+Yjz1ck6Xcos0/iHc3dt1BGagpHia0 hJbIBLC3e4sD6q4WVKZbBlkoiMDEMJj0HsWVw3UBWR3HKioLrSx42RZlcmWm2kYwDe0c rbi913SRx95CJXwGDO65sQQ0hpDhx3IzT9sShmzde1AtpUoZKYKT9ut18w9/OJUONPGT rJaIH+bwqxYa83nMbbXyrFyt+Q18ALkGAx41adxrv5tmQ0KIiVBOwa4hAtgW2D1tGYx2 E1YF+pmopj09oL4iyPSFquAYl47KJw3K9TRWEDWaGnCW4TdTWBcnCVsJrAj3SFgzcwmE rNJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=46vtULk9l03ohV75J2qJG7sIz/1R6e6jU3tG3Bv73cE=; b=yVfNSwpiwp/hCSTPQCPmhuXoAQlnko6rdk49NcGoGI5r4An1Vn02Y5ud+PAFBRbx24 iFIkMG9eNyUwuEcrzeuoNXBJ7RhgiOK54bx3XcpyVXwowynzmZRIibi8udeGCMyC0mlJ Obat5rsLjoj5FdGuMzafmxZLjXn4scnGeeC01UW2eA1KIkxXqyrYGXMGrknvepTWaH3y uuYXlY9OxVODfh3jioQqeYNvDvwHegklPkJK1NC/cK0YGxMtYALFwLQBMRO4gjDUg2OP wT82SZ+BbrR5c6TZTihSTn4ck+1DCaY0pE2mIunr5TVa5bgTuCePBG5oV+NnybCtAa5m ERXw== X-Gm-Message-State: AOAM531F78LORlnwU/yGXlrntrTT7DzzWR+1erMXgtxVM92BvK7YYVii 9lKLIflwNxFoq21zg2jpwL2lBGcZHao= X-Google-Smtp-Source: ABdhPJx7hgAIUE2QVttZtP1EtRh5EvSaXPk9fPUXzgo8DH+dJX4JlXdwRlXXXYFGPWOzD7OlzEQWMw== X-Received: by 2002:ac8:5f53:: with SMTP id y19mr11028659qta.97.1636663349133; Thu, 11 Nov 2021 12:42:29 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:28 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 04/17] rt-tests: deadline_tests: Null check to prevent floating point exception Date: Thu, 11 Nov 2021 15:41:54 -0500 Message-Id: <20211111204207.10167-4-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Fix a floating point exception that can occur if sd->nr_adjust is 0 by checking it before performing a division by zero. Signed-off-by: John Kacur --- src/sched_deadline/deadline_test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c index 53abd4d2ca6b..b7e1e045b57c 100644 --- a/src/sched_deadline/deadline_test.c +++ b/src/sched_deadline/deadline_test.c @@ -2050,8 +2050,10 @@ int main(int argc, char **argv) printf("missed deadlines = %d\n", sd->missed_deadlines); printf("missed periods = %d\n", sd->missed_periods); printf("Total adjustments = %lld us\n", sd->total_adjust); - printf("# adjustments = %lld avg: %lld us\n", - sd->nr_adjust, sd->total_adjust / sd->nr_adjust); + if (sd->nr_adjust) { + printf("# adjustments = %lld avg: %lld us\n", + sd->nr_adjust, sd->total_adjust / sd->nr_adjust); + } printf("deadline : %lld us\n", sd->deadline_us); printf("runtime : %lld us\n", sd->runtime_us); printf("nr_periods : %lld\n", sd->nr_periods); From patchwork Thu Nov 11 20:41:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 520114 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFBCAC433F5 for ; Thu, 11 Nov 2021 20:42:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C435861212 for ; Thu, 11 Nov 2021 20:42:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233717AbhKKUpV (ORCPT ); Thu, 11 Nov 2021 15:45:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233781AbhKKUpU (ORCPT ); Thu, 11 Nov 2021 15:45:20 -0500 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE4A5C061766 for ; Thu, 11 Nov 2021 12:42:30 -0800 (PST) Received: by mail-qk1-x730.google.com with SMTP id bi29so7064443qkb.5 for ; Thu, 11 Nov 2021 12:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hnw/DVMpLbd7oTQxh+AdMBwH9ATxBNLi4VOmvW2vzgc=; b=CH0Z72FDTNskfIbX0oeXw3+AlEk7XGYiVKfIp7J0qNxUjsPWXnuAnd88uWuWSAwtxY NJXjN7JEBJ+c5jD0OyLtL6kGvE/GOZb+sb4VJKE3gEZ7xGb8O9gCnyZOigrNQ36HHP07 hDX4oU23UNlGU6eYc3uenQ9eL2VaDPlAQ/m6XBHwPx8PyoLTJMkj/ePpDQlOgEVJbdFD MAas/7rzrhTrYyMdtZ9mdAGE0H3M0UbAM7mzyYyUdHn7IsMMK4EY4WNM80oj0sbLOkNn nt56Wnpq9zU1KQ4Kj4Q8TODOurW1/LuFrKBqqZ0YWt+uYj9OzDBg0VIycGRuEqL3TbCo yzeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Hnw/DVMpLbd7oTQxh+AdMBwH9ATxBNLi4VOmvW2vzgc=; b=2QtEfjoIkuSpRFe3OaoiOfLv3RLBCt4tbr7uXeim7ibuSPkMXtNIouRo4eb9wutnM8 JEU1qHaTBckcIhVA6q44TN8ckDHrfVv8xPso9dqaKhrKkxWhSk66K0TgQCRTxZlmpl4N 0gG8orUxmyyuO7pBmwbkHr3B5DEfJ8rRwmPCNGxVM8XQP2fbKZH6TXmIOYdTRluEptHT ka3pAA5TuZxx+maA4hytxSrjaUT2BSIzMOsiLRKTwHIHrd9kqebyWtidxwatPVR6h/C0 ah19oZmX3rT1NMYxG0YphBsgKPODiOF9MPXPcSXas+CS9U1tkktR3w6ngpFvv5rJIBlS gwIw== X-Gm-Message-State: AOAM533yNjB7hmkR6HqQ044O2OnerruBt0m8mL6Ydh6g0VlDCx3rzZM/ cW/9D1RF5vtr/Mx4a1zVsqG0GhfQM54= X-Google-Smtp-Source: ABdhPJy4bfDiW8o0MN6BzEDg2DfFizwfEnxVJy/56SKIwpAvMGAOFCgX7ETtAlDMY5tiWazACMXDJQ== X-Received: by 2002:a05:620a:b4d:: with SMTP id x13mr8531849qkg.430.1636663349872; Thu, 11 Nov 2021 12:42:29 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:29 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 05/17] rt-tests: cyclictest: Check user supplies an value to histogram Date: Thu, 11 Nov 2021 15:41:55 -0500 Message-Id: <20211111204207.10167-5-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org histogram and histofall take a required argument. If the user fails to supply one, display the help and exit with an error Signed-off-by: John Kacur --- src/cyclictest/cyclictest.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index 2187d98de725..e4d43481de97 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -1089,7 +1089,10 @@ static void process_options(int argc, char *argv[], int max_cpus) histofall = 1; /* fall through */ case 'h': case OPT_HISTOGRAM: - histogram = atoi(optarg); break; + histogram = atoi(optarg); + if (!histogram) + display_help(1); + break; case OPT_HISTFILE: use_histfile = 1; strncpy(histfile, optarg, strnlen(optarg, MAX_PATH-1)); From patchwork Thu Nov 11 20:41:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 517442 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7419CC433FE for ; Thu, 11 Nov 2021 20:42:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6151861212 for ; Thu, 11 Nov 2021 20:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233806AbhKKUpW (ORCPT ); Thu, 11 Nov 2021 15:45:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233798AbhKKUpV (ORCPT ); Thu, 11 Nov 2021 15:45:21 -0500 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C06C8C061766 for ; Thu, 11 Nov 2021 12:42:31 -0800 (PST) Received: by mail-qk1-x72d.google.com with SMTP id bq14so7082423qkb.1 for ; Thu, 11 Nov 2021 12:42:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FNsiKwaE7yyqpuQNBRiErLvDPCuk2jinPy0Sq9+YoDs=; b=DOfTwtYiK4EtAc6ylGQ3JYwWYbuttItZ5EqW2sJYW14HBoTxMG6TVl+84Mm9nTcXWo GxkZBnwET6R59yqxTlv01d8wXyT9tttXONI6NUAcIR1EB28/OuXEncBoWF+H/y1PgOh5 l8d7O1CaUBv7H8bHZEtg+//A5q7tqfTT1+iTkUBRF2LRYOj5X9DnrWM0Ufcd6MMvHCEI vf0BZdO2B0avfo/3HYdO5QY0x0s0qs1l111l65m4R+WQXjz7d/5QT14FZ9+8qi5822Mb +KAWj9LDU1mjuGyLqRhS7NEwnml8ziFvTHdQUDtkqOpu89NrFbXO2GmTXmWqOVYmdBBB FHqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=FNsiKwaE7yyqpuQNBRiErLvDPCuk2jinPy0Sq9+YoDs=; b=aApyUpLn7+QS8WTnkYfImfIPVV0v53CIRlj7ZOSWCQVFozETnFMCIUUHS9ocus8fCL nnDQB/aR3P21E/hCGWjs9WfF+mjewlTv5Z7NVKGhuEZ0ZxYKkl+sC47OW5MkkHjK1TsS 5COPxpFDNHK6BJcqK1Juunv7+KYZKtQutG8WrOR36QM6hPQnGyoydjRz6UYXjxyNdzO3 uBKgcYehfoLEFyODPSPu0bZ1OiQTxvgLCPf0pmOyA6E1paSETy8x6KQbsCtHgih8ixuL wScxW6ets713t5/aCm3wNbEYwFVkymggwtSZ8Fzbe2EaSt5Rbzs/tnmV3JubPT/D3TPy TPIg== X-Gm-Message-State: AOAM532Xuq6YzuIsMlvVXtOxkCQJKjUit8aj5G5xu3Z4DljIK/9CdfAO HREM/M4u2FkZGfiUt1AiY4qeTNuKxFA= X-Google-Smtp-Source: ABdhPJxDh+cqN2iStW6W2VLiq2st7tZbPHOWVZvyZc0VX23tBdW4L1rWn1ZORUg7oQosDavF4CfZFw== X-Received: by 2002:a05:620a:46ac:: with SMTP id bq44mr8622558qkb.414.1636663350706; Thu, 11 Nov 2021 12:42:30 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:30 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 06/17] rt-tests: get_cyclictest_snapshot: print_warning should be a classmethod Date: Thu, 11 Nov 2021 15:41:56 -0500 Message-Id: <20211111204207.10167-6-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Make print_warning a class method since it only references a class variable and doesn't require self Signed-off-by: John Kacur --- src/cyclictest/get_cyclictest_snapshot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cyclictest/get_cyclictest_snapshot.py b/src/cyclictest/get_cyclictest_snapshot.py index aed9681e4cc5..aedc72001fb2 100755 --- a/src/cyclictest/get_cyclictest_snapshot.py +++ b/src/cyclictest/get_cyclictest_snapshot.py @@ -21,10 +21,11 @@ class Snapshot: warned = False - def print_warning(): + @classmethod + def print_warning(cls): """ print a warning one time only even if called multiple times """ - if not Snapshot.warned: - Snapshot.warned = True + if not cls.warned: + cls.warned = True print("No cyclictest instance found") def __init__(self): From patchwork Thu Nov 11 20:41:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 520113 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 363A3C4332F for ; Thu, 11 Nov 2021 20:42:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 213046120D for ; Thu, 11 Nov 2021 20:42:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233859AbhKKUpW (ORCPT ); Thu, 11 Nov 2021 15:45:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233821AbhKKUpW (ORCPT ); Thu, 11 Nov 2021 15:45:22 -0500 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82ADDC061766 for ; Thu, 11 Nov 2021 12:42:32 -0800 (PST) Received: by mail-qk1-x730.google.com with SMTP id bq14so7082442qkb.1 for ; Thu, 11 Nov 2021 12:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w+gTMM0sQES9PPV3WtfUHy1YJmNmttjJxy8MV/jL95c=; b=Hk8BL23BOoncUBV7VKZA5JBuDaFFOEuL36abWeUoWEPaOVtu2sle2NEdQTQhLlL0fP sy/4jVuFbaS3Nretyg9ya7WYDudLsFgbz7cEKlEw24HwFuU4E/Xw7V6/pTEmK1FsoBQn fitx3+CMUW0TNbEjPy6Tbc+wogaePtXzK18T/g00ys0AkZ3SJ6wLzJItiuQKCgD3adMX pZmSw15XmCxyzOqP0wz+EAA0lZdPMetgwKEWK1qQL4W+dmsmzEosTsnI+hFPhYg4C03d azH/9ydUTPCQc4+G5Enow8NDNZQPl3I6PDy//FwnGso5FmdZdkvMUdxaBCIyXLdbBCT6 a5NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=w+gTMM0sQES9PPV3WtfUHy1YJmNmttjJxy8MV/jL95c=; b=KqSxDnu/ksxbSVabpZP1+snIwhVfBvhe+dxsoRPnjInc/nN/YlXScRA0oAJcef4acu hpIEiADbOQLLOluwmNgp1KK9Mi9d2fz523dS11xqzqESTUQ/75TgKFxpnr38RPhu5Wu5 MfudwJbh/TqnNK1/fY6o29/JFDEMJ/kUoB/JXlNFKZ5EPnzywbBtGkD8Sf0dsspsDTEP n9N9QpfNYVCMlaCM7uVkJ6MmhhQZrHjJuReJ9j7c8/B73mRw201QD3GpSodsl7fgLb6J VgJwzOuQ/lGFo4MCowWkjyBxXt1Bstu0CGXJSH9H6h8VInWsJAte00Cf2RLY9rBNdfDs 3hnA== X-Gm-Message-State: AOAM530e6bu3O1kudum0Q7qgCkCgQOl7LDfI/QZqwE7wL5zLYIOCQNyv Omd57rz/ACAH/xJKHrXhqzW8XIEGJCw= X-Google-Smtp-Source: ABdhPJwIQDxzIglMBxyjzO9XkzS9gV7NsNXR0knVv5O9VSbxLOG1jqdMMpNCvR8lCg0sP+5W6qteEA== X-Received: by 2002:a05:620a:424f:: with SMTP id w15mr8681121qko.258.1636663351468; Thu, 11 Nov 2021 12:42:31 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:31 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 07/17] rt-tests: hwlatdetect: Remove unnessary parens after return Date: Thu, 11 Nov 2021 15:41:57 -0500 Message-Id: <20211111204207.10167-7-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Remove unnecessary parens after return Signed-off-by: John Kacur --- src/hwlatdetect/hwlatdetect.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index 5a66280fb01c..2fabbb55b242 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -174,14 +174,14 @@ class Kmod: debug("not loading %s (already loaded)" % self.name) return True cmd = ['/sbin/modprobe', self.name] - return (subprocess.call(cmd) == 0) + return subprocess.call(cmd) == 0 def unload(self): if self.preloaded or self.builtin: debug("Not unloading %s" % self.name) return True cmd = ['/sbin/modprobe', '-r', self.name] - return (subprocess.call(cmd) == 0) + return subprocess.call(cmd) == 0 # # base class for detection modules @@ -494,11 +494,11 @@ def microseconds(str): if str.isdigit(): return int(str) elif str[-2:] == 'ms': - return (int(str[0:-2]) * 1000) + return int(str[0:-2]) * 1000 elif str[-2:] == 'us': return int(str[0:-2]) elif str[-1:] == 's': - return (int(str[0:-1]) * 1000 * 1000) + return int(str[0:-1]) * 1000 * 1000 else: raise RuntimeError("invalid input for microseconds: '%s'" % str) From patchwork Thu Nov 11 20:41:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 517441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2765FC433EF for ; Thu, 11 Nov 2021 20:42:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E55F61212 for ; Thu, 11 Nov 2021 20:42:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233893AbhKKUpX (ORCPT ); Thu, 11 Nov 2021 15:45:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233867AbhKKUpW (ORCPT ); Thu, 11 Nov 2021 15:45:22 -0500 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F86DC061766 for ; Thu, 11 Nov 2021 12:42:33 -0800 (PST) Received: by mail-qk1-x734.google.com with SMTP id bq14so7082470qkb.1 for ; Thu, 11 Nov 2021 12:42:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u+9mwUvbRbvgV/9VKtFJuZpgcs1shqRnqERFSrUpDbQ=; b=HYXzgTV5rsaXuXERvE0yjfcqyLGLz7bjV35rI+XaiO0U6/B1RINd398TWlhQTvT2cR 7BXIg3i6/JN3L+7dDTZ6Tc8gzXVfIEfkiQc7QbFIGYBEo0p1tpSBW8/c09RW/v+EquL7 H24PvAZVL5SBWHLimmqzVTLY/8ZrMkt0bMzS6MH2vVqvgrm9s+Nz4sreXJeScIutVRtb fTsTN5uis6G4twKc88og+ZjavLWsByjpCduNIeDFsgPjIfy6nDvny0GaTmsJ/mm3wYxx Ojr5AYOxcM9g/WvgW6s23ILsAzfKr0CxMPrO0j12lOVW/LxqQKy0lPpt2V1KVym9QKzQ HwDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=u+9mwUvbRbvgV/9VKtFJuZpgcs1shqRnqERFSrUpDbQ=; b=oPJFoKqmopwJeH+6WrEY7Kp0bwqcfutzHiKxUvjO4mv4FY6+SObuLtzBITZtAiWUTl XdEsxAujTHRKCKymYXjE9kdGXklXOYAPNolu5EL8RBkmGqfm9Waiw3X06GP6X/2k8WqW CkpccKpD7vISLQedQAc6ZnB//mbddM2gp6FMTkiBohQDO4odW5xKzxGbJg86G2EIVQgX A6uRXrZBbo8dADpwSj6sdIvsrQFbNN5oNCumyvgvdRFYPMGR18+PCPLpWpJNqBfkzLkI 16PBop9SKLkyGs4c6p/aHs0NYF4I/cvWzrnNefZF9AJ59MqSMyutjJBY/zfanwxPKh6l ewqg== X-Gm-Message-State: AOAM533R3cdS/n59wxE3RgT6SyG/OfC/uXa+d++eJq9XG+kDWSc8ZJWW lU+CDDBKBU2tLJFnvZRC3a/w8Ls85uI= X-Google-Smtp-Source: ABdhPJzLRnqFQy2uil6o76LEhmYByVzdC4At6yCNjh6j3VKPWPTwBeGEJA2+Kdjle/mcDUxSjV0WoQ== X-Received: by 2002:a05:620a:1901:: with SMTP id bj1mr8600192qkb.325.1636663352367; Thu, 11 Nov 2021 12:42:32 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:32 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 08/17] rt-tests: hwlatdetect: Use "with" for opening files Date: Thu, 11 Nov 2021 15:41:58 -0500 Message-Id: <20211111204207.10167-8-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Use "with" for opening files Signed-off-by: John Kacur --- src/hwlatdetect/hwlatdetect.py | 43 ++++++++++++++++------------------ 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index 2fabbb55b242..a530867777a7 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -39,14 +39,13 @@ class DebugFS: self.premounted = False self.mounted = False self.mountpoint = '' - f = open('/proc/mounts') - for l in f: - field = l.split() - if field[2] == "debugfs": - self.premounted = True - self.mountpoint = field[1] - break - f.close() + with open('/proc/mounts') as f: + for l in f: + field = l.split() + if field[2] == "debugfs": + self.premounted = True + self.mountpoint = field[1] + break def mount(self, path='/sys/kernel/debug'): if self.premounted or self.mounted: @@ -74,9 +73,8 @@ class DebugFS: def getval(self, item, nonblocking=False): path = os.path.join(self.mountpoint, item) if nonblocking == False: - f = open(path) - val = f.readline() - f.close() + with open(path) as f: + val = f.readline() else: f = os.fdopen(os.open(path, os.O_RDONLY|os.O_NONBLOCK), "r") try: @@ -97,10 +95,9 @@ class DebugFS: def putval(self, item, value): path = os.path.join(self.mountpoint, item) - f = open(path, "w") - f.write(str(value)) - f.flush() - f.close() + with open(path, "w") as f: + f.write(str(value)) + f.flush() def getpath(self, item): return os.path.join(self.mountpoint, item) @@ -378,10 +375,10 @@ class Tracer(Detector): def save(self, output=None): if output: - f = open(output, "w") - for s in self.samples: - f.write("%s\n" % str(s)) - print("report saved to %s (%d samples)" % (output, len(self.samples))) + with open(output, "w") as f: + for s in self.samples: + f.write("%s\n" % str(s)) + print("report saved to %s (%d samples)" % (output, len(self.samples))) def display(self): for s in self.samples: @@ -443,10 +440,10 @@ class Hwlat(Detector): def save(self, output=None): if output: - f = open(output, "w") - for s in self.samples: - f.write("%s\n" % str(s)) - print("report saved to %s (%d samples)" % (output, len(self.samples))) + with open(output, "w") as f: + for s in self.samples: + f.write("%s\n" % str(s)) + print("report saved to %s (%d samples)" % (output, len(self.samples))) def cleanup(self): if not self.kmod.unload(): From patchwork Thu Nov 11 20:41:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 520112 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC984C433F5 for ; Thu, 11 Nov 2021 20:42:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4C6361212 for ; Thu, 11 Nov 2021 20:42:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233798AbhKKUpY (ORCPT ); Thu, 11 Nov 2021 15:45:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233821AbhKKUpX (ORCPT ); Thu, 11 Nov 2021 15:45:23 -0500 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23CCFC061766 for ; Thu, 11 Nov 2021 12:42:34 -0800 (PST) Received: by mail-qk1-x735.google.com with SMTP id 193so7018567qkh.10 for ; Thu, 11 Nov 2021 12:42:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/WZLgOq8F5tPhfhULIOExhg2KDius+GrjATYY/2Uk30=; b=VgjdphbAAMh6TywapcK32cq0RGCYWMXpSkSrk+JT7/1GapfjlaUn3fSv7AkOtR+aq9 Ssyf7+pXPmUI1aUj8u5ZM6JIOmuKfTK8s9iqlzSRTFmUALMaE/tGY9T3a4rq2gwMb3X/ Bj9U2bIcFlSI/T43pUjnL0Sj5bxYygX0BGE5kvDHmOw3aPg0ceOzDXHifNg1MiwPKJ/E Riml8XXU/rq0nsfdip616Mq7mppQLvg+iMba9l5v9EK4uPFmeLrCv5CWRMS0Ou7HcSVz u6Pk+d6JKXimGSSXepPnJ3rU3CXcRQ7vJ1QzIFcBKkVMS1D5pAuYgFkFt0i3X+RE9iEa Jhtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=/WZLgOq8F5tPhfhULIOExhg2KDius+GrjATYY/2Uk30=; b=68D1laJHY4GPlJ7JXakxnkcZIbuBIlkwMdu03CEauVktfXIEVqStFEZSfrkFXFQZDn 0D5WyBjBjqwfTlSgTFX4yiVBofvEXoibYeteCoLGi1DV29f9mpyZd1JAgeKByTbNZz3y ObT49GiLaVcM6N7Ge2wjWSJ9TjEZIjhP82UJKW9R4nsz4cvX6JMVek+CHwa9MEGlsCbm TujxEIeSvMbiQ2ZY4EvEkv7jUmi3KnklLwnmPFC55IYqJ3uCi6sB2Aw01ruH/UZG3OPF rQ0V8SHo1Y1NwN9aIM8gAcozdR15rrUGx/X278XCZPDr+AnPav5aI6B12tWXMFOveSc4 oHug== X-Gm-Message-State: AOAM533l6IfnIVLbaPfj/lbbl+G43aetY1CTX7MjFsjlMgqqlRKmO37q hdrKrFVLwJ69M8CXvxJwZROuG7WghRE= X-Google-Smtp-Source: ABdhPJysK9EECxG2VuIEqlwbrJIwIWZwZSFptIfxSe3sJzpy8sE5XI9WUjlOPhlczND7xkDC/9HMzA== X-Received: by 2002:a37:a811:: with SMTP id r17mr8392457qke.305.1636663353112; Thu, 11 Nov 2021 12:42:33 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:32 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 09/17] rt-tests: hwlatdetect: Use python3 style super() Date: Thu, 11 Nov 2021 15:41:59 -0500 Message-Id: <20211111204207.10167-9-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Use python3 style super(), no need to specify __class__ and self Signed-off-by: John Kacur --- src/hwlatdetect/hwlatdetect.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index a530867777a7..7cd038ba913e 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -321,7 +321,7 @@ class Tracer(Detector): return os.path.join(path, Tracer.__field_translation[field]) def __init__(self): - super(Tracer, self).__init__() + super().__init__() path = self.debugfs.getpath('tracing/hwlat_detector') if not os.path.exists(path): raise DetectorNotAvailable("hwlat", "hwlat tracer not available") @@ -397,7 +397,7 @@ class Tracer(Detector): class Hwlat(Detector): '''class to wrap access to hwlat debugfs files''' def __init__(self): - super(Hwlat, self).__init__() + super().__init__() self.kmod = Kmod("hwlat_detector") self.type = "kmodule" self.kmod.load() From patchwork Thu Nov 11 20:42:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 517440 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FF04C433FE for ; Thu, 11 Nov 2021 20:42:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 31F0C6120D for ; Thu, 11 Nov 2021 20:42:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233781AbhKKUpZ (ORCPT ); Thu, 11 Nov 2021 15:45:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233902AbhKKUpY (ORCPT ); Thu, 11 Nov 2021 15:45:24 -0500 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE1EDC061766 for ; Thu, 11 Nov 2021 12:42:34 -0800 (PST) Received: by mail-qk1-x734.google.com with SMTP id r8so7051232qkp.4 for ; Thu, 11 Nov 2021 12:42:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/70NDWtFADJZ2D5orO4XuXW8lgm63Lh3F5Fn6MJhWmM=; b=K/0dS9TYfoVY9y8ftPaJZXehQo+oRVevrPdVNx+TEgLJCJ17vjl4Ieolp8+GiHGfw7 Qa+SSznkdDMUoCUohCZ4TGesUKGr3ESWwK30Wxw7ZjvKM6cEiAI2+JNTZKR1F/J5cVjP 9GWUYmBQEWTGoUAS5HmSH9P+sK5SmWWUDGPJytqHec3Tbte+cCXN67GqionzKtOgiHGm JJA7fDwsM8qlEXN0VlkE+3IwFEg30wLhouy6ZCzBj9dfgGtLIpKAjDo1P432VUQtAsVo FK4ZAKkqz71aaWL98dXj4R7SXGtqy3LXSBl86qm04573gDhDipYWgfgiH8ZkWUkRFwME CuJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=/70NDWtFADJZ2D5orO4XuXW8lgm63Lh3F5Fn6MJhWmM=; b=HmST8rWalAbdAL7Ya764TjBx3WxmoZqP1zEPhEK6MWTaA5kH5bG0BgIzItcOnJd8pV igjo5yRC1uRhJjanKcnHgZ6SojAUr6+8kvvuoE80D3+mM9mhNy0zmMMs3pG9o2kzY6yc gBKrV5eU3xTeJGpYVswRltgB01KyUl58yn162AJCSWw8Y/KICsNN1qa6FVQbBmrKBWul 6wRrgXnPovPX0Ekx46p2PS/GvXffoP4FdvffFLcjqo3RRZUXRhgJ8Qag7vlsad9HNt9J CgjvsTKV7tcWtj+b06Fx6N3a6DI34wTCPRYVAZOYJmFzqAUzd3BLMnn+sqF1sFerfJs/ mZ4A== X-Gm-Message-State: AOAM531d3avwAjgLyrnFWhhAENaCY1OXELkyF4qKid36AYoRNPtlFJ/8 5GYlQKstqV7/3YI1pQRMGN7yLyPIRto= X-Google-Smtp-Source: ABdhPJwMmDi6EcBsdXKrCAxpIwySRdr77RaAUR3GVIbV9KIgCoAwMjN0GqiPxu1eSNey33hA18XKaw== X-Received: by 2002:a37:f911:: with SMTP id l17mr8138639qkj.513.1636663353822; Thu, 11 Nov 2021 12:42:33 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:33 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 10/17] rt-tests: hwlatdetect: Keep consistent name from abstract method Date: Thu, 11 Nov 2021 15:42:00 -0500 Message-Id: <20211111204207.10167-10-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Keep the variable name consistent between the abstract method and the method overriding it. Signed-off-by: John Kacur --- src/hwlatdetect/hwlatdetect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index 7cd038ba913e..c07ddbb0e89e 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -239,7 +239,7 @@ class Detector: '''set a value in a debugfs field''' raise RuntimeError("must override base method 'set'!") - def save(self, reportfile=None): + def save(self, output=None): '''save sample data to reportfile''' raise RuntimeError("must override base method 'save'!") From patchwork Thu Nov 11 20:42:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 517439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20B8BC433EF for ; Thu, 11 Nov 2021 20:42:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E3556120D for ; Thu, 11 Nov 2021 20:42:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233833AbhKKUp0 (ORCPT ); Thu, 11 Nov 2021 15:45:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233902AbhKKUpZ (ORCPT ); Thu, 11 Nov 2021 15:45:25 -0500 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B551CC0613F5 for ; Thu, 11 Nov 2021 12:42:35 -0800 (PST) Received: by mail-qv1-xf2a.google.com with SMTP id u16so4861332qvk.4 for ; Thu, 11 Nov 2021 12:42:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ywbKNOlYx0IPa2Vq8VrZeNiLpi2ef5xi2+Prr8Nzh/E=; b=ZUbxkkv2ZOAneeHa3R5Xd++ojNtsa/Ktl7DJH22EU4lE6z4Bm1OUhHx95J/+EMciyg P6MeGJ5pLSROS1Do8mZenZhb6iz6nx8LtCBX8iYYSJ+yGwN+lR128uz3G6pnJAm+ezF6 JOLUTvoBQwg+ihhG0hFky7h4OjzQZerQHO3c97dwXB1g/hnptI7wMHwcec0Bn5udzwKR BO7PVj+KEQRjYd0vR6ozVmBJJ4tS30u9R/1uHs1XfTUo3mA+FB7TVLuaDRJdRTrQ9OYy IPyHV7DUO+ActCzjRqutuZVXHmCRe5y73LHotKiq+88vhSYYR14vCUWAP+eX/BUZO6nM sXUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ywbKNOlYx0IPa2Vq8VrZeNiLpi2ef5xi2+Prr8Nzh/E=; b=3FbMA/5EaKh7P5w4+ypXyUj71QYX8XXhv9kK9ZEb414LbZPcgkgEaqjiebJiR6yrKH 8ucppO9ad8dREQTNTD2roabEUS+Plue1fcFSu8HwLP4rrN3+Jtt1zU4gkBik5+8JM/R3 3H4GscRSmpF7+2fq3OawDVyylVNTmphU+bWmI70M0dx1YORLvRibsz2rOczyS8yIoiyT or9Ysm4FYNkLprhmU0ujX7pO2XRneQnSfFN4olgpP9vJPv1RfY4O4F9Ik56X7S/bFYM9 q9z6uWgj3iqXVAZm+dzaYzrFilIOMPv4uHm49hJnXktv6JQdMsIBT2dHPxqNQI57LO50 4e8A== X-Gm-Message-State: AOAM5321THoYTpTuRrDkeeYL20JWnUeADdaBnDjLA0lmlLiPHB0xaHFh zdyCcJBj7f0DyYQvk7IL4pEvQXWXyoo= X-Google-Smtp-Source: ABdhPJx2WnA8KBjq9zQVRuLR6v7J4XbpgJXc+8ULZcYn1VShs/6FpCx4lOOtR/Il6KuTY9vPygDK1g== X-Received: by 2002:a05:6214:2342:: with SMTP id hu2mr1858499qvb.9.1636663354549; Thu, 11 Nov 2021 12:42:34 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:34 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 11/17] rt-tests: hwlatdetect: Remove class Hwlat Date: Thu, 11 Nov 2021 15:42:01 -0500 Message-Id: <20211111204207.10167-11-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org hwlatdetect converted to using ftrace a long time ago. Since we no longer need to load a kernel module, the class Hwlat can be removed. Signed-off-by: John Kacur --- src/hwlatdetect/hwlatdetect.py | 61 +--------------------------------- 1 file changed, 1 insertion(+), 60 deletions(-) diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index c07ddbb0e89e..ff8265ac39c5 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -380,6 +380,7 @@ class Tracer(Detector): f.write("%s\n" % str(s)) print("report saved to %s (%d samples)" % (output, len(self.samples))) + def display(self): for s in self.samples: s.display() @@ -391,66 +392,6 @@ class Tracer(Detector): raise RuntimeError("Failed to unmount debugfs") -# -# Class to simplify running the hwlat kernel module -# -class Hwlat(Detector): - '''class to wrap access to hwlat debugfs files''' - def __init__(self): - super().__init__() - self.kmod = Kmod("hwlat_detector") - self.type = "kmodule" - self.kmod.load() - - def get(self, field): - return int(self.debugfs.getval(os.path.join("hwlat_detector", field))) - - def set(self, field, val): - if field == "enable" and val: - val = 1 - self.debugfs.putval(os.path.join("hwlat_detector", field), str(val)) - - def get_sample(self): - return self.debugfs.getval("hwlat_detector/sample", nonblocking=True) - - def detect(self): - self.samples = [] - testend = time.time() + self.testduration - pollcnt = 0 - self.start() - try: - while time.time() < testend: - pollcnt += 1 - val = self.get_sample() - while val: - val = val.strip() - self.samples.append(val) - if watch: - print(val) - val = self.get_sample() - time.sleep(0.1) - except KeyboardInterrupt as e: - print("interrupted") - self.stop() - return self.samples - - def display(self): - for s in self.samples: - print(s) - - def save(self, output=None): - if output: - with open(output, "w") as f: - for s in self.samples: - f.write("%s\n" % str(s)) - print("report saved to %s (%d samples)" % (output, len(self.samples))) - - def cleanup(self): - if not self.kmod.unload(): - raise RuntimeError("Failed to unload %s" % self.name) - if not self.debugfs.umount(): - raise RuntimeError("Failed to unmount debugfs") - def seconds(str): "convert input string to value in seconds" if str.isdigit(): From patchwork Thu Nov 11 20:42:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 520111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22D8AC433FE for ; Thu, 11 Nov 2021 20:42:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0686661264 for ; Thu, 11 Nov 2021 20:42:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233955AbhKKUp0 (ORCPT ); Thu, 11 Nov 2021 15:45:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233975AbhKKUp0 (ORCPT ); Thu, 11 Nov 2021 15:45:26 -0500 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7579BC061766 for ; Thu, 11 Nov 2021 12:42:36 -0800 (PST) Received: by mail-qk1-x72a.google.com with SMTP id r8so7051334qkp.4 for ; Thu, 11 Nov 2021 12:42:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Wpb+FIK9aVxcUGJ4/wV3peAtqkKdxJm2p173XNHD3D4=; b=F8Boc22ujx2qyOyZuHFau1IOrrSstqjMbkYq8k4KP1N5fZgaYVHZXqEqdNYD0eqPk7 psd6k89Pe9dZJZGDQA76UL5XyrOWeamMPCxjcXRMhUDrWLlxcNGtaVVtJbbbZArp+ZFn UnYzN5v0xVKCv3kXkjzmsK2Uz+KKpHxF+pnQbBMnOG0bA6JXb6hsf1J/J5EFRDz7RLBb CLEnxJFsGCf6b0pyD8NbulDDU/tnaPObOxiq+J8kakTcdl4K13L64ec+P1aUl/BLbmQT RC47rg69XZDs1SSaILMZe72LVoyRgDOcSG/D3w5VwSMSqhQ/LIYTSSn+pr+K4ZzkChYs iU5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Wpb+FIK9aVxcUGJ4/wV3peAtqkKdxJm2p173XNHD3D4=; b=mV5mRC/MJePWwMtTvKVwBoPrtbtvJ7tplOLXdPqG2xoNFTMcYWXJHLfEn6XNh6acaq hgqVIf5kWwQuqGvY6kB8VKBmdpRCnfPKTV9ZQVk40tuZFyYWvS7MwYsrCzU4f23Mu0W5 LlRPvStdS0uvh99VmlotlH5KiJ1ZGyMRXtiWB5L9/xlSSSED8uup+yYRtVSOpKTZzaBS EHVzkGK21IG1aZ9zAjI+YCtVA9y9RfbDVpg6DIzDycG5zyYW3n9sf7dhBuVCGIsN6ec9 kZ81m1hyPN3ueewERZAWPdSH6mFwiuHkvcWVGYTExLkGKq8lGD/k+2PoKQLpTT8z5tZO raDQ== X-Gm-Message-State: AOAM531xRmBNAt1W/yqf968EKnroCRv4OZAzmwg2IivtJtWonhPFu4gz 9XQ2AFnhTl2ETd14Dht/Ep6VCi7ToHI= X-Google-Smtp-Source: ABdhPJwnjkjyuNMg0EPuMC1Kkg0/cpq0ONn3Gl8PdEr/NYfS1nTJCDEYJ6ESTsuYI/f161b6BR5heA== X-Received: by 2002:a05:620a:1aa0:: with SMTP id bl32mr8624462qkb.140.1636663355372; Thu, 11 Nov 2021 12:42:35 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:35 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 12/17] rt-tests: hwlatdetect: Use abstractmethod decorator Date: Thu, 11 Nov 2021 15:42:02 -0500 Message-Id: <20211111204207.10167-12-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org - Use abstractmethod decorator instead of raising error if a method is not overridden. - Remove unnecessary trailing comma - fix import order Signed-off-by: John Kacur --- src/hwlatdetect/hwlatdetect.py | 37 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index ff8265ac39c5..ea8f2036fe82 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -1,4 +1,5 @@ #!/usr/bin/python3 +""" Module to detect smis """ # SPDX-License-Identifier: GPL-2.0-only @@ -6,12 +7,13 @@ # (C) 2015,2016 Clark Williams # (C) 2009 Clark Williams -import sys -import os -import time -import subprocess +import abc import errno +import os import os.path +import subprocess +import sys +import time version = "0.8" debugging = False @@ -72,7 +74,7 @@ class DebugFS: def getval(self, item, nonblocking=False): path = os.path.join(self.mountpoint, item) - if nonblocking == False: + if nonblocking is False: with open(path) as f: val = f.readline() else: @@ -228,24 +230,25 @@ class Detector: os.close(self.dma_latency_handle) debug("c-states enabled") + @abc.abstractmethod def cleanup(self): - raise RuntimeError("must override base method 'cleanup'!") + ''' abstract cleanup method, must override ''' + @abc.abstractmethod def get(self, field): - '''get the value of a debugfs field''' - raise RuntimeError("must override base method 'get'!") + ''' get the value of a debugfs field ''' + @abc.abstractmethod def set(self, field, val): - '''set a value in a debugfs field''' - raise RuntimeError("must override base method 'set'!") + ''' set a value in a debugfs field ''' + @abc.abstractmethod def save(self, output=None): - '''save sample data to reportfile''' - raise RuntimeError("must override base method 'save'!") + ''' save sample data to output ''' + @abc.abstractmethod def display(self): - '''output the sample data as a string''' - raise RuntimeError("must override base method 'display'!") + ''' output the sample data as a string ''' def start(self): count = 0 @@ -277,9 +280,9 @@ class Detector: self.c_states_on() debug("detector module disabled") + @abc.abstractmethod def detect(self): - '''get detector output''' - raise RuntimeError("must override base method 'detect'!") + ''' get detector output ''' # # class to handle running the hwlat tracer module of ftrace # @@ -294,7 +297,7 @@ class Tracer(Detector): class Sample: 'private class for tracer sample data' - __slots__ = 'timestamp', 'inner', 'outer', + __slots__ = 'timestamp', 'inner', 'outer' def __init__(self, line): fields = line.split() i,o = fields[6].split('/') From patchwork Thu Nov 11 20:42:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 520110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 038D1C43219 for ; Thu, 11 Nov 2021 20:42:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0FD961268 for ; Thu, 11 Nov 2021 20:42:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233978AbhKKUp1 (ORCPT ); Thu, 11 Nov 2021 15:45:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233913AbhKKUp1 (ORCPT ); Thu, 11 Nov 2021 15:45:27 -0500 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61C6CC061766 for ; Thu, 11 Nov 2021 12:42:37 -0800 (PST) Received: by mail-qk1-x72f.google.com with SMTP id 132so7017176qkj.11 for ; Thu, 11 Nov 2021 12:42:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pGHzahTgacEr4beU7z6aiO2ulmPbTdR6SYDK4UxraAc=; b=AuojSwdb8qAhjb9zPgqGrBe6W5up5iSIPuA7yM9CZWhVfIxYp8D2dmRYaOzdoQkx/k OV4tJcVk9HP+rYAQCpd7/ToEKrWuYMPgP+h0wjkXy2p4cVW9a96lwLYoJfFL/EpmwiKI mEWfFJEE8+jGCCN+aU8mwZTMV3P3zk2DywucYGgj3fXLKFc/CkQpY2gQUENALBS0MBmd FXDuEZpFt3jxeJKL4vlCQDWy96Ff+lTaDPIDrwgRCvchhNmqyNaD9T06XkBtgvQgqbAc LIUjk6jcKdeW4SiZnRnpC7w3O3Oehn3LlJryRQpVRXXmVWu1vsEfFGuMQ6SyuPyObGbw j8Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=pGHzahTgacEr4beU7z6aiO2ulmPbTdR6SYDK4UxraAc=; b=QuKU0ToLlvuwkFmPCaDslDsxOeH/FL+QZbA3SnY5euVCojxgp9b6Dr8w+2IannQsef DU6EgvaNNRnLUwDT8mT9/FT0pXKj3aI0zckA3umj2Gf+aNdcGq9mAl5+Vp0JsUlUXLKi LGmVvl/qQ9lw5yUQIqgngrQHN3RgJ2nkOCKuxDWRVcDABeVsfXHyf7W/D3/UJx9nEbNm Pe7BBxkdcQZC7SdHUFap9jKoYV88XpOM7JhzHgNGigkR1XuSNCMowIf2qaj7xLZPbrIx 0oD33Y/M69qJpzvq9TB2zRsBKe5LoIBAZz31aImK4jagefaj1Tym2tfjQd6YNIDKgxRP kRFQ== X-Gm-Message-State: AOAM533Wu+MfGykKx2580SMSEhbzuoRKFp2NKOKiRTMJBKImDOJZv/NN LlXgzsGObvk6Q+PRuiDLmfC8l5eXpyg= X-Google-Smtp-Source: ABdhPJwx9J3rerYH3/bJNTJvv7NSRTMddbmkSU7JFbJqL0/QERcmwcAgQMEqd2jhAThDyBtod1uzwQ== X-Received: by 2002:a05:620a:4312:: with SMTP id u18mr8414913qko.483.1636663356287; Thu, 11 Nov 2021 12:42:36 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:36 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 13/17] rt-tests: hwlatdetect: Remove unused class Kmod Date: Thu, 11 Nov 2021 15:42:03 -0500 Message-Id: <20211111204207.10167-13-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org - Remove class Kmod Kmod was used for loading and unloading of a kernel module, but hwlatdetect uses ftrace now so this class is unneeded. - Improve the spacing in the code Signed-off-by: John Kacur --- src/hwlatdetect/hwlatdetect.py | 107 ++++++--------------------------- 1 file changed, 19 insertions(+), 88 deletions(-) diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index ea8f2036fe82..c22e5eba25f6 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -20,14 +20,17 @@ debugging = False quiet = False watch = False + def debug(str): if debugging: print(str) + def info(str): if not quiet: print(str) + # # Class used to manage mounting and umounting the debugfs # filesystem. Note that if an instance of this class mounts @@ -78,7 +81,7 @@ class DebugFS: with open(path) as f: val = f.readline() else: - f = os.fdopen(os.open(path, os.O_RDONLY|os.O_NONBLOCK), "r") + f = os.fdopen(os.open(path, os.O_RDONLY | os.O_NONBLOCK), "r") try: val = f.readline() except OSError as e: @@ -104,89 +107,19 @@ class DebugFS: def getpath(self, item): return os.path.join(self.mountpoint, item) -# Exception class for when tracer is not available + class DetectorNotAvailable(Exception): + """ Exception class for when tracer is not available """ + def __init__(self, name, msg): self.args = (name, msg) self.name = name self.msg = msg -# -# Class used to manage loading and unloading of the -# hwlat kernel module. Like the debugfs class -# above, if the module is already loaded, this class will -# leave it alone when cleaning up. -# -class Kmod: - ''' class to manage loading and unloading of kernel modules''' - - names = ("hwlat_detector", "smi_detector") - - def __check_builtin(self): - for l in open(os.path.join('/lib/modules', os.uname()[2], 'modules.builtin'), "r"): - if self.name in l: - debug("found %s as builtin" % self.namename) - return True - return False - - def __find_module(self): - debug("looking for module %s" % self.name) - path = os.path.join("/lib/modules", - os.uname()[2], - "kernel/drivers/misc") - debug("module path: %s" % path) - mpath = os.path.join(path, self.name) + ".ko" - debug("checking %s" % mpath) - if os.path.exists(mpath): - return True - return False - - def __init__(self, name): - if name not in Kmod.names: - raise RuntimeError("unsupported module name: %s" % name) - if name == "smi_detector": - raise RuntimeError("smi_detector module no longer supported!") - self.name = name - self.preloaded = False - self.builtin = False - - # check for builtin - if self.__check_builtin(): - self.builtin = True - return - - # now look for already loaded module - for l in open('/proc/modules'): - field = l.split() - if self.name in field[0]: - self.preloaded = True - debug("using already loaded %s" % self.name) - return - if not self.__find_module(): - raise DetectorNotAvailable(name, "module %s does not exist!" % self.name) - - def load(self): - if self.builtin: - debug("not loading %s (builtin)" % self.name) - return True - if self.preloaded: - debug("not loading %s (already loaded)" % self.name) - return True - cmd = ['/sbin/modprobe', self.name] - return subprocess.call(cmd) == 0 - - def unload(self): - if self.preloaded or self.builtin: - debug("Not unloading %s" % self.name) - return True - cmd = ['/sbin/modprobe', '-r', self.name] - return subprocess.call(cmd) == 0 -# -# base class for detection modules -# class Detector: - '''base class for detector modules''' + """ base class for detector modules """ + def __init__(self): self.type = "unknown" if os.getuid() != 0: @@ -195,7 +128,7 @@ class Detector: if not self.debugfs.mount(): raise RuntimeError("failed to mount debugfs") self.samples = [] - self.testduration = 30 # ten seconds + self.testduration = 30 # ten seconds self.have_msr = False self.initsmi = [] if os.path.exists('/usr/sbin/rdmsr'): @@ -283,11 +216,11 @@ class Detector: @abc.abstractmethod def detect(self): ''' get detector output ''' -# -# class to handle running the hwlat tracer module of ftrace -# + + class Tracer(Detector): - '''class to wrap access to ftrace hwlat tracer''' + """ Class to handle running the hwlat tracer module of ftrace """ + __field_translation = { 'width' : "hwlat_detector/width", 'window' : "hwlat_detector/window", @@ -298,9 +231,10 @@ class Tracer(Detector): class Sample: 'private class for tracer sample data' __slots__ = 'timestamp', 'inner', 'outer' + def __init__(self, line): fields = line.split() - i,o = fields[6].split('/') + i, o = fields[6].split('/') ts = fields[7][3:] self.timestamp = str(ts) self.inner = int(i) @@ -383,7 +317,6 @@ class Tracer(Detector): f.write("%s\n" % str(s)) print("report saved to %s (%d samples)" % (output, len(self.samples))) - def display(self): for s in self.samples: s.display() @@ -414,6 +347,7 @@ def seconds(str): else: raise RuntimeError("invalid input for seconds: '%s'" % str) + def milliseconds(str): "convert input string to millsecond value" if str.isdigit(): @@ -443,9 +377,6 @@ def microseconds(str): else: raise RuntimeError("invalid input for microseconds: '%s'" % str) -# -# main starts here -# if __name__ == '__main__': from argparse import ArgumentParser @@ -533,7 +464,7 @@ if __name__ == '__main__': if args.duration: detect.testduration = seconds(args.duration) else: - detect.testduration = 120 # 2 minutes + detect.testduration = 120 # 2 minutes debug("test duration is %ds" % detect.testduration) if args.watch: @@ -569,7 +500,7 @@ if __name__ == '__main__': if detect.have_msr: finishsmi = detect.getsmicounts() total_smis = 0 - for i,count in enumerate(finishsmi): + for i, count in enumerate(finishsmi): if count > detect.initsmi[i]: smis = count - detect.initsmi[i] total_smis += smis From patchwork Thu Nov 11 20:42:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 517438 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 110C9C433F5 for ; Thu, 11 Nov 2021 20:42:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F10876120D for ; Thu, 11 Nov 2021 20:42:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233994AbhKKUp2 (ORCPT ); Thu, 11 Nov 2021 15:45:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233902AbhKKUp2 (ORCPT ); Thu, 11 Nov 2021 15:45:28 -0500 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FEC6C061766 for ; Thu, 11 Nov 2021 12:42:38 -0800 (PST) Received: by mail-qk1-x72d.google.com with SMTP id bq14so7082730qkb.1 for ; Thu, 11 Nov 2021 12:42:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TtCcKyCHqFvL6q1Sn0e8nHQHwA+0l5fm/HiKiwqEjZI=; b=cIyYHtPJmdMoR0dI9bm9jFfLPu4oe3Am+t0ug6ilz4PEEkBJc4ye4oRbis9dKVZsDq XLmQqa2NXaHQvjyvb/FKAEMGS5hWMzSFy0UdkaGz9UAt7G9X1+pBAwXq22BetC9igUDz caQR/2is43J7EqnQRfKmML0qfMFF3R8FBn7kcxgdrpL42xbwE3GPyuehOZas5lpSYyoi 7+N1pqTSCceTDKLnUutYRWcFF6BHqxHNCe9kVQUrNzANIsnG/rZ9hDZZegOB5tJb96Ry 3vJmFZm79evtTOzxbTFN/VobpwlhSVsZc73IzWRN7gkq6ycnRVZj+Kx7gs8/I2TjA2BU tJQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=TtCcKyCHqFvL6q1Sn0e8nHQHwA+0l5fm/HiKiwqEjZI=; b=nP2NWSXY5PPcZuUXfped9F9spr2570Dn3lngcDyTp6DdYMxwi8yKuAapLqMrjO0ipq IpP4akK0nDzkge7eFPUI0R8SpRToKmpqfRHiyP/1QntWbguwnNXdhFgQpfm5qD7bvBMr YuirrF+zrxzuQzg6Nc66ZDavbeqF/xvS942LxJmm5Iwil/zdQdX6AdEyXyPhK86jKg8p 4PCYUK4eN64sGpKoSbrOoVD6gIjExXUoZvr5vaEjksX7GOo89N3PQsLIel8/nQsmmVyb FNgXmKD0RsPe7bWwgyIUhs4PkXfxwgcYsqazBTUeEhExiYKjj40BpxNK+tvs19L8l3Bs KEqw== X-Gm-Message-State: AOAM530PDAbO8F3ZznVJhm6vNSJdZaWdirApyd3sikZY6doPUrBmdb7C X2XQ7rotPtCbxZaaRiIwnUjWzOQ3UiE= X-Google-Smtp-Source: ABdhPJyaAyB9rtK0xsptr2F85zlcIWAOwRM4s7vbRR4pSIOi9nyTb/NiqHN6F4A3/QH4zfKsT8Ymnw== X-Received: by 2002:a05:620a:22a5:: with SMTP id p5mr8360743qkh.189.1636663357292; Thu, 11 Nov 2021 12:42:37 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:37 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , John Kacur Subject: [PATCH 14/17] rt-tests: hwlatdetect: Don't use built-in name str as a variable Date: Thu, 11 Nov 2021 15:42:04 -0500 Message-Id: <20211111204207.10167-14-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org - Don't use built-in name "str" as a variable - Add some more docstrings to methods Signed-off-by: John Kacur --- src/hwlatdetect/hwlatdetect.py | 122 +++++++++++++++++---------------- 1 file changed, 63 insertions(+), 59 deletions(-) diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index c22e5eba25f6..27c2b8a2d138 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -21,14 +21,16 @@ quiet = False watch = False -def debug(str): +def debug(dstr): + """ print debugging string if debugging is on """ if debugging: - print(str) + print(dstr) -def info(str): +def info(istr): + " print info string if quiet is not on """ if not quiet: - print(str) + print(istr) # @@ -39,7 +41,7 @@ def info(str): # it mounted. # class DebugFS: - '''class to manage mounting/umounting the debugfs''' + """ class to manage mounting/umounting the debugfs """ def __init__(self): self.premounted = False self.mounted = False @@ -53,6 +55,7 @@ class DebugFS: break def mount(self, path='/sys/kernel/debug'): + """ mount debugfs unless already mounted """ if self.premounted or self.mounted: debug("not mounting debugfs") return True @@ -65,6 +68,7 @@ class DebugFS: return self.mounted def umount(self): + """ unmount debugfs if not premounted """ if self.premounted or not self.mounted: debug("not umounting debugfs") return True @@ -76,6 +80,7 @@ class DebugFS: return not self.mounted def getval(self, item, nonblocking=False): + """ get value of mountpoint/item """ path = os.path.join(self.mountpoint, item) if nonblocking is False: with open(path) as f: @@ -90,21 +95,18 @@ class DebugFS: val = None else: raise - except IOError as e: - if e.errno == errno.EAGAIN: - val = None - else: - raise f.close() return val def putval(self, item, value): + """ write value to mountpoint/item """ path = os.path.join(self.mountpoint, item) with open(path, "w") as f: f.write(str(value)) f.flush() def getpath(self, item): + """ get mountpoint/item """ return os.path.join(self.mountpoint, item) @@ -153,12 +155,14 @@ class Detector: # use c_states_on() to close the file descriptor and re-enable c-states # def c_states_off(self): + """ disable c-state transitions """ if os.path.exists("/dev/cpu_dma_latency"): self.dma_latency_handle = os.open("/dev/cpu_dma_latency", os.O_WRONLY) os.write(self.dma_latency_handle, b'\x00\x00\x00\x00') debug("c-states disabled") def c_states_on(self): + """ close the file descriptor and re-enable c-states """ if self.dma_latency_handle: os.close(self.dma_latency_handle) debug("c-states enabled") @@ -184,6 +188,7 @@ class Detector: ''' output the sample data as a string ''' def start(self): + """ enable the detector """ count = 0 threshold = int(self.get("threshold")) self.c_states_off() @@ -201,6 +206,7 @@ class Detector: debug("detector module enabled (threshold: %d)" % int(self.get("threshold"))) def stop(self): + """ disable the detector """ count = 0 debug("disabling detector module") self.set("enable", 0) @@ -244,12 +250,12 @@ class Tracer(Detector): return "ts: %s, inner:%d, outer:%d" % (self.timestamp, self.inner, self.outer) def display(self): + """ convert object to string and print """ print(str(self)) def largest(self): - if self.inner > self.outer: - return self.inner - return self.outer + """ return largest value of inner or outer """ + return max(self.inner, self.outer) def translate(self, field): path = self.debugfs.getpath('tracing') @@ -274,7 +280,7 @@ class Tracer(Detector): def get(self, field): if field == "count": return len(self.samples) - elif field == "max": + if field == "max": max = 0 for values in self.samples: s = int(values.largest()) @@ -311,6 +317,7 @@ class Tracer(Detector): return val def save(self, output=None): + """ save samples """ if output: with open(output, "w") as f: for s in self.samples: @@ -328,54 +335,51 @@ class Tracer(Detector): raise RuntimeError("Failed to unmount debugfs") -def seconds(str): +def seconds(sval): "convert input string to value in seconds" - if str.isdigit(): - return int(str) - elif str[-2].isalpha(): - raise RuntimeError("illegal suffix for seconds: '%s'" % str[-2:-1]) - elif str[-1:] == 's': - return int(str[0:-1]) - elif str[-1:] == 'm': - return int(str[0:-1]) * 60 - elif str[-1:] == 'h': - return int(str[0:-1]) * 3600 - elif str[-1:] == 'd': - return int(str[0:-1]) * 86400 - elif str[-1:] == 'w': - return int(str[0:-1]) * 86400 * 7 - else: - raise RuntimeError("invalid input for seconds: '%s'" % str) - - -def milliseconds(str): + if sval.isdigit(): + return int(sval) + if sval[-2].isalpha(): + raise RuntimeError("illegal suffix for seconds: '%s'" % sval[-2:-1]) + if sval[-1:] == 's': + return int(sval[0:-1]) + if sval[-1:] == 'm': + return int(sval[0:-1]) * 60 + if sval[-1:] == 'h': + return int(sval[0:-1]) * 3600 + if sval[-1:] == 'd': + return int(sval[0:-1]) * 86400 + if sval[-1:] == 'w': + return int(sval[0:-1]) * 86400 * 7 + raise RuntimeError("invalid input for seconds: '%s'" % sval) + + +def milliseconds(sval): "convert input string to millsecond value" - if str.isdigit(): - return int(str) - elif str[-2:] == 'ms': - return int(str[0:-2]) - elif str[-1] == 's': - return int(str[0:-2]) * 1000 - elif str[-1] == 'm': - return int(str[0:-1]) * 1000 * 60 - elif str[-1] == 'h': - return int(str[0:-1]) * 1000 * 60 * 60 - else: - raise RuntimeError("invalid input for milliseconds: %s" % str) - - -def microseconds(str): + if sval.isdigit(): + return int(sval) + if sval[-2:] == 'ms': + return int(sval[0:-2]) + if sval[-1] == 's': + return int(sval[0:-2]) * 1000 + if sval[-1] == 'm': + return int(sval[0:-1]) * 1000 * 60 + if sval[-1] == 'h': + return int(sval[0:-1]) * 1000 * 60 * 60 + raise RuntimeError("invalid input for milliseconds: %s" % sval) + + +def microseconds(sval): "convert input string to microsecond value" - if str.isdigit(): - return int(str) - elif str[-2:] == 'ms': - return int(str[0:-2]) * 1000 - elif str[-2:] == 'us': - return int(str[0:-2]) - elif str[-1:] == 's': - return int(str[0:-1]) * 1000 * 1000 - else: - raise RuntimeError("invalid input for microseconds: '%s'" % str) + if sval.isdigit(): + return int(sval) + if sval[-2:] == 'ms': + return int(sval[0:-2]) * 1000 + if sval[-2:] == 'us': + return int(sval[0:-2]) + if sval[-1:] == 's': + return int(sval[0:-1]) * 1000 * 1000 + raise RuntimeError("invalid input for microseconds: '%s'" % sval) if __name__ == '__main__': From patchwork Thu Nov 11 20:42:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 520109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF967C433EF for ; Thu, 11 Nov 2021 20:42:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBF0C61264 for ; Thu, 11 Nov 2021 20:42:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234003AbhKKUp3 (ORCPT ); Thu, 11 Nov 2021 15:45:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233891AbhKKUp2 (ORCPT ); Thu, 11 Nov 2021 15:45:28 -0500 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F82EC061767 for ; Thu, 11 Nov 2021 12:42:39 -0800 (PST) Received: by mail-qt1-x82c.google.com with SMTP id l8so6521617qtk.6 for ; Thu, 11 Nov 2021 12:42:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=unGu6xaxu8AQzixDAbgLFoh/lvTXRIPm49EvTRo8yIQ=; b=X0R3e8dmdGdOVuidk6pYbvWzDDe6M+bAx1cEJknuWfmvuf91J0jYZb7MLdOmFarjiv vvyPrFI5to17iEFWR+fNFgWZhEWqwgdl6OvIazRalFLG8Z47auPBg4RH5e9nYPVRTNax Bj/prN7KTAdbPKFv1mWxyJxLhlL3WatcetdErlrDOOqd/VNBrfgmsUM11AXDMrRKAONZ E8Bu9YF5zAOA+jQYqUARXpCh+GIOE396HYau0jhK7HZnBcZNis6UrQY2gHVItNz9GdA5 lwczWHQ8LLUeCNPhR3po42+T37ZpIMdQnph/yP3bOxMb+hb771KpxsPjUuEiFUXEz7Wc J+Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=unGu6xaxu8AQzixDAbgLFoh/lvTXRIPm49EvTRo8yIQ=; b=YCd7JkF3qda2ZbpYI56XNYgFQcBlPjAthWpr968iYOhPmoBbeFZMvqR15pqvFnr1HE 1Unvvdl71P2z0e46sRlXFVbqtUD9B4UNXuViai+QhNkFm7JUczFE7Ncx7NJaHo3JENQw wch2ZRM30fsKmqvv5rtXCpMMwNIVHsc/KW53nck6vo+4xdCuiGF/9vFrF++xaSUmBXb6 le3rT8IF+g8UQjOc3QAwpxlSHPrdpzYbvvN7o0Fat24KwwRTYA6xiNPlX7dq6dCAQzhn Ugr+akk+Fb0gEP9FRlzsvZPNF2tnYo5jpulm05GfhwMeD8Ub3hhmjShSLBKPlqR3WJ5J nczA== X-Gm-Message-State: AOAM532VwqUaJzZhIHkjltzS72e3+r+jsQeU+58SZC57RACBfHWW2HfG /WIPW8Ju5AmVCxwHlINyT4UUW5xUfBA= X-Google-Smtp-Source: ABdhPJwBjdwkNxlDpCHvTzhoHO4ucaWEOSsAacn/CpYbDAPsFgBwCEdWI5lkdJfNRuD5tJG3TNImsw== X-Received: by 2002:a05:622a:589:: with SMTP id c9mr10195703qtb.313.1636663358253; Thu, 11 Nov 2021 12:42:38 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:37 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , Punit Agrawal , John Kacur Subject: [PATCH 15/17] rt-tests: cyclictest: Drop unused defines Date: Thu, 11 Nov 2021 15:42:05 -0500 Message-Id: <20211111204207.10167-15-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org From: Punit Agrawal KVARS, KVARNAMELEN and KVALUELEN defines are not used in cyclictest. Drop them. Signed-off-by: Punit Agrawal Signed-off-by: John Kacur --- src/cyclictest/cyclictest.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index e4d43481de97..5758f88a24d0 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -99,10 +99,6 @@ extern int clock_nanosleep(clockid_t __clock_id, int __flags, /* Must be power of 2 ! */ #define VALBUF_SIZE 16384 -#define KVARS 32 -#define KVARNAMELEN 32 -#define KVALUELEN 32 - #if (defined(__i386__) || defined(__x86_64__)) #define ARCH_HAS_SMI_COUNTER #endif From patchwork Thu Nov 11 20:42:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 517437 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF173C4332F for ; Thu, 11 Nov 2021 20:42:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CAB5861264 for ; Thu, 11 Nov 2021 20:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233891AbhKKUpa (ORCPT ); Thu, 11 Nov 2021 15:45:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234010AbhKKUp3 (ORCPT ); Thu, 11 Nov 2021 15:45:29 -0500 Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A0E2C06127A for ; Thu, 11 Nov 2021 12:42:40 -0800 (PST) Received: by mail-qt1-x82e.google.com with SMTP id v22so1866063qtx.8 for ; Thu, 11 Nov 2021 12:42:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kWlrA3TCJsqFgh70WFE36WVjk97XGy06Wwxsf7ne1Lk=; b=Ofkow4wLJEqFkypdd6dLkwweWqUHxqFfjAU486RkPydSLT0l51Uea/zzBexbSlY5h5 ktNBUW1cM359JSmY1B/LyDnz7+SQ+GD4YTAyNWCKtL4UWmE4Ig0KgofccRtHGpUgLNfz BeOSnFOF1PlE2juiHgO1W+kT5ZEm1i2vcWBpfjtr1Ke7tt1RL8oCyXhFGdw3pNc3oqoL WzkZWBjKU6XeeNnIVUD2lPl6GyqsBF2Nc8a0C3FY5Se8EX1h23xWk9LJqCorx04aorHc Q4VKagoJ6CalDWF7N1m29ugdmgHm5nL1lQcLxU8ZPgCcLi5gxq574HTker3uPYt0OV1M Iq9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=kWlrA3TCJsqFgh70WFE36WVjk97XGy06Wwxsf7ne1Lk=; b=nHn029ar7khvmemL+Lv3ubC0RZH7BpER/2Egz7fQmSzeN8JY1PD+kz6tEaxxprfwI+ gPWSY7ovocjacSpwZ9Ofnll/vadEMjI7LHVVvbN+gbS4qYegr25ZKS8uY7eutD1W4BLd 2xQLPJTeU/DesD+QsZddn5WHrXgRiJFPMUeOM7VRVu/A/b+xdrE/686kntuv73vmiyje lcZ522SfJvyAcSNch/THV6j2c/Kb+bVAiXJyywdPooyt4OrPVKDsrvI5Ctvocrz4la99 ytL6WsHqopUX862cCODfQIGJywubmRGobCNLYlF+9cxanwySDioPHBJM4GkbNTnkGR+R 3k9Q== X-Gm-Message-State: AOAM532U35/sTahE4il7fIumXyaofsdtFIFVkmshvdgtCOUuaXwNz5dY zn6mwheSiM+O36H/fEL8JZlINWy9B0g= X-Google-Smtp-Source: ABdhPJyC43FYll0Ncrzzj0fXrskkhbryJzeSQv7jz1SuUxF0l6WCiY1dLSr+G7tDelz0Ml6MKriFfA== X-Received: by 2002:ac8:4159:: with SMTP id e25mr10612247qtm.69.1636663359172; Thu, 11 Nov 2021 12:42:39 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:38 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , Punit Agrawal , John Kacur Subject: [PATCH 16/17] rt-tests: cyclictest: Simplify duplicate initialization of "stop" Date: Thu, 11 Nov 2021 15:42:06 -0500 Message-Id: <20211111204207.10167-16-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org From: Punit Agrawal The timespec structure "stop" is initialised whether it is used or not as the compiler is not smart enough to figure out that it's use is always guarded by the "duration" variable. As a result, "stop" needs to be initialised whether it's used or not to avoid a compiler warning. Replace the duplicate memset statements by initializing "stop" using structure initialiser. Signed-off-by: Punit Agrawal Signed-off-by: John Kacur --- src/cyclictest/cyclictest.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index 5758f88a24d0..73c5be972391 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -507,7 +507,7 @@ static void *timerthread(void *param) struct sigevent sigev; sigset_t sigset; timer_t timer; - struct timespec now, next, interval, stop; + struct timespec now, next, interval, stop = { 0 }; struct itimerval itimer; struct itimerspec tspec; struct thread_stat *stat = par->stats; @@ -516,8 +516,6 @@ static void *timerthread(void *param) pthread_t thread; unsigned long smi_now, smi_old = 0; - memset(&stop, 0, sizeof(stop)); - /* if we're running in numa mode, set our memory node */ if (par->node != -1) rt_numa_set_numa_run_on_node(par->node, par->cpu); @@ -598,7 +596,6 @@ static void *timerthread(void *param) tsnorm(&next); if (duration) { - memset(&stop, 0, sizeof(stop)); /* grrr */ stop = now; stop.tv_sec += duration; } From patchwork Thu Nov 11 20:42:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 520108 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54CBBC433F5 for ; Thu, 11 Nov 2021 20:42:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 403C36120D for ; Thu, 11 Nov 2021 20:42:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234029AbhKKUpb (ORCPT ); Thu, 11 Nov 2021 15:45:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234006AbhKKUpa (ORCPT ); Thu, 11 Nov 2021 15:45:30 -0500 Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31411C061766 for ; Thu, 11 Nov 2021 12:42:41 -0800 (PST) Received: by mail-qt1-x82e.google.com with SMTP id q14so6480604qtx.10 for ; Thu, 11 Nov 2021 12:42:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j1Bjm9LGNJ0lss9AUejzAXMP0Duge/HkYKVBRf0TB2A=; b=UujVxwU0blvCSHN0ooPUyXEwIqEWMB3xlarLrJQ0YBfvKgj0LBSbjkIg+kBbYNcwSX iwZFyDv5YtjaVHmD9TP6B7kWjhKbvMacF4lONjllYzJI0YwRVNRYez5mVCxjVSjoimkW Q/GktaCFV2FbAgASAA3tSs/oQw5TWu8UB7kHRi1anNqdnu9BWrpjDj+3uMMAmlRHs5D+ lceHWm7ccgtpyfskS9SdOvWFxsuGj4KXPX4KP3JYERMYSKm1Jg68oqSZSI7ikMAcot3G rtsjlmtYxtnEhDEkwbzXthMT9sgLQQgpAqcDPr91irZcVRcvzxJ/FNhxLVKAh0cunJQv NdRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=j1Bjm9LGNJ0lss9AUejzAXMP0Duge/HkYKVBRf0TB2A=; b=UTvHVEiHrZjYzCxlwl7HFo0pGNdeHg2OUhaNsbJN23+MRiF4SJ9Ge8aNZKyCGNBfnW vQ2unwD8eQE7W+GL3EGDT2OWUsRknB1ex7v5Om4XJooZSI7FIK/Ijrbj7eD/vVQXLxsF Xlu86VN9EKUswKoQgNNbbVGZxkyj45ol/a9kM2KKCRrxvS3HwnYA3tiAuhS2BiKKu+t9 2Jew+f+ixBlnKMtXGcYhi0tXgGtFN6KW7ZI6MnouC830TCEKjd33jgiF5P7Xn0/5JapI wr5HTOh8rj9MYkBsnEY3VTJzJV5sJgBpCwiTtliMYSveg8kQQG5hQB2SdhBKw9Qs5RpK eeWQ== X-Gm-Message-State: AOAM533menVuGauJ5vWDTKWwZKdvLH4QccE13GUc0+WuhOLKujzYaqcy XpZiwo91aHWlHcx2cHjO2tdav2VmNmg= X-Google-Smtp-Source: ABdhPJzJBy2Xz0mUzv/aK4WhcvosHbswQaaghlYQyEvQY9EJSkKsy8RBP48Z8/lfEF2roQQfrWoQgQ== X-Received: by 2002:a05:622a:1491:: with SMTP id t17mr10611698qtx.402.1636663360106; Thu, 11 Nov 2021 12:42:40 -0800 (PST) Received: from localhost.localdomain (bras-base-rdwyon0600w-grc-08-184-147-142-154.dsl.bell.ca. [184.147.142.154]) by smtp.gmail.com with ESMTPSA id u27sm2282522qtc.58.2021.11.11.12.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 12:42:39 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , Punit Agrawal , John Kacur Subject: [PATCH 17/17] rt-tests: cyclictest: Drop unnecessary variable "bufsize" Date: Thu, 11 Nov 2021 15:42:07 -0500 Message-Id: <20211111204207.10167-17-jkacur@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211111204207.10167-1-jkacur@redhat.com> References: <20211111204207.10167-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org From: Punit Agrawal Two copies of "bufsize", initialised with the same value are declared in enclosed blocks. Remove the redundant declaration. Signed-off-by: Punit Agrawal Signed-off-by: John Kacur --- src/cyclictest/cyclictest.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index 73c5be972391..490aedb54c03 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -2059,7 +2059,6 @@ int main(int argc, char **argv) memset(stat->values, 0, bufsize); par->bufmsk = VALBUF_SIZE - 1; if (smi) { - int bufsize = VALBUF_SIZE * sizeof(long); stat->smis = threadalloc(bufsize, node); if (!stat->smis) goto outall;