From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752008AbcFNLcd (ORCPT ); Tue, 14 Jun 2016 07:32:33 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:54787 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751190AbcFNLcF (ORCPT ); Tue, 14 Jun 2016 07:32:05 -0400 X-IBM-Helo: d23dlp03.au.ibm.com X-IBM-MailFrom: benh@au1.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org;linux-pm@vger.kernel.org Subject: Re: [PATCH v6 10/11] cpuidle/powernv: Add support for POWER ISA v3 idle states From: Benjamin Herrenschmidt Reply-To: benh@au1.ibm.com To: Shreyas B Prabhu , mpe@ellerman.id.au Cc: ego@linux.vnet.ibm.com, mikey@neuling.org, "Rafael J. Wysocki" , linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Rob Herring , Lorenzo Pieralisi , maddy@linux.vnet.ibm.com Date: Tue, 14 Jun 2016 21:31:17 +1000 In-Reply-To: <575FE64C.9080107@linux.vnet.ibm.com> References: <1465404871-5406-1-git-send-email-shreyas@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16061411-0048-0000-0000-000001927EAC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16061411-0049-0000-0000-000045EFCCC1 Message-Id: <1465903877.30200.9.camel@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-06-14_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606140128 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org <1465404871-5406-11-git-send-email-shreyas@linux.vnet.ibm.com> <1465854492.3022.30.camel@au1.ibm.com> <575FE64C.9080107@linux.vnet.ibm.com> Organization: IBM Australia Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.3 (3.20.3-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit On Tue, 2016-06-14 at 16:41 +0530, Shreyas B Prabhu wrote: > >> +            psscr_val = kcalloc(dt_idle_states, sizeof(*psscr_val), > >> +                                GFP_KERNEL); > >> +            rc = of_property_read_u64_array(power_mgt, > >> +                                            "ibm,cpu-idle-state-psscr", > >> +                                            psscr_val, dt_idle_states); > >  > > Here, psscr val is only one u64 ... shouldn't you kmalloc sizeof(..) * > > dt_idle_states ? > > I'm using kcalloc here since checkpatch script suggested kcalloc over > kzalloc for allocating memory for arrays. > I'll also include a patch to use kcalloc throughout the file for > uniformity in next version. I was originally planning to post that > cleanup separately. Ah ok, I missed the use of kcalloc (I didn't even know its existence), my brain just read kmalloc :-) Still, I find it inconsistent that you allocate here while you use the stack for the names. Any reason for that ? Cheers, Ben. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Herrenschmidt Subject: Re: [PATCH v6 10/11] cpuidle/powernv: Add support for POWER ISA v3 idle states Date: Tue, 14 Jun 2016 21:31:17 +1000 Message-ID: <1465903877.30200.9.camel@au1.ibm.com> References: <1465404871-5406-1-git-send-email-shreyas@linux.vnet.ibm.com> Reply-To: benh@au1.ibm.com Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <575FE64C.9080107@linux.vnet.ibm.com> Sender: linux-kernel-owner@vger.kernel.org To: Shreyas B Prabhu , mpe@ellerman.id.au Cc: ego@linux.vnet.ibm.com, mikey@neuling.org, "Rafael J. Wysocki" , linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Rob Herring , Lorenzo Pieralisi , maddy@linux.vnet.ibm.com List-Id: linux-pm@vger.kernel.org =09 <1465404871-5406-11-git-send-email-shreyas@linux.vnet.ibm.com> =09 =09 <1465854492.3022.30.camel@au1.ibm.com> <575FE64C.9080107@linux.vnet.ibm.com> Organization: IBM Australia Content-Type: text/plain; charset=3D"UTF-8" X-Mailer: Evolution 3.20.3 (3.20.3-1.fc24)=20 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit On Tue, 2016-06-14 at 16:41 +0530, Shreyas B Prabhu wrote: > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0psscr_val =3D kcalloc(dt_idle_states, sizeof(*psscr_val), > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 GFP_KERNEL); > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0rc =3D of_property_read_u64_array(power_mgt, > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0"ibm,cpu-idle-sta= te-psscr", > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0psscr_val, dt_idl= e_states); > >=C2=A0 > > Here, psscr val is only one u64 ... shouldn't you kmalloc sizeof(..= ) * > > dt_idle_states ? >=20 > I'm using kcalloc here since checkpatch script suggested kcalloc over > kzalloc for allocating memory for arrays. > I'll also include a patch to use kcalloc throughout the file for > uniformity in next version. I was originally planning to post that > cleanup separately. Ah ok, I missed the use of kcalloc (I didn't even know its existence), my brain just read kmalloc :-) Still, I find it inconsistent that you allocate here while you use the stack for the names. Any reason for that ? Cheers, Ben.