From patchwork Wed Jan 10 09:52:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shriya X-Patchwork-Id: 858188 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zGljt2dYyz9ryT for ; Wed, 10 Jan 2018 21:34:10 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zGljt15jCzF0lG for ; Wed, 10 Jan 2018 21:34:10 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=shriyak@linux.vnet.ibm.com; receiver=) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3zGkpd29jgzDqpc for ; Wed, 10 Jan 2018 20:53:13 +1100 (AEDT) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0A9ntMd035783 for ; Wed, 10 Jan 2018 04:53:10 -0500 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0b-001b2d01.pphosted.com with ESMTP id 2fdg2w1m8d-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 10 Jan 2018 04:53:10 -0500 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Jan 2018 04:53:09 -0500 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 10 Jan 2018 04:53:08 -0500 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0A9r7kd50528406; Wed, 10 Jan 2018 09:53:07 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9FCC28041; Wed, 10 Jan 2018 04:52:33 -0500 (EST) Received: from shriya-ThinkPad-T460.in.ibm.com (unknown [9.109.250.151]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTPS id 22D942803E; Wed, 10 Jan 2018 04:52:30 -0500 (EST) From: Shriya To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH] powerpc : Fix sleeping-in-atomic section warning triggered by /proc/cpuinfo Date: Wed, 10 Jan 2018 15:22:58 +0530 X-Mailer: git-send-email 1.9.1 X-TM-AS-GCONF: 00 x-cbid: 18011009-2213-0000-0000-000002583D3D X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008352; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000245; SDB=6.00972908; UDB=6.00492918; IPR=6.00752858; BA=6.00005771; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018957; XFM=3.00000015; UTC=2018-01-10 09:53:09 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18011009-2214-0000-0000-000058B5FE1F Message-Id: <1515577978-21701-1-git-send-email-shriyak@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-10_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801100137 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ego@linux.vnet.ibm.com, Shriya , npiggin@gmail.com, aneesh.kumar@linux.vnet.ibm.com, shilpa.bhat@linux.vnet.ibm.com, akshay.adiga@linux.vnet.ibm.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Commit cd77b5ce208c ("Fix the frequency read by /proc/cpuinfo") to fix /proc/cpuinfo on POWERNV triggered a sleeping-in-atomic section warning. This was because the place where we cpufreq_get (which takes an rwsem) from show_cpuinfo is in a preempt_disabled. However, the preempt_disable() in show_cpuinfo is for protection against CPU-Hotplug, since we don't want to report the information of offline CPUs in /proc/cpuinfo. Fix this by replacing preempt_disable()/preempt_enable() in show_cpuinfo() by get_online_cpus()/put_online_cpus() giving a proper protection against CPU-Hotplug. --- arch/powerpc/kernel/setup-common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 1.9.1 diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 2075322..f772442 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -244,9 +244,9 @@ static int show_cpuinfo(struct seq_file *m, void *v) /* We only show online cpus: disable preempt (overzealous, I * knew) to prevent cpu going down. */ - preempt_disable(); + get_online_cpus(); if (!cpu_online(cpu_id)) { - preempt_enable(); + put_online_cpus(); return 0; } @@ -359,7 +359,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) seq_printf(m, "\n"); #endif - preempt_enable(); + put_online_cpus(); /* If this is the last cpu, print the summary */ if (cpumask_next(cpu_id, cpu_online_mask) >= nr_cpu_ids)