Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2536062lqo; Tue, 14 May 2024 01:24:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWwGD7uEqp0ShGNFQ80dzjYFm8jcaKxbJsTuV5dYp27EyUAbKKr71RjVH/Sai2GWphX1aZHBMVZGZT8mlOChF+dtipRzQf3H5DitKZWuQ== X-Google-Smtp-Source: AGHT+IEorcnChBaJpUig8kt1xmPFsjXcMObND9/8ovqp6+x+KI6QqH3Hsv7u13yE9p3uFazpO/mN X-Received: by 2002:a05:6512:1186:b0:51e:7e65:1060 with SMTP id 2adb3069b0e04-52210273f0cmr7666164e87.67.1715675056838; Tue, 14 May 2024 01:24:16 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c2d458fsi5929429a12.342.2024.05.14.01.24.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 01:24:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=l+sTuJkT; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-178434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178434-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6108F1F22B56 for ; Tue, 14 May 2024 08:24:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 435301D52D; Tue, 14 May 2024 08:24:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="l+sTuJkT" Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2077.outbound.protection.outlook.com [40.107.96.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3491317BD2; Tue, 14 May 2024 08:24:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.77 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715675047; cv=fail; b=dzGfts4KIgQD2b/eKWUY741ohkcGxSBIckg4wO2gkZwy68fNfXoTn6RNJaOrXqq3dXT4tRpv/2kVPnqLyi/Leo0EXTCMsyJwMJvLVt3LK4SZQWZiy75urcgXWTQ7vMZBn0CHeJcwkDUCAfTKQQK5R/mpECaKO32+nSkS1An4m2E= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715675047; c=relaxed/simple; bh=iLWZECNgMjZKFC+vm/p9HRoP8NnU3ufnaHmHbTfFi14=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=P968fWZr8buj1RUCPWf3P8BGZC2fY4Vxev2X7uu6tIH132NpM3yME6LpcCO5rRI+LrTmqjv90UCx4QTww2iblgucoJrPou3FFPVyt5ZZPu2Y62kN1rF4TaIonk+cZM2XIJSysxCM23vqVB/9LFWQjsvaMkqRqZn1HtSyi31vBY8= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=l+sTuJkT; arc=fail smtp.client-ip=40.107.96.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=innOey4DQxew7b218o3VO6qZ4cUkBuXUJ/AwxbJOOMa4n7GQ4XzVTevtTJU6ha/TJ/70jEua6snEXLZ1rwRxdbRqmgl860IlEBkp+fObEIKtb1kscN/UJJ6vgiSFVg2NsXU8dXGJMAcjbVztn58wQ0rKFBpDoJSvCFCrFIE+0t4y/ny4SkwKnAC5PHxef/kiOrprxfStax4ZxmOH+b2pxaPiQj5GYI3pRl8auRK3iCqb91ae296d7YKG9ssqkciN9QOEOw8PbRZZ4F0HsxBAPIKcl9hg9KXY2LKsJOzYSCWQLVQfstdl6O7LUdcKeUrvd7mKGC69+eKBBTA1M1PFrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZAfJMZqVQ2vX8qw2mM9nYBfzAoiJ9HwLth6fswI1aqE=; b=Pi/HcCtVFIz37RNrAGyETbHXuCJ/FgPFVMfyEOdpwy6M8HfTB6hiqc+56giONN7S1GaiEK5IKPcI1ktYScA08NA5N3n0nHMikpCrwWcSjtpNvGMMXFlPqhdd9fUJkJFqVBvRrrQFINq06dquzARQOBKWPB62mBdrETxk4Mg8Hd/LOAVFH1DfENr4qJonjSoHUhocDJDPkypk7N6+OsqKmb3Qh5qYGY7kAdshXv5zESvYwLI4Je3UVPBE5aWCJdsJzZWTlL+Ao6t8cULxV0YC14rpwcl/9SESV/UXlSkyUfFq1q+W+78Ubj0Siqjqlg/H+125PveiNMsQXhElqOXMGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZAfJMZqVQ2vX8qw2mM9nYBfzAoiJ9HwLth6fswI1aqE=; b=l+sTuJkT/Qtb5Lxqs2NgUh8RxEyojIjjNWo4+kOYaVgBZYm5KEceaMZdEJVB+2IVxzo32AhHz8L+Ud8L1330mv5crFQhqd/ptqWi+gcsRI0ARqarqxmTu/QFnkjYuif/vBe4eiTE9uaePIrMQ3o4pyWochE3KwN5tyOB54m/yO8= Received: from CYYPR12MB8655.namprd12.prod.outlook.com (2603:10b6:930:c4::19) by BL1PR12MB5755.namprd12.prod.outlook.com (2603:10b6:208:392::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Tue, 14 May 2024 08:24:02 +0000 Received: from CYYPR12MB8655.namprd12.prod.outlook.com ([fe80::7fa2:65b3:1c73:cdbf]) by CYYPR12MB8655.namprd12.prod.outlook.com ([fe80::7fa2:65b3:1c73:cdbf%6]) with mapi id 15.20.7544.052; Tue, 14 May 2024 08:24:02 +0000 From: "Yuan, Perry" To: "zhida312@outlook.com" CC: andypma , "Huang, Ray" , "Shenoy, Gautham Ranjal" , "Limonciello, Mario" , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "viresh.kumar@linaro.org" , "rafael@kernel.org" Subject: RE: [v2] cpufreq: amd-pstate: fix the memory to free after epp exist Thread-Topic: [v2] cpufreq: amd-pstate: fix the memory to free after epp exist Thread-Index: AQHapcohLUw4ziXiGE6Ecaw1Y44u67GWYe7g Date: Tue, 14 May 2024 08:24:02 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ActionId=4d401377-1f34-40da-bd43-6e75a16ca611;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ContentBits=0;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Enabled=true;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Method=Standard;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Name=AMD Internal Distribution Only;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SetDate=2024-05-14T08:14:34Z;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CYYPR12MB8655:EE_|BL1PR12MB5755:EE_ x-ms-office365-filtering-correlation-id: 2f0209c5-3f28-4f4c-2663-08dc73ef363f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230031|1800799015|376005|366007|38070700009; x-microsoft-antispam-message-info: =?us-ascii?Q?bJqZ2pEyBu8oLVHEMGdrAomFB8+sUtdpjyiDaujyvV6emuFxclEGaIIKf9JW?= =?us-ascii?Q?JPWH/WHXx4Qc6BzJtvjYKUC+dzFKYUj+ICuxApoLaXDSLsGXsDRWI14F1OfG?= =?us-ascii?Q?Y+KN6HcT1+LC72YkKDrbCmhjZtSo+3Vjqki6aPc7PMLf2p1L+DgpyQbbVdYY?= =?us-ascii?Q?+3jqXZ+ujSkid/jJDbvRIoADdgxUXA91heOOjIYUmc1F9ejRXyfpWSyJx+31?= =?us-ascii?Q?3gGBqpsLi9GvaBXTFgoTj7xfKjvEDVhjP9bEgGH2I3QdAEABoqHRCypQxzlO?= =?us-asc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Mw/9Dppek+OLBGjRLfyhqbM3c+FBZR5?= =?us-ascii?Q?acRlLYM5wRIe5Wyj7IsNbDldDQ9dZLW4R8ggTd6LGQjFF01Cj9LGjr8YuY6s?= =?us-ascii?Q?CddK/y6uGzm5QkT9D1o25cHDXbtDe9HkzMHJxinoqZIPCMFxhOrQUDSa1rdL?= =?us-ascii?Q?ADgf5Qqq5Vt6DiLaU9KyzLMOvF6df83laEwIuk5bp4ELcw=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CYYPR12MB8655.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(366007)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?55SVp5Njf6wkgm2kpQOraX6rT+47qlZnq5734uOVBsjRcAUK8ZFvFlBNbdn6?= =?us-ascii?Q?Z0PPI763d+2AS41NHOHh4Yg9vJ3Mp+QiF+p85rKvsOdKdlbaH4gjGL/fep1b?= =?us-ascii?Q?GJTy//1aWDXwcPNDjgh1SU657dA5ORE3gMlpvkm7VvONUgrNpU+FpGTUL05U?= =?us-ascii?Q?MzKImLb9jQpTUQrCEFgj5fyfKOrfENSamYX3+80Ic3i7Gs7y5uwW3W5TVvKX?= =?us-ascii?Q?KhBJ+DqzcMgccZE+Qua+O8fxVEJ1CUXrezHa4Yt0a04DQWCgIvU7mr29UhwN?= =?us-ascii?Q?BCPahE0wwNIdYbnl6o6xaN0geAVE1EMY64uo48hGxz2IEYPw+Xp4vCDTaNX1?= =?us-ascii?Q?lfB51iIw6LbmeK/tVV9w31vMzFkF0/0qXZ0pK2G2uqt2FHDnOCEQ0uhWR8Bu?= =?us-ascii?Q?qIwVaPHcsuYvYW8poEgjcqrgE0y/RQc94ZFcJF+yvGdAmVSx09ojvD2p6C7b?= =?us-ascii?Q?xHw5/btHD+hSR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us-ascii?Q?PPK/HcFhh9RWTZN8Wgjby5/lTzRuIcEZyfyCUelAUEyXoFajLFDxHK4oPH1k?= =?us-ascii?Q?o6JCTHGLrSZCwODQRBZ0RF4aFiw0voo1JCE8uzkB0H4XhThexEInsHADLFBx?= =?us-ascii?Q?8R83RZAo3jW+qsqb5FBrSSnSV3JT2VKX2dX0/9AVnM+lQyJn0w6lLSw66GB0?= =?us-ascii?Q?FSQ3ID7SW5rtja3Y0PY=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CYYPR12MB8655.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f0209c5-3f28-4f4c-2663-08dc73ef363f X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2024 08:24:02.3707 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: dyZDTlDDVlLFWryWcCBTT4n7WQjlnCPuCUfGXN5ty9xXYU3zEnIiCa7gO5An9c0FxNw3dl1FHys5rI93aeH6hQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5755 [AMD Official Use Only - AMD Internal Distribution Only] > -----Original Message----- > From: zhida312@outlook.com > Sent: Tuesday, May 14, 2024 2:43 PM > To: rafael@kernel.org; viresh.kumar@linaro.org > Cc: andypma ; Huang, Ray > ; Shenoy, Gautham Ranjal > ; Limonciello, Mario > ; Yuan, Perry ; linux- > pm@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: [v2] cpufreq: amd-pstate: fix the memory to free after epp exist > > From: andypma > > the cpudata memory from kzmalloc in epp init function is not free after e= pp > exist, so we should free it. > > Signed-off-by: andypma Looks like you need to fix the format of the `Signed-off-by` line in your c= ommit, you need to ensure that it follows the correct format of including y= our full name and email address. Here's how you can fix it: Signed-off-by: Your Full Name So maybe you want to change like this. Signed-off-by: Andy Pma Perry. > > Changes since v1: > check whether it is empty before releasing. > set driver_data is NULL after free. > --- > drivers/cpufreq/amd-pstate.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c > index 6a342b0c0140..e100c5b6c9b2 100644 > --- a/drivers/cpufreq/amd-pstate.c > +++ b/drivers/cpufreq/amd-pstate.c > @@ -1441,6 +1441,13 @@ static int amd_pstate_epp_cpu_init(struct > cpufreq_policy *policy) > > static int amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy) { > + struct amd_cpudata *cpudata =3D policy->driver_data; > + > + if(cpudata) { > + kfree(cpudata); > + policy->driver_data =3D NULL; > + } > + > pr_debug("CPU %d exiting\n", policy->cpu); > return 0; > } > -- > 2.33.0