From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752024AbcFWM1T (ORCPT ); Thu, 23 Jun 2016 08:27:19 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33618 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750957AbcFWM1P (ORCPT ); Thu, 23 Jun 2016 08:27:15 -0400 MIME-Version: 1.0 In-Reply-To: <1466571990-12346-1-git-send-email-edubezval@gmail.com> References: <1466563538.2471.10.camel@intel.com> <1466571990-12346-1-git-send-email-edubezval@gmail.com> From: "Rafael J. Wysocki" Date: Thu, 23 Jun 2016 14:27:12 +0200 X-Google-Sender-Auth: nb_YnlkplOKyZrRVVon5wmjt3Ps Message-ID: Subject: Re: [PATCH 1/1] thermal: core: call thermal_zone_device_update() after mode update To: Eduardo Valentin Cc: Rui Zhang , "Rafael J. Wysocki" , Len Brown , ACPI Devel Maling List , "Lee, Chun-Yi" , Darren Hart , Keerthy , Linux Kernel Mailing List , Linux OMAP Mailing List , platform-driver-x86@vger.kernel.org, "linux-pm@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 22, 2016 at 7:06 AM, Eduardo Valentin wrote: > Because several drivers do the following pattern: > .set_mode() > ... > local_data->mode = new_mode; > thermal_zone_device_update(tz); > > makes sense to simply do the thermal_zone_device_update() > in thermal core, after setting the new mode. > > Also, this patch also remove deadlocks on drivers that > call thermal_zone_device_update() on .set_mode(), > as .set_mode() is now called always with tz->lock held. To me, this part of the patch is way more important than the optimization mentioned before. Apparently, the problem is that drivers deadlock, because the thermal_zone_device_update() invoked from ->set_mode() is called under tz->lock. So to address that problem you make the core call thermal_zone_device_update() after ->set_mode() outside of tz->lock and the drivers don't have to do it any more. Is that correct? Thanks, Rafael