Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp78949ybl; Wed, 11 Dec 2019 14:20:21 -0800 (PST) X-Google-Smtp-Source: APXvYqzlJZpf9iWCAsQFUFhKGQ+KFm0n6rUQQzP0AruBaBWJsRfv28l4YnjrAQIfGdCzzXxy6gxF X-Received: by 2002:a9d:7495:: with SMTP id t21mr4322914otk.86.1576102821024; Wed, 11 Dec 2019 14:20:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576102821; cv=none; d=google.com; s=arc-20160816; b=gZ8NUsW+Im6mS9c+azZP1svm9et+mVPZLZaea44bUsLKmD7a8v3XFL+Ved5LgLLzgY 4wV4aOrOyPHcwl/welvbf/It2qFU9AH4awSvJoyWYE5KEmfy32AHBM7N5RNHnKZHL8wW 6hWqSgwgmsZstzMYOLeyl7lEXrnOzAcpGUXKNtcbLlXBOV5C/9yRdu62QHfxvbfGLBjP MaF2IQYAOtpN76nwCk+/IHZA4JYSNZ5pNrVxhm/ic396nkk6SJYNdn78ZY9l8MR8CvCf Al2+i4OAbK+z0oj9VFYUvyd57Ntiymxw+A0wL7i93U38/Nt9oJmjxZ2MVLj5QuT8HGsw LlFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:cc:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=72CkmEu8P0deCrZSK3BbV39L1/XfAcEqTc+T0/vC9p8=; b=E2ZPCKc+f9/Doa9EpX3vFXWLrwELM9SP/T0MuyEMvASWSmmTLeG0BT9/8PhkXPEL5/ hYOoP+Ed+dmken8ecrQ4kZk+m0JHmdOL7gGC3mU7vOoXMDMSerI+ZIwNCTY+d+lS8ANU YkDKjmO23ijtoj3KAoCg5cZ3ypl/MZ866Yg3tq2xglCJ9i5F69IFh7mPwBPreHdA973B J8aJpMVvbunrIwhft9NmmXVUSg9a4aHq6wTQsGMaYVZZing7Y8JVAQR5wn+/20Y77vzF H66SqdwAHTDCOXwJLfkZWUmKBkb9AiYWT6C4wOLWbpPnksm1y8Wex0HK1rz+sKB1DS3/ R8Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="JqwJ7U/L"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6si2044083oti.4.2019.12.11.14.20.07; Wed, 11 Dec 2019 14:20:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="JqwJ7U/L"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726608AbfLKWTR (ORCPT + 99 others); Wed, 11 Dec 2019 17:19:17 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:40453 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726313AbfLKWTR (ORCPT ); Wed, 11 Dec 2019 17:19:17 -0500 Received: by mail-ed1-f68.google.com with SMTP id c93so20834579edf.7 for ; Wed, 11 Dec 2019 14:19:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:cc :content-transfer-encoding; bh=72CkmEu8P0deCrZSK3BbV39L1/XfAcEqTc+T0/vC9p8=; b=JqwJ7U/LA2SMeghbmpJ0R3IbdVMoHlrcIrEqcEnWBOJYg1X47XE1vElstrUfVqfOe9 7Nm9Ve0wPUG+eL/33omQ3z+lfWJ3ZuEFYPQgQhGVHRoQwdfZyBlRx72U1gnPsLcwQvrA eEymZjvC2Os3hjP6l4q6HSOzp0Gbb72XhMqGlT5gk/sVsAasKMpGIWw9OThTEKCns8+r PBVXHwHJq8Crr3ZF2HH/fAVHZ7VwGo3VI1FZ8Gru00EPm7LTvAdUMT6wW6yzBQghPR2o d2TLW0wSqTwP/6JT9UatESP2h23cTh4m4+D/Pb1GzLzhPTYRUr3KZCppK8zOGb8WMY63 MQYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:cc:content-transfer-encoding; bh=72CkmEu8P0deCrZSK3BbV39L1/XfAcEqTc+T0/vC9p8=; b=GteuV7Uut1hRsxXCOGznyEUiBFEgCs793JQtX/hwJ7GpgcvNL7BABm1P9nQyWoyt82 S4H1m8LXM1Gb1tG/0ORIMl96qeEWkG/u1yTLm8u5Bh8Izb69/5IxS+7ejHQoFejNVBqG dbz8Ism9SROb+Ear9bwwzPytWnOIZRNF/pCWZgefCfP2HkOjkD0Ejw0MiH0qy1c9F6fU oTT8eeo/M7IWPHf2pLc2yqrzjeSaBaAISinB3u/d3zPjb4jt9HDmvZPI8IoCe8sOCMgA /DzJtOk6vLfPlJUHWNI8bmtWfcHY901HoVv+be1+2RwbH6GtuJoTuSf8fkOjG+zydfLW MDIw== X-Gm-Message-State: APjAAAXNNJlyaTVs+IhoKJ3lkyKW2839hxE++aEte2tL91YMbLFCrvDL DAC0VK1n8/z8g2QNvi0QZhS9IW5APwaKyFRqtqowrmMH9a0= X-Received: by 2002:a17:906:9716:: with SMTP id k22mt5047774ejx.233.1576102754435; Wed, 11 Dec 2019 14:19:14 -0800 (PST) MIME-Version: 1.0 References: <20191205071953.121511-1-wvw@google.com> <69dd3a7a-c5fe-3ae7-8a4d-c3939870eed8@linaro.org> <0603228e-5f0b-d335-30ce-67cf0626a489@linaro.org> <20191211085400.GB500800@kroah.com> In-Reply-To: From: Wei Wang Date: Wed, 11 Dec 2019 14:19:03 -0800 Message-ID: Subject: Re: [PATCH v3 0/3] thermal: introduce by-name softlink Cc: Linux PM list , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 11, 2019 at 1:11 PM Daniel Lezcano wrote: > > On 11/12/2019 21:11, Wei Wang wrote: > > On Wed, Dec 11, 2019 at 12:54 AM Greg Kroah-Hartman > > wrote: > >> > >> On Tue, Dec 10, 2019 at 09:54:11PM +0100, Daniel Lezcano wrote: > >>> On 10/12/2019 21:01, Wei Wang wrote: > >>>> On Tue, Dec 10, 2019 at 6:36 AM Daniel Lezcano > >>>> wrote: > >>>>> > >>>>> On 05/12/2019 08:19, Wei Wang wrote: > >>>>>> The paths thermal_zone%d and cooling_device%d are not intuitive an= d the > >>>>>> numbers are subject to change due to device tree change. This usua= lly > >>>>>> leads to tree traversal in userspace code. > >> > >> tree traversal is supposed to be done in userspace code :) > >> > > Yes, that can be done in userspace, but given the amount of thermal > > zones we have in some mobile devices, this will bring a lot of > > convenience. > > But usually all these thermal zones are fixed and building the name<->tz > association is just a question of a few lines of code from userspace, > no? What would be the benefit of adding more ABI? code reuse as tz mapping is per device tree setup and we try to use the same _type_ in thermal zone in shared client code for Android thermal API. > > If there is a thermal zone change, then a notification can be used, so > the userspace code rebuild the name<->tz, no? Assuming you meant for type<->tz, this mapping won't change in runtime in our case (not unloading things), but it could be changed due to device tree change, e.g. adding/removing thermal zones. > > > e.g. this is on Pixel 4 XL: > > coral:/ # ls /sys/devices/virtual/thermal/ > > cdev-by-name cooling_device15 cooling_device22 cooling_device3 > > cooling_device9 thermal_zone15 thermal_zone22 thermal_zone3 > > thermal_zone37 thermal_zone44 thermal_zone51 thermal_zone59 > > thermal_zone66 thermal_zone73 thermal_zone80 thermal_zone88 > > cooling_device0 cooling_device16 cooling_device23 cooling_device30 > > thermal_zone0 thermal_zone16 thermal_zone23 thermal_zone30 > > thermal_zone38 thermal_zone45 thermal_zone52 thermal_zone6 > > thermal_zone67 thermal_zone74 thermal_zone81 thermal_zone9 > > cooling_device1 cooling_device17 cooling_device24 cooling_device31 > > thermal_zone1 thermal_zone17 thermal_zone24 thermal_zone31 > > thermal_zone39 thermal_zone46 thermal_zone53 thermal_zone60 > > thermal_zone68 thermal_zone75 thermal_zone82 tz-by-name > > cooling_device10 cooling_device18 cooling_device25 cooling_device4 > > thermal_zone10 thermal_zone18 thermal_zone25 thermal_zone32 > > thermal_zone4 thermal_zone47 thermal_zone54 thermal_zone61 > > thermal_zone69 thermal_zone76 thermal_zone83 > > cooling_device11 cooling_device19 cooling_device26 cooling_device5 > > thermal_zone11 thermal_zone19 thermal_zone26 thermal_zone33 > > thermal_zone40 thermal_zone48 thermal_zone55 thermal_zone62 > > thermal_zone7 thermal_zone77 thermal_zone84 > > cooling_device12 cooling_device2 cooling_device27 cooling_device6 > > thermal_zone12 thermal_zone2 thermal_zone27 thermal_zone34 > > thermal_zone41 thermal_zone49 thermal_zone56 thermal_zone63 > > thermal_zone70 thermal_zone78 thermal_zone85 > > cooling_device13 cooling_device20 cooling_device28 cooling_device7 > > thermal_zone13 thermal_zone20 thermal_zone28 thermal_zone35 > > thermal_zone42 thermal_zone5 thermal_zone57 thermal_zone64 > > thermal_zone71 thermal_zone79 thermal_zone86 > > cooling_device14 cooling_device21 cooling_device29 cooling_device8 > > thermal_zone14 thermal_zone21 thermal_zone29 thermal_zone36 > > thermal_zone43 thermal_zone50 thermal_zone58 thermal_zone65 > > thermal_zone72 thermal_zone8 thermal_zone87 > > > > > >> But what userspace code needs to do this, and for what? > > In Android, thermal daemon and thermal HAL as well as some init.rc > > script would use those thermal paths for managing and monitoring > > thermal. The daemon/HAL could have logic pipled in, however Android's > > init.rc script would be really tricky. > > On a related note, we also create /dev/block/by-name links from userspa= ce. > > > > Thanks! > > -Wei > >> > >> thanks, > >> > >> greg k-h > > > -- > Linaro.org =E2=94=82 Open source software for A= RM SoCs > > Follow Linaro: Facebook | > Twitter | > Blog >