From patchwork Wed Aug 29 12:17:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Motai.Hirotaka@aj.MitsubishiElectric.co.jp" X-Patchwork-Id: 10580203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EFF8174A for ; Wed, 29 Aug 2018 12:41:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E5A82B00B for ; Wed, 29 Aug 2018 12:41:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82E2E2B010; Wed, 29 Aug 2018 12:41:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3250E2B00B for ; Wed, 29 Aug 2018 12:41:08 +0000 (UTC) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 19C01D2E; Wed, 29 Aug 2018 12:36:47 +0000 (UTC) X-Original-To: ltsi-dev@lists.linuxfoundation.org Delivered-To: ltsi-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 9400CD06 for ; Wed, 29 Aug 2018 12:36:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx06.melco.co.jp (mx06.melco.co.jp [192.218.140.146]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 169807C4 for ; Wed, 29 Aug 2018 12:36:40 +0000 (UTC) Received: from mr06.melco.co.jp (mr06 [133.141.98.164]) by mx06.melco.co.jp (Postfix) with ESMTP id 1EB753A2A9F for ; Wed, 29 Aug 2018 21:17:26 +0900 (JST) Received: from mr06.melco.co.jp (unknown [127.0.0.1]) by mr06.imss (Postfix) with ESMTP id 420l4Q09NBzRkG1 for ; Wed, 29 Aug 2018 21:17:26 +0900 (JST) Received: from mf03_second.melco.co.jp (unknown [192.168.20.183]) by mr06.melco.co.jp (Postfix) with ESMTP id 420l4P6zZkzRk5W for ; Wed, 29 Aug 2018 21:17:25 +0900 (JST) Received: from mf03.melco.co.jp (unknown [133.141.98.183]) by mf03_second.melco.co.jp (Postfix) with ESMTP id 420l4P6sN0zRkCp for ; Wed, 29 Aug 2018 21:17:25 +0900 (JST) Received: from JPN01-OS2-obe.outbound.protection.outlook.com (unknown [23.103.139.144]) by mf03.melco.co.jp (Postfix) with ESMTP id 420l4P6XC4zRk8v for ; Wed, 29 Aug 2018 21:17:25 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mitsubishielectricgroup.onmicrosoft.com; s=selector1-mitsubishielectricgroup-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JnMeo2P7jKw6CQNxX2Q3aNOLftH+gCb9eZIZDL85A2U=; b=i44qxW1y7BZzknBbkEW/rdd7R7oIcg000t0drWFRKLhMDWP/+8KlZr6rRf7V324waWqKPcnTdgyiif7lKdr1BxJf0YWlMFhLqu9CpGUzVY1kpek0W+HmGDBkd/OLbhx/bBs0JWMXQxsTFrOB4lxVb47hZnLd1D0P7urel46FkU8= Received: from TY1PR01MB1692.jpnprd01.prod.outlook.com (52.133.160.145) by TY1PR01MB1231.jpnprd01.prod.outlook.com (10.174.226.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Wed, 29 Aug 2018 12:17:25 +0000 Received: from TY1PR01MB1692.jpnprd01.prod.outlook.com ([fe80::d04e:e6f6:c782:22fa]) by TY1PR01MB1692.jpnprd01.prod.outlook.com ([fe80::d04e:e6f6:c782:22fa%2]) with mapi id 15.20.1080.015; Wed, 29 Aug 2018 12:17:25 +0000 From: "Motai.Hirotaka@aj.MitsubishiElectric.co.jp" To: "ltsi-dev@lists.linuxfoundation.org" Thread-Topic: [LTSI-dev] [PATCH 11/54] ring-buffer: Fix duplicate results in mapping context to bits in recursive lock Thread-Index: AdQ/iftRvwcRLbqYSIqNiBBDc4s0Xg== Date: Wed, 29 Aug 2018 12:17:05 +0000 Deferred-Delivery: Wed, 29 Aug 2018 12:15:00 +0000 Message-ID: Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-melpop: 1 authentication-results: spf=none (sender IP is ) smtp.mailfrom=Motai.Hirotaka@aj.MitsubishiElectric.co.jp; x-originating-ip: [153.231.200.201] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TY1PR01MB1231; 6:guk9k5t9cqA5HwvyUzkdnOg+VEkpIO6KHbOPmSAA2DOLZVKdEzyU6W9REfAIzo7y6RBPifgpBaGR7rIDn45WVLBo0j9UjbPjIa9tgJecRypL5JRMFo3UlFf4nlMCmtNRIt4UwplJ3DLSngYQnFCkv3pSfvrygL8DCVX1CGLK9nny9stI0Nm+zcAesohGkSyY6+KsxJquBI4fE4YBOXKliw44dgjgUU5c0eJd9NVXFVCVPfkzwgNPLo6Yev48XDjHs7SFQhgrU+dp8RuPJTslDPrh8EisMwIUAggxxfxRePVQ3tLxpGy5NyVvR9hu8QiWj0w3DJz/tIyGeptkiTVm98uE0Zoksx/8wj7w3Yg/934kDbjtV8/2/iWen0WPBkF4NzHXw9H72F9QnRF4/zfi/twuY5xO7STqZYuJgh+wvpI4O69cRioF/a6gnOo215WCWUnQtak/8QArgGbN7e076w==; 5:JoonR/S5o5KKsjN1FTB4y8p23QyOyNbze+YZJsUTZjXoRUJXmMLQHpzGJ6fHlggmWx3fCfL7rbBMpmtjknLC90p4XJV7rtb8ZkGBpIwB6MTdU+st/Qh6KW++FfwJMBPAF/G3JtJ14j7vnnsUn06QVRGs4A+5S9SGIWQmSRBty9k=; 7:31HxIk0/mJaNDOSuo/UZ2GC48c6UgyxqkZbroZ7cndu8Di6EH9AE23jC+hjcm7NmhE4u1AJ+vumkrl4hCS+Metmj1nBFYTQhZcXAsHifX+ndOqU6x+ZgmJGzw5BQDPmxlhBTzetg4Ew6chMebodVgJYKVoVeoLGFo3C7eoCdVr+pTDaJb61xBHEvZqpLp0E0rbvNk43RKayBVfaTNu3GPjZjPSG1oudP7OlLKTiMiOcbrPhN68IVUWHcXTGWCXWU x-ms-office365-filtering-correlation-id: 57055962-7103-448d-d74a-08d60da96173 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:TY1PR01MB1231; x-ms-traffictypediagnostic: TY1PR01MB1231: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(201708071742011)(7699016); SRVR:TY1PR01MB1231; BCL:0; PCL:0; RULEID:; SRVR:TY1PR01MB1231; x-forefront-prvs: 077929D941 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(396003)(366004)(376002)(346002)(39860400002)(189003)(199004)(478600001)(105586002)(2906002)(14454004)(33656002)(66066001)(72206003)(6116002)(3846002)(97736004)(2900100001)(2501003)(5250100002)(74482002)(25786009)(7736002)(9686003)(5660300001)(6506007)(26005)(6666003)(6916009)(2351001)(81156014)(106356001)(86362001)(6436002)(5640700003)(74316002)(8676002)(1857600001)(81166006)(102836004)(53936002)(7696005)(575784001)(68736007)(55016002)(305945005)(256004)(14444005)(316002)(186003)(8936002)(486006)(99286004)(476003); DIR:OUT; SFP:1102; SCL:1; SRVR:TY1PR01MB1231; H:TY1PR01MB1692.jpnprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:0; received-spf: None (protection.outlook.com: aj.MitsubishiElectric.co.jp does not designate permitted sender hosts) x-microsoft-antispam-message-info: HOhg384xdhboKUGt02XYS7QzITne0h3bmCqhC/OvI43d3k8kZhJB0+j6NfCxO3At6RtYRgPCQbEop/eO2ffb0EIPpTotq/LW9p0+MarBqIDzthBeNoY0vWn+b1XNrCpEtiJ8zpPeTaZkbiEYxCZobJj02WfoLmfFlmZF56Lbjz1KGBy7kcxhXRC5Jc9EfxCdwX//QFp5Ki9cdHux1FdEVOtC1kqGSZN0fnkEibg4L74qBjF+HVbJLmmYycLx9U5ZxxlWb8FrRE5PvGODhMAzJE6t5wUkyqE6Abtj34ttipXMsjL137s7rFTIG+WDThdy+2RB/26B8BZtKW9y4WO3YtF7Yp4dhH4QdWQxJbO3Eik= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: aj.MitsubishiElectric.co.jp X-MS-Exchange-CrossTenant-Network-Message-Id: 57055962-7103-448d-d74a-08d60da96173 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2018 12:17:22.6287 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c5a75b62-4bff-4c96-a720-6621ce9978e5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1PR01MB1231 Subject: [LTSI-dev] [PATCH 11/54] ring-buffer: Fix duplicate results in mapping context to bits in recursive lock X-BeenThere: ltsi-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "A list to discuss patches, development, and other things related to the LTSI project" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ltsi-dev-bounces@lists.linuxfoundation.org Errors-To: ltsi-dev-bounces@lists.linuxfoundation.org X-Virus-Scanned: ClamAV using ClamSMTP In bringing back the context checks, the code checks first if its normal (non-interrupt) context, and then for NMI then IRQ then softirq. The final check is redundant. Since the if branch is only hit if the context is one of NMI, IRQ, or SOFTIRQ, if it's not NMI or IRQ there's no reason to check if it is SOFTIRQ. The current code returns the same result even if its not a SOFTIRQ. Which is confusing. pc & SOFTIRQ_OFFSET ? 2 : RB_CTX_SOFTIRQ Is redundant as RB_CTX_SOFTIRQ *is* 2! Fixes: a0e3a18f4baf ("ring-buffer: Bring back context level recursive checks") Signed-off-by: Steven Rostedt (VMware) (cherry picked from commit 0164e0d7e803af3ee1c63770978c728f8778ad01) Signed-off-by: Hirotaka MOTAI --- kernel/trace/ring_buffer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 5c4dc1c1..e3769d3c 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -2585,18 +2585,17 @@ trace_recursive_lock(struct ring_buffer_per_cpu *cpu_buffer) unsigned int val = cpu_buffer->current_context; unsigned long pc = preempt_count(); int bit; if (!(pc & (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_OFFSET))) bit = RB_CTX_NORMAL; else bit = pc & NMI_MASK ? RB_CTX_NMI : - pc & HARDIRQ_MASK ? RB_CTX_IRQ : - pc & SOFTIRQ_OFFSET ? 2 : RB_CTX_SOFTIRQ; + pc & HARDIRQ_MASK ? RB_CTX_IRQ : RB_CTX_SOFTIRQ; if (unlikely(val & (1 << bit))) return 1; val |= (1 << bit); cpu_buffer->current_context = val; return 0;