Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp948317rdb; Fri, 1 Dec 2023 03:05:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZAaZR/hkE9TUBLOd10FtI+2KW+NRS1s57tUMK6THfdObZz2QDr5fYoeG0M6q+l7qeFLyN X-Received: by 2002:a05:6a00:1acd:b0:6cb:6a27:ab57 with SMTP id f13-20020a056a001acd00b006cb6a27ab57mr26742476pfv.14.1701428755200; Fri, 01 Dec 2023 03:05:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701428755; cv=none; d=google.com; s=arc-20160816; b=UmMQn10kBheJMRu9/1aSoNrqHtREmFqf8U0ZrI9xACvTIrnctIHDi+YNtxYZNy68oz J46BWmjypl3YdZ5z0oHrC7Z/rLCO3lXvS17Qr9nExnl74JlrN7Wh3usSYbpxEaZEPZOM YGbBVq/EzCdJrHjMADO07OCf0LqMPfPPg8g/QXprQPSNQBhuZSltRd2RiXiYVt+sdLyS ovYAclXwlaSlLm48qlm77+a8g1hRrUz/JrTo+nTDdxYGkIW8aWV0bzo0p9p4akl5dR83 cV6zcuAM/QyO4XzQAnwxiNYABpO4ktOMHTqePE/nEJ4iBGkzs/1mom2yu46nU/vmJV8h g7vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=u/X12MYiUlHW7qeJupJnkx1RYaww2ePiSq4oiDHIZ0A=; fh=0IF0yWUuItGhVBH4/nwTp4ZXaScWJj0Dvu5mJepibYc=; b=oGar4h3gIsrKyRYjOJ+UAPShlU7NmWe8ANSi6twIkHs10MZKd8CcrCRBywaIcxh+dz WOwwFbfGSNgvs3JRKo5fk9YdqOEv/uLAD/omLj8y18DUS28OXibUbHP2TrWn6eowYGgV MLzaxaAgmzVARgiouY5bi7Lv+fdKbiQi+TubJv+OOej7HfoL6byY+b9x1wsEZbTZR8q7 3ZGIIzbYhk+jB3BPDtXqTdn/Ol9H6bQBCOLgySPkIPBgjCiiuQXmH0kjrRH1hHqhU8pB cNWc4X9Hs0vGdyoNHd3XanjwLLAlkRdL/I+ccBPUF5msfx51EcaTHEHNsr44/aQ1Ejy8 Rpig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id m3-20020a632603000000b0057d7cff25b8si3265245pgm.198.2023.12.01.03.05.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 03:05:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 97DE68167DAD; Fri, 1 Dec 2023 03:05:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378447AbjLALFJ convert rfc822-to-8bit (ORCPT + 99 others); Fri, 1 Dec 2023 06:05:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378403AbjLALFH (ORCPT ); Fri, 1 Dec 2023 06:05:07 -0500 Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E085B193; Fri, 1 Dec 2023 03:05:13 -0800 (PST) Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-1fa1e17a0b1so251987fac.1; Fri, 01 Dec 2023 03:05:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701428713; x=1702033513; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R4AG+bp1YwNTqKpkqmFk8uxVAl7UJkU/XsnQv7+d6Tk=; b=PlxUEzULwm05nYbLHjs7oFFnGR26ItvxDr7WMbEQVoaNMXAnrxFywhjmz0UEj4hMcJ phqo3j7GkdV9vwfKw6plLfWFwDRonBTDRCHAKfouQIh/MTLTWjqmAGlvCMB9K2uk9QjT pLxbAaFGfm3h3OiBlRSryJpBI0L0Q8JUuOsFwOUT6n5BJmtDaKd3IAUD/gYDgFJ4n9dB vrjC5YIH5f+p4Yoq8YbukOioCzxx/6IuylGFmSNdPX02/jRCDI7w7+7IEAVi2wTTlTrs 066HQjaP/gGSNM37Lb7lkcmXDVrPBxxUXLvs7K+8ju4W3eDBaCEoeqsd4wSBI2LAN3Jw yAMw== X-Gm-Message-State: AOJu0YwZ1yts9nsCCDQGecgDWK19OcVFdzG+3vNCTUXEOQsY+p2M03jI 8z9cczhIdtM9P02nQx3POjgK0iQ2tBBbpnK4/Cg= X-Received: by 2002:a05:6870:524e:b0:1fa:2d5b:f14f with SMTP id o14-20020a056870524e00b001fa2d5bf14fmr22007024oai.4.1701428713035; Fri, 01 Dec 2023 03:05:13 -0800 (PST) MIME-Version: 1.0 References: <5754079.DvuYhMxLoT@kreacher> <2933888.e9J7NaK4W3@kreacher> In-Reply-To: From: "Rafael J. Wysocki" Date: Fri, 1 Dec 2023 12:05:01 +0100 Message-ID: Subject: Re: [PATCH v1 2/2] thermal: sysfs: Eliminate unnecessary zone locking To: Daniel Lezcano Cc: "Rafael J. Wysocki" , Lukasz Luba , Linux PM , LKML , Srinivas Pandruvada , Zhang Rui Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 01 Dec 2023 03:05:23 -0800 (PST) On Fri, Dec 1, 2023 at 10:16 AM Daniel Lezcano wrote: > > On 30/11/2023 19:37, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > The _show() callback functions of the trip point sysfs attributes, > > temperature, hysteresis and type, need not use thermal zone locking, > > because the layout of the data structures they access does not change > > after the thermal zone registration. > > > > Namely, they all need to access a specific entry in the thermal > > zone's trips[] table that is always present for non-tripless thermal > > zones and its size cannot change after the thermal zone has been > > registered. Thus it is always safe to access the trips[] table of a > > registered thermal zone from each of the sysfs attributes in question. > > > > Moreover, the type of a trip point does not change after registering its > > thermal zone, and while its temperature and hysteresis can change, for > > example due to a firmware-induced thermal zone update, holding the zone > > lock around reading them is pointless, because it does not prevent stale > > values from being returned to user space. For example, a trip point > > temperature can always change ater trip_point_temp_show() has read it > > and before the function's return statement is executed, regardless of > > whether or not zone locking is used. > > > > For this reason, drop the zone locking from trip_point_type_show(), > > trip_point_temp_show(), and trip_point_hyst_show(). > > Isn't the lock used to protect against device_del() from > thermal_zone_device_unregister() ? Ah, I missed the zone locking around device_del() in there. OK, please scratch this series for now.