From patchwork Mon Dec 18 16:27:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bo Ye X-Patchwork-Id: 13497257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 26207C35274 for ; Mon, 18 Dec 2023 16:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uB27546ausuf9/k9aMSAxNs+wnCPojV4Keyp0FtvXbA=; b=x5CZ3eqE1BJ6+U lQLDMGgHyjaMWBBtxxL+roCSxKAfIA7CZBuVoXhPAZZnGN48uv+iguzt3gxFGqaxZH5Sf5XURDWk7 DsZx3rEQTh4Urpyz1z/959uyVMBFLJWDGkLvlomWZ1AyjvsnRzKzcWmhlMm1rKeOXd21eN+OUgnAW spLb7HsLMfFhr+BQGuLlRPlbUlzfvvvfJ1HHR8i7bw4MYspNogr1DMFljfXguAJC8NsB+bxN29X6S 23civ9PV4K7e0FRWLsi2pKfAOoiKWyi6DAi+FJ/y2A8dteU6VOvDuRhTlhD4+U780KI1KGWjsso7G m+/oxkpR30GJt8y3vyDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rFGSy-00BRlk-0c; Mon, 18 Dec 2023 16:27:40 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rFGSt-00BRkE-2p; Mon, 18 Dec 2023 16:27:37 +0000 X-UUID: 558eb2fa9dc211ee958cff29c719f35b-20231218 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=MIME-Version:Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Message-ID:Date:Subject:CC:To:From; bh=lQ0aG9wRhiyr4Oicec/5c7bCXb/LExGjpCuewZxh8d4=; b=NLHVMSQndMi+ZweNPuTraKaEoRYHDKAcOrdh8P1Ka/T6AFMOXj+umDc6baW0cEdhTTDMDoEoXYffwkjsTKxRuOWoGQYJrHywBBeZe4I8/eFPOsaqJasjOijDCdJH8lalNGJgx1QOl2Ex0eyN47vVan3RLqrk0i7AmdRyjjwZe+8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:47de0d36-7bf2-42c8-bd80-8f5d809774e1,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5d391d7,CLOUDID:e65750bd-2ac7-4da2-9f94-677a477649d9,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR: NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: 558eb2fa9dc211ee958cff29c719f35b-20231218 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1644621196; Mon, 18 Dec 2023 09:27:27 -0700 Received: from mtkmbs10n1.mediatek.inc (172.21.101.34) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 19 Dec 2023 00:27:25 +0800 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (172.21.101.237) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 19 Dec 2023 00:27:25 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=etY9UkQ19hmbuRurEhpUkSYV1K4SFvCg18BssekCc5T+W11zk7QXas6JsU4dn+D1rx3H23lIIjL8nWLiDGuqVkjTXqx2qefPnUbzMW8nMXhtS27j0ynH69+HllfeZ+TjV55PprZjGCM1zweiqpG5PKYMsWPy4vunZRMDY5GjIM696K1W4jrIQ+5mBaNfoDFDtOV6lXiVrzgDo5DzVsBQc4LZ5Bc7hBpXRyhz/h+gpcBCNyy6ew5NQB6p+6DoTMfgSxZZHwzNfoXvESQhJIVHV4V+osWqAKcwpRLHyjsjXCzHy3mSEO7s1t2cS+j29P099WzlLa92fvPUimtCahr8cw== 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=lQ0aG9wRhiyr4Oicec/5c7bCXb/LExGjpCuewZxh8d4=; b=Yj3qgFUZbKHSEaJT1eJ9LerO7xiMbcPYRIMsmNG8EGyE/c86U76VRGhuy2OMwxzhJhQ1t2UwKvLfU/CSOpSZBqildduPfmfb5ffAuGPmYIAXMzaNNNX3yCBafV3ThYPbLbrvQhv6pACpwTswfRh74fYJokp2tHXKpFdW0Vq23C+F6TIYckBTGCHKr4G3mh34GsrHAq/APKOyRnnlsapn7a1ICIchJmxHP20ZP2TW/TOm5XtIlL5nDhatP4bL38N21TLPu8GAxI2EPM6Eae32IlGndP4WPXlfMUvoqTO8Gk5xoxre0NruZGsLQGqaMCrHjaoVmShnnNXEwNBJYxO1JA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mediatek.com; dmarc=pass action=none header.from=mediatek.com; dkim=pass header.d=mediatek.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mediateko365.onmicrosoft.com; s=selector2-mediateko365-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lQ0aG9wRhiyr4Oicec/5c7bCXb/LExGjpCuewZxh8d4=; b=e2wIlmkmEYsBQHtE2jWpR7BqkpBvkxZC7jmUZKuG73qP6i51ms632zJ0VhSWzfgk5jgrm9VkajrGTfcLQDaVUf4ky5zcjdoLaRQAh9KA9dTCobyzzdeWodniaTBCRYdDbkcqFsCJ/Iob3GB0CW4B66IfMMOiyOE4KgEy6EAKsOM= Received: from TYZPR03MB5199.apcprd03.prod.outlook.com (2603:1096:400:32::11) by SEZPR03MB7486.apcprd03.prod.outlook.com (2603:1096:101:10d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.37; Mon, 18 Dec 2023 16:27:23 +0000 Received: from TYZPR03MB5199.apcprd03.prod.outlook.com ([fe80::66c6:e98b:f23d:2d84]) by TYZPR03MB5199.apcprd03.prod.outlook.com ([fe80::66c6:e98b:f23d:2d84%6]) with mapi id 15.20.7091.034; Mon, 18 Dec 2023 16:27:23 +0000 From: =?utf-8?b?Qm8gWWUgKOWPtuazoik=?= To: =?utf-8?b?Qm8gWWUgKOWPtuazoik=?= , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Matthias Brugger , AngeloGioacchino Del Regno CC: =?utf-8?b?WW9uZ2RvbmcgWmhhbmcgKOW8oOawuOS4nCk=?= , =?utf-8?b?WXVnYW5nIFdhbmcgKOeOi+eOieWImik=?= , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mediatek@lists.infradead.org" Subject: [PATCH v4] thermal: fix race condition in suspend/resume Thread-Topic: [PATCH v4] thermal: fix race condition in suspend/resume Thread-Index: AQHaMc8UDpbiGtamyEO2ZwwtOh6UUQ== Date: Mon, 18 Dec 2023 16:27:22 +0000 Message-ID: References: <20231218162348.69101-1-bo.ye@mediatek.com> In-Reply-To: <20231218162348.69101-1-bo.ye@mediatek.com> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mediatek.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: TYZPR03MB5199:EE_|SEZPR03MB7486:EE_ x-ms-office365-filtering-correlation-id: 50ef3899-c6f5-45c5-81fd-08dbffe636cd x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: HAB78KMCV0Qy0KmCylxV88a8gZAZAER6fkWNoI6j1BLgRU7UV9OEc1jxzN+BgnTeH+lUT5KCPyt3QnqMgHbXoKLNsd5PQxI8FyWZE8mvwUwdE9KdJT0NSPyfPXFK8KTtO2vyoJK+i6Gu3HQ5SlY9hueeS8uPf+67x7lh7RWWOTop69j222wVd1PeYV9g10eC0mdY/WlYv1pwUi3aRNnfMJ5QTMRyPBpavDs6J+pe4arrN8+D9gpyNmMpu6bGvFto9FMjCT9+5JXffbRn/AFYcF+gLS57zjrWlses5IgE2RJQCCBxblK8az8S7tb43x+f5h2IC+UMRclxwUsn+n2yqdIr4szP8uw4Vm7c5FgknA1XmtGnrObBW+0g0QEIwfOMp7ndWdZHarLqmbc33k/2emDnm1m+W3fpTFPLH5/NBB+ArUty121PRuR4KqBlsiUeku/FNlzvr9rCkq4TAxzeUsGpek42gwKmiXpAQ2uy0yzpZfM+pz5BabzNmu3OBO4DTH4yBQb0Vq85v3DdBt6bzXCRZjoxHEwSAC4/lYWOywU1MLZKuiAvAAXbAfEQivtW/ErvU3wwBpA8jHNDGihchkLJYNbx5Ic3W6Gk36qPTT3wMs3fTMH6cPjJRkVmyjVXdzZUI8naOF5U51H7nBwkt1oLSU+FMblnNIWGx1uc+50= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR03MB5199.apcprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(376002)(136003)(366004)(346002)(230922051799003)(1800799012)(186009)(64100799003)(451199024)(55016003)(38070700009)(76116006)(110136005)(86362001)(85182001)(33656002)(38100700002)(122000001)(26005)(83380400001)(71200400001)(316002)(478600001)(2906002)(4001150100001)(66556008)(66476007)(66446008)(64756008)(54906003)(66946007)(7696005)(6506007)(9686003)(4326008)(5660300002)(15650500001)(8676002)(8936002)(7416002)(41300700001)(52536014);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?cQNdSoz8AIcH1YgFs5BxoRYfD63L?= =?utf-8?q?wBF8gGTMEQzxURcXoYz/F0DKbkYA3XNnRoob2+3b/NzmLEXGMMcktC+NIH6CKHW3z?= =?utf-8?q?Cy076qoWI117pWl6voolb06EG2XDwrogkY2GjUFTejsqp09y3iGidqryWOIlS2tWL?= =?utf-8?q?9VHBGxfdBU6yRE4/Ygm4c20beCn9zj2HFQ/byDvIDUsvFlJtLUSQ9DTM4C7teZmaF?= =?utf-8?q?YnYX5bpvwiP2cGmTs49Osn4VszAD4ePAWkXnuvPPDjaHSsu9unOhAfJJ09JA/ZHPV?= =?utf-8?q?vjwpZNArl7ix0bphllQFTttiirBlb2xGzXFt9VNuohuk9eVqpBk/LYA6cGtJIXT7W?= =?utf-8?q?hlvAU7wANXQoDUFivobYcBOQuFEGFd1QmDIz8KNlZvQdX6XaVxzNq3K6Ohx9qE2lF?= =?utf-8?q?lbq4HszS4CbShMhW6bth4JV2g4RL0faZwu3o6CcMNGOy+iX8Xqd14v4fjIvs3RZN+?= =?utf-8?q?2B1nMSFO0Zkh8FtF2mQ0HGbaDoIR8Hkl7RX29gBkgamHXjyWPQBulnCimDwZnr2hw?= =?utf-8?q?GbZ9qKJrxPBcH77qN9MRzvsVYn57THqRDlsfzi76LceXHVvJwCS3hDBgsgCQ4XlXQ?= =?utf-8?q?vQKy3x0wHy/l2hIu8408FCA9W1z6Y+3JqsLUvns20iKtctqFSeQdsee7ogV/l3JHO?= =?utf-8?q?/Jl9q7/B5mYgUIPL5/+Uvj4xNyor1MztlvJAwaq7M2hUyTNjc5FJNOTOn9lrbMkFv?= =?utf-8?q?HVHt6bbqzmHVM/YQxt9nBc4N6YDllc17lFqrot7Dd+MqTR1zvXE9JzsrYHQQt5NZ6?= =?utf-8?q?sKAgPDIvI6fVHOIFFc5d4TRLo0ytGchaUwkJWt89inAD7Y1p86OihOt+Nz1pV5mSQ?= =?utf-8?q?K45m59jaEL2dNpOszfNWSDOg0zVP5R9k7dq+ghT5riNf4pZGJJbXOiDAfAgJ0F6Y1?= =?utf-8?q?GhmjXXCCCnqEGcwsOrrxnde2qJmdzwp4lk2pDzpcWuPCSTnbf5FsO6IU4L/J3mayJ?= =?utf-8?q?R5PEbbupWmsRO5mjCwI9jSe07gbZNj9iIAx9XJulE24W0IcYsRL1Ut3OoBF/EFZvB?= =?utf-8?q?w1cKfyp8mzXcHJ8JZ88mcU+X7nf+LR5TmBP5rZXhIhemzqZD7SPgmd/axWfbOgKKS?= =?utf-8?q?ltRXNhEwBFfs2PtJLsMtJQJbq6gtSxI1WCuoHbdDXzXRv7K7IgnDPRbXl+gdg/Lxn?= =?utf-8?q?E8FMo+QzTIPlW5h1iQyIiVwOBpFeExQo3UbbNTU46pm/6p0kBUXrQJuOYDTAED7pl?= =?utf-8?q?01WiOS+JU3BApyTWcdoUGQs/AjieqGrmC4exLKRB6mvLRmTSoDxOBqlKd1cyvdXVu?= =?utf-8?q?3S4PfG6yR3vYfdwFEtEAdSaZJ3VzfjbAYq9Bww066Bn90UE98wWrMI86HN6yA+RmE?= =?utf-8?q?mL52lZ8BFEyI7Eh/i19JbtjNTsPP5SjFkWEaqWHQOzrVOEGS85A8Z6lfc89c0yvKd?= =?utf-8?q?7x+yVusN3JL/uKo5XhT3IFSbrVOigYXURJF5m31ZZKlbNWA4PTHt9hn3osG7wpuzQ?= =?utf-8?q?VBpSfgs92FYWz/ODr2AzlodygEzz0/JqkAKgo6xq5+x28efMLWunFkZw=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TYZPR03MB5199.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50ef3899-c6f5-45c5-81fd-08dbffe636cd X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2023 16:27:22.9531 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a7687ede-7a6b-4ef6-bace-642f677fbe31 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: CtcKvdy8+4Qs7jbQ5O7SVTmriUbbpOd5zHrSV7u/JZ3w+6cM5Fj4QHOMbPZ2SNhOaaJNvEmATjMdL195GV3hDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR03MB7486 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231218_082736_187871_AA6A2240 X-CRM114-Status: GOOD ( 11.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "yugang.wang" Firstly, it needs to be clarified that this issue occurs in a real- world environment. By analyzing the logs, we inferred that the issue occurred just as the system was entering suspend mode, and the user was switching the thermal policy (this action causes all thermal zones to unregister/register). In addition, we conducted degradation tests and also reproduced this issue. The specific method is to first switch the thermal policy through a command, and then immediately put the system into suspend state through another command. This method can also reproduce the issue. Body: This patch fixes a race condition during system resume. It occurs if the system is exiting a suspend state and a user is trying to register/unregister a thermal zone concurrently. The root cause is that both actions access the `thermal_tz_list`. In detail: 1. At PM_POST_SUSPEND during the resume, the system reads all thermal zones in `thermal_tz_list`, then resets and updates their temperatures. 2. When registering/unregistering a thermal zone, the `thermal_tz_list` gets manipulated. These two actions might occur concurrently, causing a race condition. To solve this issue, we introduce a mutex lock to protect `thermal_tz_list` from being modified while it's being read and updated during the resume from suspend. Kernel oops excerpt related to this fix: [ 5201.869845] [T316822] pc: [0xffffffeb7d4876f0] mutex_lock+0x34/0x170 [ 5201.869856] [T316822] lr: [0xffffffeb7ca98a84] thermal_pm_notify+0xd4/0x26c [... cut for brevity ...] [ 5201.871061] [T316822] suspend_prepare+0x150/0x470 [ 5201.871067] [T316822] enter_state+0x84/0x6f4 [ 5201.871076] [T316822] state_store+0x15c/0x1e8 3.Enable thermal policy operation will unregister/register all thermal zones 10-21 06:13:59.280 854 922 I libMtcLoader: enable thermal policy thermal_policy_09. 4.System suspend entry time is 2023-10-20 22:13:59.242 [ 4106.364175][T609387] binder:534_2: [name:spm&][SPM] PM: suspend entry 2023-10-20 22:13:59.242898243 UTC [ 4106.366185][T609387] binder:534_2: PM: [name:wakeup&]PM: Pending Wakeup Sources: NETLINK 5. It can be proven that the absence of a switch strategy will perform unregister/register operations on thermal zones (android time is 2023-10-20 22:13:59.282), Because the logs for other thermal zones switching are not enabled by default, we cannot see the logs related to other thermal zones. [ 4106.404167][T600922] mtkPowerMsgHdl:[name:thermal_monitor&][Thermal/TZ/CPU]tscpu_unbind unbinding OK [ 4106.404215][T600922] mtkPowerMsgHdl:[name:thermal_monitor&][Thermal/TZ/CPU]tscpu_unbind unbinding OK [ 4106.404225][T600922] mtkPowerMsgHdl:[name:thermal_monitor&][Thermal/TZ/CPU]tscpu_unbind unbinding OK [ 4106.404504][T600922] mtkPowerMsgHdl:[name:thermal_monitor&][Thermal/TZ/CPU]tscpu_bind binding OK, 0 [ 4106.404545][T600922] mtkPowerMsgHdl:[name:thermal_monitor&][Thermal/TZ/CPU]tscpu_bind binding OK, 2 [ 4106.404566][T600922] mtkPowerMsgHdl:[name:thermal_monitor&][Thermal/TZ/CPU]tscpu_bind binding OK, 1 6. thermal_pm_notify trigger KE(android time: 2023-10-20 22:13:59.315894) [ 4106.437171][T209387] binder:534_2: [name:mrdump&]Kernel Offset:0x289cc80000 from 0xffffffc008000000 [ 4106.437182][T209387] binder:534_2: [name:mrdump&]PHYS_OFFSET:0x40000000 [ 4106.437191][T209387] binder:534_2: [name:mrdump&]pstate: 80400005(Nzcv daif +PAN -UAO) [ 4106.437204][T209387] binder:534_2: [name:mrdump&]pc :[0xffffffe8a6688200] mutex_lock+0x34/0x184 [ 4106.437214][T209387] binder:534_2: [name:mrdump&]lr :[0xffffffe8a5ce66bc] thermal_pm_notify+0xd4/0x26c [ 4106.437220][T209387] binder:534_2: [name:mrdump&]sp :ffffffc01bab3ae0 [ 4106.437226][T209387] binder:534_2: [name:mrdump&]x29:ffffffc01bab3af0 x28: 0000000000000001 Signed-off-by: Yugang Wang Signed-off-by: Bo Ye --- Change in v2: -remove Subject from title -add message for reviewers' comment Change in v3: -remove "potential" word from title -add more detail on issue Change in v4: -remove Change-Id --- drivers/thermal/thermal_core.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.0 diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 9c17d35ccbbd..73d6b820c8b5 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1520,12 +1520,14 @@ static int thermal_pm_notify(struct notifier_block *nb, case PM_POST_HIBERNATION: case PM_POST_RESTORE: case PM_POST_SUSPEND: + mutex_lock(&thermal_list_lock); atomic_set(&in_suspend, 0); list_for_each_entry(tz, &thermal_tz_list, node) { thermal_zone_device_init(tz); thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); } + mutex_unlock(&thermal_list_lock); break; default: break;