From patchwork Tue Jul 11 18:24:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 107417 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp5223044qge; Tue, 11 Jul 2017 11:25:08 -0700 (PDT) X-Received: by 10.98.75.156 with SMTP id d28mr51124795pfj.135.1499797507289; Tue, 11 Jul 2017 11:25:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499797507; cv=none; d=google.com; s=arc-20160816; b=NzLvIziGFEymXCXih3ppx2j3VapicS2L3y+TiLYPTcYtIMpHOaFDaiRN/MV0/2Volr 2CUdtMOLZaU6N0p3ujOT9byzF8r+dRuUsAp18c/U0jIo8AZMa35Oj3LelzWlF6S0wS2B 2y7sDr4IJ+3m1dJnaTcR3mkpYlC4Fnm8kAb88gL1+0BAfxYl+KmKH1AIsU2mCg8l5lL+ 3tIHvIbWiumY8ovhYOrMTVfUl4QmoMlFdEKQrHayRTH1adehJtmsNsUpgNWOINld50tK GkB8lAeSeSM0dC09bIw4M4a6FRIql6wfS/w5P/UgrTWJM2jTULp5yfE8sv8pJejLpfqq 5KJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=pL35Mxg7uhI+X1gv+a6kTnfGS1Hqh+S6P+ZKexOzeAU=; b=wnAzQD3tSuBr4Qdb1SkgQp0w5fjLGyIoMu3xZnv52zoFiMLQm1sbGSi6ZKpmB0Wn7k eiT6e1vyzZVuP2igT0YkGm0iuxMgeAQOlzHDddletK4Ob6JZ/hBl4kHwd3WR5a1sd7tf tq+QsHuWcU5gKILPNmpQoIJ531e3sMzYWRYDeUansV49puSxQEWIbSkBPmEPj4mRtiMh MUd6ZVJJ1DblrHxA0Br/0BC6HT3EF1kQiCfTAaiA/aoFkq1MyHulBk/2pgrqPdIaj5hY IcxFCf4huJsqRzEjPv3kqtRZH7gYNtPnXXlysjQ4G8/wnxoXpXRV4MPCOSDGEm/fnsMp 1CIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=M3Q6JiE4; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e11si12007pgp.217.2017.07.11.11.25.06; Tue, 11 Jul 2017 11:25:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=M3Q6JiE4; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756382AbdGKSZF (ORCPT + 6 others); Tue, 11 Jul 2017 14:25:05 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:36147 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756242AbdGKSZF (ORCPT ); Tue, 11 Jul 2017 14:25:05 -0400 Received: by mail-pf0-f169.google.com with SMTP id q86so120564pfl.3 for ; Tue, 11 Jul 2017 11:25:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=pL35Mxg7uhI+X1gv+a6kTnfGS1Hqh+S6P+ZKexOzeAU=; b=M3Q6JiE4EMqZYIJxI+HzvRUVyNiEm6uujTwE/D1YdJ/KGEWMBLdAtCQKlQe4Ue0x2y 51EQuEVlm0K3Qz+VnUNIYNYyyN3B6LlEY2OlkXjshV/7uWBXvVpB8w3d/y5rMB5SxAPy 3LUBowEHfuorrL4Mt2wMiqPn+f7vo6dCz5zQI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pL35Mxg7uhI+X1gv+a6kTnfGS1Hqh+S6P+ZKexOzeAU=; b=J7iGiBYUljYfGucN0vW5svmibZhuoazxddTfRBcZr2HAQPkC7XZ82HQ/AHb9BdF6AJ 1Xr3cNpNg3KdAR2id4OOSHA09458WpcYXRqVPkzm6pjVrUBjQFXxovQWYNqaXSwIbOAU CDXf6FsmHykH8G6px5vnmFYWbx7nF4Lp9i1hNRButKZ4/moikEp1H+NbpsvZpnpP/IH2 thQTYJN/rqBds7BElmA/5PRgNjryTvYwNI6GU5Q3YltwjGxkAUtbIALRbUmdiFEj8GFt RCfQmAPVOP8f1rLu3ftwHLxUlaZd4gyKpGWVPfkNQvGX+PC/nzFXeGvCTdIKfMXp8Er/ kxQw== X-Gm-Message-State: AIVw111KaVfAzV0SjPHvbFrpoYEdXtgR29oZDh7kIkSHKYFQsUFyf59X i8osgsD5KE/MLZ7Z X-Received: by 10.99.101.135 with SMTP id z129mr1265237pgb.66.1499797503977; Tue, 11 Jul 2017 11:25:03 -0700 (PDT) Received: from localhost.localdomain ([106.51.243.211]) by smtp.gmail.com with ESMTPSA id t78sm15879pfa.48.2017.07.11.11.25.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Jul 2017 11:25:02 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Pavankumar Kondeti , Steven Rostedt Subject: [PATCH for-4.9] tracing: Use SOFTIRQ_OFFSET for softirq dectection for more accurate results Date: Tue, 11 Jul 2017 23:54:57 +0530 Message-Id: <1499797497-9552-1-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Pavankumar Kondeti commit c59f29cb144a6a0dfac16ede9dc8eafc02dc56ca upstream. The 's' flag is supposed to indicate that a softirq is running. This can be detected by testing the preempt_count with SOFTIRQ_OFFSET. The current code tests the preempt_count with SOFTIRQ_MASK, which would be true even when softirqs are disabled but not serving a softirq. Link: http://lkml.kernel.org/r/1481300417-3564-1-git-send-email-pkondeti@codeaurora.org Signed-off-by: Pavankumar Kondeti Signed-off-by: Steven Rostedt Signed-off-by: Amit Pundir --- This upstream patch fixed a CPU soft lockup and rcu stall bug reported on linux-4.9.y while running ftracetest on Hikey, with usb-ethernet plugged-in but not connected to any network. Bug can be reproduced and fixed on linux-4.4.y as well. Most likely applicable for linux-3.18.y too but I couldn't boot up hikey with 3.18 kernel. Here is the bug report: https://bugs.linaro.org/show_bug.cgi?id=3034 kernel/trace/trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 6011148b0239..49d086753a0b 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1927,7 +1927,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags, #endif ((pc & NMI_MASK ) ? TRACE_FLAG_NMI : 0) | ((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) | - ((pc & SOFTIRQ_MASK) ? TRACE_FLAG_SOFTIRQ : 0) | + ((pc & SOFTIRQ_OFFSET) ? TRACE_FLAG_SOFTIRQ : 0) | (tif_need_resched() ? TRACE_FLAG_NEED_RESCHED : 0) | (test_preempt_need_resched() ? TRACE_FLAG_PREEMPT_RESCHED : 0); }