Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1252803lqo; Fri, 17 May 2024 16:37:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXmGnbfVhJJveyFAG9/t1ag1SSfmWzeecapKUQGSkCISZyrRYL0Uip7FLASkkMfP2CSyTTSPQ6gNCrCGz7ivdkPdKQ7tdXF2SHhSw6k0w== X-Google-Smtp-Source: AGHT+IHIV5cwvvErOkuC5AamH+ao5qMZpliquyyYI5pv14a4JGOOskkYQTvRMb49Z2Cbs7Hbuy1T X-Received: by 2002:a17:902:f544:b0:1dd:135e:2604 with SMTP id d9443c01a7336-1ef43e29685mr313249455ad.40.1715989059478; Fri, 17 May 2024 16:37:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715989059; cv=pass; d=google.com; s=arc-20160816; b=Nj+WwBGfMbSNb6Xc8v6mBTxvmn/KMz3GCyGeCopOPjJNQLkM4EgSGvrNFdWoDWiGwy y+00/hh0tz/Pf3XC6Q4876R5R0K/euaBTrUSzA54opc4HjgR/FnWa6mmPEyG/C4VZE63 OYOlAst238oapSWGF6VmqHrNCIDo7ruX4UvUatBEsOA5M03kXs0SZnkj85ZpmAuDkR/D CiuIStd88AlzJ11UysaoOVHH7QKgK3o/NlapJWtriLZ+kXefJbcaOoAn0MurVPdcjHJp oNXsYoHFx8x4No8JL8q8w5II+Is5xCG+/lv84g05MJLxjJR9hG+1gQ4GMLwPs+0ae6vp BgJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=5hkFzFH0WqUDtk5tfXiCLXCsPkv9Y87d71GcppOkIUw=; fh=oscnr9v2rxGptbaSUMr+Dau10xxcdYDmU/BTCEj2hpE=; b=krNjga1pWOxjM+r4oN7B0IzgSDwSpJKuemIhcukw9d/PXISvSemX0qmGnleW8IK9bX EOIZHjTlwIPTExQ7+zlrkWyHtdhyEPrGyNokW7F1ZSDhrpoTVjF5fUa1CRljndYxGolK /cXaCt7I0bGiByamYauRa9vawmbFh7b4hxyYUWR9gQyG5IdbY5JbY5iM3tRdJP2lpN5d pYh0C1r5D6BYNepnmbj+j567Db3Xlu6LNK3WSDJu0/c0CDplBBilfiTM6XQF/ufNlOQN s3xtQJxd4dVEzcQTAFVawGf42AOBzuUDRY4LWfBXR/KcRlsow6VTm3yl2+GLZA3O2jiZ S1FA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=k5JZn+N9; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-182697-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182697-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c14c7f0si35154645ad.498.2024.05.17.16.37.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 16:37:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182697-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=k5JZn+N9; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-182697-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182697-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 22C54281AD9 for ; Fri, 17 May 2024 23:37:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 146E31411F8; Fri, 17 May 2024 23:37:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="k5JZn+N9" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (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 A16DA21373; Fri, 17 May 2024 23:37:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715989053; cv=none; b=D2ToQ6t9vhEVjSG/RxzYEGPaa3BdPyRy3BNXiwCRsqiQVDgOOLv/McWe8Glxx4xDB+Z4HmFmvc0GufQMhyNmS+SQZLWgjj4xbR0V3BKSTywt3KmNvrJTWOcb0G4jnXz5OkR+xO/WAplwR6dgAfLQZtM8rYsRIJkQUNVEfdhgiwQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715989053; c=relaxed/simple; bh=9f9zI+W/kOF9PQZyMuQ7fwuoXF6DvwzLPEBJGtN6o78=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=V936Sxlg4Mq7nGgBBVDq45VwqFplLKtLJCpwzOBz2eH5Q6FXpA5lfysNPHafgBARdsUR++KbsJ2emsAiDF9SKWE7IaG4W4mc/kp1H6qu0MouxkEYbpT5bsiow5l63/oLO1uaWEslPhp0R1LUj4BoS7VTVcYCU3grobCXO5133R4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=k5JZn+N9; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5hkFzFH0WqUDtk5tfXiCLXCsPkv9Y87d71GcppOkIUw=; b=k5JZn+N986SzxpVXNYZ2p7sV7Q KBwEmkOAIS4f0ylyAq+HRz5JJLnH61ww4Mx8yEMJw+a/psuslX5V+5QineAEqXfqDOEZEcS2ycBtP D6XSxjH+n5/Aznak+65Ev8XjTvxYoeHsHkdehxV1mabRi77NHlm5VMJVkYYpFT99sMNw66J+mPSQ1 hMyN/CS3i4bFQabZzMhXKMMKWuapyFdSt5ROvjJky6olJiRzX89oYpMzrkUIfCIYuoV/9D9XYV91b PX5b5EjXOyXrr9SqrFziBGwtpnZOb1r1yMGKwTihda/k4BHPQAPZGVAQ+zNXAqbVSDymcxRVrTvFY ATsADIGw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:51660) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s878T-0007B7-0z; Sat, 18 May 2024 00:37:13 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1s878S-0001x4-9e; Sat, 18 May 2024 00:37:12 +0100 Date: Sat, 18 May 2024 00:37:12 +0100 From: "Russell King (Oracle)" To: Guenter Roeck Cc: linux-arm-kernel@lists.infradead.org, Duanqiang Wen , mturquette@baylibre.com, sboyd@kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] clkdev: report over-sized strings when creating clkdev entries Message-ID: References: <7eda7621-0dde-4153-89e4-172e4c095d01@roeck-us.net> <4ea9cc83-c7ca-47b8-8d43-dab16193108f@roeck-us.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4ea9cc83-c7ca-47b8-8d43-dab16193108f@roeck-us.net> Sender: Russell King (Oracle) On Fri, May 17, 2024 at 04:34:06PM -0700, Guenter Roeck wrote: > On 5/17/24 15:22, Russell King (Oracle) wrote: > > On Fri, May 17, 2024 at 03:09:12PM -0700, Guenter Roeck wrote: > > > Hi, > > > > > > On Fri, Mar 15, 2024 at 11:47:55AM +0000, Russell King (Oracle) wrote: > > > > Report an error when an attempt to register a clkdev entry results in a > > > > truncated string so the problem can be easily spotted. > > > > > > > > Reported by: Duanqiang Wen > > > > Signed-off-by: Russell King (Oracle) > > > > Reviewed-by: Stephen Boyd > > > > > > With this patch in the mainline kernel, I get > > > > > > 10000000.clock-controller:corepll: device ID is greater than 24 > > > sifive-clk-prci 10000000.clock-controller: Failed to register clkdev for corepll: -12 > > > sifive-clk-prci 10000000.clock-controller: could not register clocks: -12 > > > sifive-clk-prci 10000000.clock-controller: probe with driver sifive-clk-prci failed with error -12 > > > ... > > > platform 10060000.gpio: deferred probe pending: platform: supplier 10000000.clock-controller not ready > > > platform 10010000.serial: deferred probe pending: platform: supplier 10000000.clock-controller not ready > > > platform 10011000.serial: deferred probe pending: platform: supplier 10000000.clock-controller not ready > > > platform 10040000.spi: deferred probe pending: platform: supplier 10000000.clock-controller not ready > > > platform 10050000.spi: deferred probe pending: platform: supplier 10000000.clock-controller not ready > > > platform 10090000.ethernet: deferred probe pending: platform: supplier 10000000.clock-controller not ready > > > > > > when trying to boot sifive_u in qemu. > > > > > > Apparently, "10000000.clock-controller" is too long. Any suggestion on > > > how to solve the problem ? I guess using dev_name(dev) as dev_id parameter > > > for clk_hw_register_clkdev() is not or no longer a good idea. > > > What else should be used instead ? > > > > It was *never* a good idea. clkdev uses a fixed buffer size of 20 > > characters including the NUL character, and "10000000.clock-controller" > > would have been silently truncated to "10000000.clock-cont", and thus > > > > if (!dev_id || strcmp(p->dev_id, dev_id)) > > > > would never have matched. > > > > We need to think about (a) whether your use of clk_hw_register_clkdev() > > is still appropriate, and (b) whether we need to increase the size of > > the strings. > > > > It isn't _my_ use, really. I only run a variety of boot tests with qemu. > I expect we'll see reports from others trying to boot the mainline kernel > on real sifive_u hardware or other hardware using the same driver or other > drivers using dev_name() as dev_id parameter. Coccinelle finds the > following callers: Using dev_name() is not an issue. It's when dev_name() exceeds 19 characters that it becomes an issue (and always has been an issue due to the truncation.) clk_get(dev, ...) uses dev_name(dev) to match against its entry in the table. As I say, dev_name() itself is not an issue. The length used for the name is. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!