Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp1041723lqs; Wed, 6 Mar 2024 04:53:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXdW5HZBlbB2E9KukigQW55Ti6/uUJgR/4ehaQT3OotpH6l2qWoemS2uqbjpEp51CGzXiXLlc4Bs0nkG8Ct4Rql4wz8iR+O/VC5Yy/ySg== X-Google-Smtp-Source: AGHT+IH/rGZD5aB06ruMx5wbAG1XoHiclW+MilyNvpqyqzuAEooNqn4Mtje21d8noC3eBV0B3knH X-Received: by 2002:a17:906:fa92:b0:a3e:d5ac:9995 with SMTP id lt18-20020a170906fa9200b00a3ed5ac9995mr10641219ejb.59.1709729632345; Wed, 06 Mar 2024 04:53:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709729632; cv=pass; d=google.com; s=arc-20160816; b=fiO64tRUFLZmI2zrbqJvvW4MLyvYedfkMTS9KHAF+gu/hI+orUNYlqxhq9moKGFfbT VyogePERuEl9kSE18lAPZky+EG3m7BGurQtmTDwDZVPlJmtMxlxbJMcYAdZs279aj2oz velksQCccRV2+lufZ3m3NYZRYs/7SwToXWhx7pcKeipcYqw8MxFC9ngiyTS7+PJQLT1e YI5eenaF2gBxQc20KegB0bT3bEq6Umvg5qfffsiwFfYFbUtBo7gOmr69Qhlnu6ui3DYu iB/Kl5IbndiHXQRxzyl3or8DJ7hfhnvmUdlsMRwBoyuhoL6y4dSE9X2M0/EkoMba/aP2 +z/w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=qRJTBcBNjexBHBHoxpbZHoKaxr9Kj8yTCM0BDotImdU=; fh=EgOnDYvvWRGr+yt8uregUTq4EnKkIQCil7pJ6Leene0=; b=ZMm63yCVoySFx7dHyJCePjtXUrD0y8yS5oopWF6iW2bye/kPN/K+9xhd7FXTq1Rn6j u2TGslFP2LDFig871QWxGVg2UqzaEm4xQYzbXqMDonBSLwnpnY7PURA2Aqh1rLSK3yFP yjtB6N7Enw74zLnyS0ycpRpeAs5e5ADzcGLiSlPNFSkZFKYJk8hj07S8mSnR9fRYhKGc Ac1o1N0HvYwkdUP5UBaIuC15ANhmtk8ug5LiI4UplJ/p24kHamPdqtogfcJOa2uCOBHY /fJYKr1qnNw9UeoEamBUneqe2U/Y/w7HXNEpWqAF3SF/NeWEU2EzpB6uplvE1S11Tqhg pHtQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-93925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ht14-20020a170907608e00b00a44dd8b250csi4264456ejc.253.2024.03.06.04.53.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 04:53:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-93925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 198471F22961 for ; Wed, 6 Mar 2024 12:53:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8398F130E29; Wed, 6 Mar 2024 12:53:21 +0000 (UTC) Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 872B98615A; Wed, 6 Mar 2024 12:53:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709729601; cv=none; b=fW1Rub3mVmgnT7WFVJ5aoeqidQ3Rih2QArg9+se0teLZa9BJLLQpum6XrbJKFLuhEszWEZLkSNSUm5n+29PEhIP6TF/E2rm3wpUswSm03OUH1rheSx//xn34kFus4sicMSS5RfVEf7cYr8n84toWnw4RtUvz22gH5c1SMihM1fQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709729601; c=relaxed/simple; bh=y3kQn2h0xqTDbe12pz3WTdK+o94C/uEC85RMraZcn5Y=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=vB1WmAfTNZqEbm4nOw8hVgJ2MGETKH3S7W/guzKSSXBqDIsBNlbl1ujdmLwY48zfO0eZudLK7mib8JcTkdVrildT2DNIV+6KEKqOkCgsO4M//0nr0ziH8HfDt+PLk/mjyFAUhXtf6KYoQCE+jGp5Q0mJ2wWRvhj7SWnr2oSe6aQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-21f10aae252so739162fac.0; Wed, 06 Mar 2024 04:53:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709729598; x=1710334398; 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=qRJTBcBNjexBHBHoxpbZHoKaxr9Kj8yTCM0BDotImdU=; b=afFyQaUizVj77GqPsO7wzm/ElORUTQ6W3reLrvMCxfGYBtPABnh03M9E6iFk+XAFGP WdkORiRPs4gqpBY8u95uZrpl59oKKCTOWTYror2aF0v0RhysPyH8CyQO3dl4pejDmise PMyL+J5JY3+2lD0SSheeK6xhoFj8SBy4KmFfuxOp95WtBQG1qoEii9WdoR++20+GP4Fo p5nr9a2sCNeTMk5zRwHUjBfmbEs/sSL/TaUW8ZKixZAghR/Y8l3RJZ4oykJ04iEfpNXm kaVAKItx2dc5GJF7V/i4lhpY2f5nfMJGn034keb99AbeT9rF+hzzx9xitGFr3RBh931y aR4w== X-Forwarded-Encrypted: i=1; AJvYcCUbIRxncaUHlc6Xxft4YXurGJj9WhtG9jsVHswZrlUouP3peDqBcKkafKyeMh/qHRfZbJr9Y9GeDoyjz8T0KlTxe+itw3Bt96A6LCcdnVfFCnTy0F9op1kXjEqQYYlEAop+59A+Jj4= X-Gm-Message-State: AOJu0YwSUM+3c597nZcpDXHqeLKjsU+hPuiMDzzjtR2wyWj2X81p7fJc uPQ19SP8PZWD5O7MJREzzfi4nuYKS8V3gSIWOmSFOtp3E7XwFHuImyucYST+dUSsxCQ58t+p9ae fOZQFZfxUvG9HJV9IAmjI2bakDIo= X-Received: by 2002:a05:6870:b507:b0:21f:cd7d:9904 with SMTP id v7-20020a056870b50700b0021fcd7d9904mr3603831oap.4.1709729598602; Wed, 06 Mar 2024 04:53:18 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240306085428.88011-1-daniel.lezcano@linaro.org> <14651d5b-0f67-4bff-b699-2cd1601b4fb2@linaro.org> In-Reply-To: <14651d5b-0f67-4bff-b699-2cd1601b4fb2@linaro.org> From: "Rafael J. Wysocki" Date: Wed, 6 Mar 2024 13:53:07 +0100 Message-ID: Subject: Re: [RFC PATCH] thermal/core: Fix trip point crossing events ordering To: Daniel Lezcano Cc: "Rafael J. Wysocki" , rjw@rjwysocki.net, linux-kernel@vger.kernel.org, Zhang Rui , Lukasz Luba , "open list:THERMAL" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 6, 2024 at 1:43=E2=80=AFPM Daniel Lezcano wrote: > > On 06/03/2024 13:02, Rafael J. Wysocki wrote: > > [ ... ] > > >> +#define for_each_trip_reverse(__tz, __trip) \ > >> + for (__trip =3D &__tz->trips[__tz->num_trips - 1]; __trip >=3D= __tz->trips ; __trip--) > >> + > >> void __thermal_zone_set_trips(struct thermal_zone_device *tz); > >> int thermal_zone_trip_id(const struct thermal_zone_device *tz, > >> const struct thermal_trip *trip); > >> -- > > > > Generally speaking, this is a matter of getting alignment on the > > expectations between the kernel and user space. > > > > It looks like user space expects to get the notifications in the order > > of either growing or falling temperatures, depending on the direction > > of the temperature change. Ordering the trips in the kernel is not > > practical, but the notifications can be ordered in principle. Is this > > what you'd like to do? > > Yes > > > Or can user space be bothered with recognizing that it may get the > > notifications for different trips out of order? > > IMO it is a bad information if the trip points events are coming > unordered. The temperature signal is a time related measurements, the > userspace should receive thermal information from this signal in the > right order. It sounds strange to track the temperature signal in the > kernel, then scramble the information, pass it to the userspace and > except it to apply some kind of logic to unscramble it. So the notifications can be ordered before sending them out, as long as they are produced by a single __thermal_zone_device_update() call. I guess you also would like the thermal_debug_tz_trip_up/down() calls to be ordered, wouldn't you?