From patchwork Tue Nov 8 08:35:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 9416909 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C57EB60720 for ; Tue, 8 Nov 2016 08:56:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3B9D28920 for ; Tue, 8 Nov 2016 08:56:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8BD62892B; Tue, 8 Nov 2016 08:56:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7075228922 for ; Tue, 8 Nov 2016 08:56:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932280AbcKHI4q (ORCPT ); Tue, 8 Nov 2016 03:56:46 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:33918 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932290AbcKHI4n (ORCPT ); Tue, 8 Nov 2016 03:56:43 -0500 Received: by mail-lf0-f67.google.com with SMTP id o141so9339268lff.1 for ; Tue, 08 Nov 2016 00:56:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-powerpc-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=42+t+zOTo1opfZxSwPtbdM3nvXX+YM6vqgWzs6uuDvs=; b=XcDwjrlR1vulHZhbRhheFgfEPn1P7flHJ+i2yv00e/VV81j2tNqlBA+BvlLM8yvSiY X4eGcdbnl41yXuVOyum89445msJcDSSm826r7kWX1HcZrbXVYh5SrVNZDMzxMy6XUuj1 ExMfI67XLRe4sIrah+gz+otYnlP3gcJywDCxRaa2sZ/dJsnGgPLEaAa5Gz5ku0/cf7Ws vapIZ1dGY9nueXKiFVeByK+6ynwDk5A+A9k23V6VyyWVCHA8Fbp32qbQBq48Rl2ps+g8 51YWQwTFbWeVM1jqPdY/shvN7v3nF2ytvRFJ5oTSWHef6NaZoRtHibVk1h7gW3b26g+u xrGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=42+t+zOTo1opfZxSwPtbdM3nvXX+YM6vqgWzs6uuDvs=; b=nHwd45pNwgmJYXjkC+wgR63scZkqCe+BPkiqS9XGorqJ2BtcNdab+d4sr7fVgSk4Kt iirSKfao2+4+vhkq38vO+byWtsqgGE1G1nqtHECpDZkL9BvGvCnLmSUakHraisQQxG5B wsrFV9ulFEFPrvwKuYqSVN51p9X0ZInlBc6O0YvHiui/UKeBGojxuaAcrt/9hlp1flAx eAN+OI0d8I6/fh9uMeS33Mv2M82UWjAvsMApMyZRGl1wZNKmAQrAabQk+F7yJ/4eu8h6 WI4P27LpBL0Mbs2QI5Nb+J+fuIdA8te+4e2b5pdwjYAKfjMI86ZCikSPKte3w+HOCZ0t MUyg== X-Gm-Message-State: ABUngvegq9G9z+J1KoccoXg98EDYw9dc8/WRTiY39tWthtBLycMSVqzUJSqswu+Qt8w/mw== X-Received: by 10.25.56.94 with SMTP id d30mr6349759lfj.2.1478594273102; Tue, 08 Nov 2016 00:37:53 -0800 (PST) Received: from power.oil.ru ([195.54.192.103]) by smtp.gmail.com with ESMTPSA id f65sm5848582lji.24.2016.11.08.00.37.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Nov 2016 00:37:52 -0800 (PST) From: Denis Kirjanov To: rjw@rjwysocki.net, viresh.kumar@linaro.org Cc: linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Denis Kirjanov Subject: [PATCH] cpufreq, powernv: Disable preemption while checking CPU throttling state throttling state Date: Tue, 8 Nov 2016 03:35:59 -0500 Message-Id: <1478594159-27719-1-git-send-email-kda@linux-powerpc.org> X-Mailer: git-send-email 1.8.3.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP [ 67.700897] BUG: using smp_processor_id() in preemptible [00000000] code: cat/7343 [ 67.700988] caller is .powernv_cpufreq_throttle_check+0x2c/0x710 [ 67.700998] CPU: 13 PID: 7343 Comm: cat Not tainted 4.8.0-rc5-dirty #1 [ 67.701038] Call Trace: [ 67.701066] [c0000007d25b75b0] [c000000000971378] .dump_stack+0xe4/0x150 (unreliable) [ 67.701153] [c0000007d25b7640] [c0000000005162e4] .check_preemption_disabled+0x134/0x150 [ 67.701238] [c0000007d25b76e0] [c0000000007b63ac] .powernv_cpufreq_throttle_check+0x2c/0x710 [ 67.701322] [c0000007d25b7790] [c0000000007b6d18] .powernv_cpufreq_target_index+0x288/0x360 [ 67.701407] [c0000007d25b7870] [c0000000007acee4] .__cpufreq_driver_target+0x394/0x8c0 [ 67.701491] [c0000007d25b7920] [c0000000007b22ac] .cpufreq_set+0x7c/0xd0 [ 67.701565] [c0000007d25b79b0] [c0000000007adf50] .store_scaling_setspeed+0x80/0xc0 [ 67.701650] [c0000007d25b7a40] [c0000000007ae270] .store+0xa0/0x100 [ 67.701723] [c0000007d25b7ae0] [c0000000003566e8] .sysfs_kf_write+0x88/0xb0 [ 67.701796] [c0000007d25b7b70] [c0000000003553b8] .kernfs_fop_write+0x178/0x260 [ 67.701881] [c0000007d25b7c10] [c0000000002ac3cc] .__vfs_write+0x3c/0x1c0 [ 67.701954] [c0000007d25b7cf0] [c0000000002ad584] .vfs_write+0xc4/0x230 [ 67.702027] [c0000007d25b7d90] [c0000000002aeef8] .SyS_write+0x58/0x100 [ 67.702101] [c0000007d25b7e30] [c00000000000bfec] system_call+0x38/0xfc Fixes: 09a972d16209 ("cpufreq: powernv: Report cpu frequency throttling") Reviewed-by: Gautham R. Shenoy Signed-off-by: Denis Kirjanov --- drivers/cpufreq/powernv-cpufreq.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index d3ffde8..a84724e 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c @@ -647,8 +647,14 @@ static int powernv_cpufreq_target_index(struct cpufreq_policy *policy, if (unlikely(rebooting) && new_index != get_nominal_index()) return 0; - if (!throttled) + if (!throttled) { + /* we don't want to be preempted while + * checking if the CPU frequency has been throttled + */ + preempt_disable(); powernv_cpufreq_throttle_check(NULL); + preempt_enable(); + } cur_msec = jiffies_to_msecs(get_jiffies_64());