Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp212369rbe; Wed, 28 Feb 2024 18:20:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW/B9UK5jeLLEPNs813FN3vovAZEzHm6O6voE2SRxm0/ctqUvTEtU/A8oQy53Ff7gS9g7XD49cdHvC5uzgEDxrkSYtwYVuHMBvnweluVg== X-Google-Smtp-Source: AGHT+IEJ1m6DkcRn6BjihvBnkdfS25yTt5qmFMVrsfnO9R861CK27E20YMbV3PIgQEnfi+Yfvj8T X-Received: by 2002:a05:6402:1c86:b0:564:3f11:a5bc with SMTP id cy6-20020a0564021c8600b005643f11a5bcmr345404edb.19.1709173246739; Wed, 28 Feb 2024 18:20:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709173246; cv=pass; d=google.com; s=arc-20160816; b=GC93/MLeE8yc5FGTM/M6UwLTCX8JDV2uziX+k+P4m5NXzoLN44L2AAgd/HQk/VYv9w Rx6vswo4/Xya19Sw7lkXs82JUH3ZhMh4a8Ul557KlQrVb2OMFTRjy4kXj07Q02AG/Dqa M8GuyAaFRf13LbPR3v/1ZHG1ZWxf6bRoUjRwrHtod0otQuGnQFnyKVhCOW+GlcdEUmON tbdCU9VytoFX6xyA86UY1vgM1qHlPj1NLF46XbCt9tHhbhF3vb2isLMjbkQpWmcQhJ/h wB3TAbXY5NlRVTAfsxc193hdI8iZ941OJXBAO6mSakQwyPpFLYz/DDP9A9JvdwCJXia3 4oLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:date:to:cc:from:subject:references:in-reply-to :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:dkim-signature; bh=ndHU4Gl3W3V+sGQ4tm5lbUz87+Cesf9e9pD+O9WP5iE=; fh=lqCLXdoGs2/4ht3y2ov/UDGOzU7frROVv//tUbNvINk=; b=FFj1uZfBQMF1K0sqDgckO1hL1htZXw/77SPF+A1hVNxa6h7YcKjyExFFNzJuhR5/FS oP3OHLjuGmYbjb7AgiMRD03sogp4Zhk4zvW+YUGgFxt3ilPgkiWzE9hhCHagLgc4sOXP /G5P5O/ykifiETHmz0ZMBXwyEj/tHyJkYdyjUpZzzq1OWxOpmWTj1cldjujaI9MICVMh ZV0T1syHk8jsWFOppohq4S8XznG4SUN0Yt7l3xEJ5bpWZaaK6FecvPGowdLGdesnEtqV INJ5YNlztoAP7c2/GFDXv64vgI4hfKozl3Up+aqPEA7LcBeX4lwVps9rsFB5IYx5eJsW 9xYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SMlLiRWC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86041-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86041-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 j14-20020aa7ca4e000000b00566494c88d8si134531edt.243.2024.02.28.18.20.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 18:20:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86041-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SMlLiRWC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86041-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86041-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 49ECB1F23551 for ; Thu, 29 Feb 2024 02:20:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14E3536B0D; Thu, 29 Feb 2024 02:20:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SMlLiRWC" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F6A43612E; Thu, 29 Feb 2024 02:20:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709173237; cv=none; b=edkEY/PZCC7G3pjDs18rgrjaK0/+Y7f/B4wXxQE++SQNg2qilQs2rRXcaKP/IIUFF1iV5JEtPBcasyDkBcKVDT3m/uyDGp5kxJFatNXECkNp4TI9etVyaIBA5bMgOy2iiHHBTHMqHiLANhLnD5ESZUmo9XGu2THeU1VgV7qwRxo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709173237; c=relaxed/simple; bh=ndHU4Gl3W3V+sGQ4tm5lbUz87+Cesf9e9pD+O9WP5iE=; h=Message-ID:Content-Type:MIME-Version:In-Reply-To:References: Subject:From:Cc:To:Date; b=FUcGDf8v4MMThVVttn0jSi2aCsJ37Gr5TU5VSQWR5QHuBv0AoPuh1952oaG7RA04olnni+nyGBHTYVdG3XqPVgS6EpvgVrtDpdFBC5aal6MxrKDWsWB3ZqTktld9M0MfDuXCbYk9uSWR0e0K1rja5U2zfi3uClQay1YN66saixo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SMlLiRWC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABA4CC433F1; Thu, 29 Feb 2024 02:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709173236; bh=ndHU4Gl3W3V+sGQ4tm5lbUz87+Cesf9e9pD+O9WP5iE=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=SMlLiRWCRXf9UeJ6EIl+4DGlqM+J1wHQwlRmSRroWC4rI18MdpO6BkwgVtEfeOvna uDTBbtJNi9BMgFzrHZRKPnPOSko+gCLz8ZJIV4gzqW7uC6+BfbLjj0EyH5RIRx0lgt oPv23BBBaS9QnG/FQgO/walRsP+KSKy8HSjy4RlVwSCy6l2srhc3M4uLYMAp22OWrU pdFmUCDGRiCNV6AdTI8u51/NYVb3bgdD1PK9k/dZF8gq6UflzQNysr6+dDwa8Fn7wt m4VBBZm0js7S/RZhwabX3uFqqdmMse9BS0Ule8yJvbALIgnWVzmJExI1fec7z4Wz5E bq7bmxQUUivVw== Message-ID: <1d0baf6dbaa1c2ca6594f9a2bcade2c4.sboyd@kernel.org> Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20240214183006.3403207-1-cristian.marussi@arm.com> <20240214183006.3403207-7-cristian.marussi@arm.com> <500e265eb7c6a03a40e0067c8806e059.sboyd@kernel.org> Subject: Re: [PATCH 6/7] clk: scmi: Allocate CLK operations dynamically From: Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, james.quinlan@broadcom.com, f.fainelli@gmail.com, vincent.guittot@linaro.org, peng.fan@oss.nxp.com, michal.simek@amd.com, quic_sibis@quicinc.com, quic_nkela@quicinc.com, souvik.chakravarty@arm.com, Michael Turquette , linux-clk@vger.kernel.org To: Cristian Marussi Date: Wed, 28 Feb 2024 18:20:34 -0800 User-Agent: alot/0.10 Quoting Cristian Marussi (2024-02-22 00:28:41) > On Wed, Feb 21, 2024 at 09:44:14PM -0800, Stephen Boyd wrote: > >=20 > > It's not great to move these function pointer structs out of RO memory > > to RW. I'm also not convinced that it's any better to construct them at > > runtime. Isn't there a constant set of possible clk configurations? Or > > why can't we simply add some failures to the clk_ops functions instead? >=20 > Well, the real clock devices managed by the SCMI server can be a of SCMI is a server!? :) > varying nature and so the minimum set of possible clk configurations > to cover will amount to all the possible combinations of supported ops > regarding the specific clock properties (i.e. .set_parent / .set_rate / > .enable / .get/set_duty_cycle / atomic_capability ... for now)...we > simply cannot know in advance what the backend SCMI server is handling. >=20 > These seemed to me too much in number (and growing) to be pre-allocated > in all possible combinations. (and mostly wasted since you dont really > probably use all combinations all the time) >=20 > Moreover, SCMI latest spec now exposes some clock properties (or not) to > be able avoid even sending an actual SCMI message that we know will be > denied all the time; one option is that we return an error,, as you said, > but what is the point (I thought) to provide at all a clk-callback that > we know upfront will fail to be executed every time ? (and some consumer > drivers have been reported by partners not to be happy with these errors) >=20 > What I think could be optimized here instead, and I will try in the next > respin, it is that now I am allocating one set of custom ops for each clo= ck > at the end, even if exactly the same ops are provided since the clock > capabilities are the same; I could instead allocate dynamically and fill = only > one single set of ops for each distinct set of combinations, so as to avo= id > useless duplication and use only the miminum strict amount of RW memory > needed. >=20 Yes please don't allocate a clk_op per clk. And, please add these answers to the commit text so that we know why it's not possible to know all combinations or fail clk_ops calls.