Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp303181rdb; Thu, 19 Oct 2023 05:13:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFmYAAgp7u1MrRoGkIiY0pYpb3rtv1FuiT6kekoi5etHukO3pJ6cNIDrHoUXgtlcgohvSBj X-Received: by 2002:a05:6a20:160d:b0:15e:e0fd:98e7 with SMTP id l13-20020a056a20160d00b0015ee0fd98e7mr2355635pzj.20.1697717634587; Thu, 19 Oct 2023 05:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697717634; cv=none; d=google.com; s=arc-20160816; b=iUCicXTG96eHwcYsmezfYClP8Hi893XYIM8LR05jek7H1Z76IBgbh9QKqP6wZ8MOVE l5XTYcJL2E4wUhUQm7iT9xUEeTKgpY22ToOokYjhy6vHLFvHZ8/WRf2llYJ28n0d8mcJ 2/dnQNWIJsw2gijfWvxtgfn4RMjUmlsR4z8SZcKtaBKsTIzfJ/3DgqXkCfFbqqyXxQ/h doB6/iKRv2xWsyILu3K86mW06UvoxIRH2UzgvK5vaNeJGxoP2t+RJZq3oXa9IG4t3DcD 5WkfUccXiZVwZCSNytglUMkB8faoE/jzLyaz7xN47mjnuErJd9Nfcmisg2/KnBHQMM6A w7cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=U9IItnSqUvSyHQEFmkIX0w8RBQE6gJ459QqnXf8weJA=; fh=Ezw3TA502E69C3FHQf3KRVn7RRSWG1inhviPmZu0nQ8=; b=yB55MlC/AcX5zI8b+a4ZrgcTxUJXI5cGYopKzOfdE6os7h7KLgBy5mErXPF/cI1pHz N5R2T5UFyV9Cm7ZW4lg/r3xQkAiYpaTgRf8PyLdZy7kc3duo5Z3zbDxLSSUSkOUvj7yq nEzp4vXu/uhviFe8vZMJE7WHSGyaJx6kFoYt9bG3jZP8P5IZPqItHH7f+/Iq6BWPOz1Z xAnhe5fgs9hL0O0335Y1GdV5k29ivbFMW0t/CNzl+Pf/f4ma5gQ89qpqA0nmigIxsv6x MBWN7pFgkahERPK/Q66kGstY9D4+IOFPu/pGSDEpp+azMYIokSkJ/nPTT53C+ny35S/u GOyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="miNFtG/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id t28-20020a63955c000000b00582dcfe3b41si4339239pgn.374.2023.10.19.05.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 05:13:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="miNFtG/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id B93CA80505D6; Thu, 19 Oct 2023 05:13:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345521AbjJSMNp (ORCPT + 99 others); Thu, 19 Oct 2023 08:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345479AbjJSMNo (ORCPT ); Thu, 19 Oct 2023 08:13:44 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CA02AB; Thu, 19 Oct 2023 05:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697717622; x=1729253622; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=i4WwgJ3o94Vpc1j4dMgWvIKNhHkKPOtwMgr1IzruUfo=; b=miNFtG/8cYi/neVyXhNPGvm5yuHDfIIgmgDT3KmTC5G0ufruanoOop1u 78EuY2RtZk27BzuTseb8dG/NI6Qixj6Vz83F0nbjRFZziM6JAl6FoqChR iAKjt2BIu+D/fmxIV0oWCqznwYdWJRKy4OmZ9xKVqLM1L/au6Ow6pSL7u W2Cd1uQfdmxDJhxA6mnLalZudXTIjjvQWzZa55grQHYkGlnmbNBWgNs64 8lODLhXNYEmF4Py2INWJSJ6LrFEmgQMBgX+q/RT6aRWLvIBvYWG9rHRRb YNYAoyb2jx3HnTmtWAaViiG7kGeR5/Q3+HY35LqNBg9VblmVb6zFaAkeP w==; X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="7788028" X-IronPort-AV: E=Sophos;i="6.03,237,1694761200"; d="scan'208";a="7788028" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2023 05:13:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="1004213877" X-IronPort-AV: E=Sophos;i="6.03,237,1694761200"; d="scan'208";a="1004213877" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga006.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2023 05:13:40 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC2) (envelope-from ) id 1qtRuD-00000006rBf-346f; Thu, 19 Oct 2023 15:13:37 +0300 Date: Thu, 19 Oct 2023 15:13:37 +0300 From: Andy Shevchenko To: Dmitry Torokhov Cc: Linus Walleij , Ulf Hansson , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Ferry Toth Subject: Re: [PATCH v1 1/1] Revert "pinctrl: avoid unsafe code pattern in find_pinctrl()" Message-ID: References: <20231017141806.535191-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Thu, 19 Oct 2023 05:13:52 -0700 (PDT) On Wed, Oct 18, 2023 at 03:41:24PM -0700, Dmitry Torokhov wrote: > On Wed, Oct 18, 2023 at 08:01:23AM +0300, Andy Shevchenko wrote: > > On Tue, Oct 17, 2023 at 02:43:01PM -0700, Dmitry Torokhov wrote: > > > On Tue, Oct 17, 2023 at 10:45:39PM +0300, Andy Shevchenko wrote: > > > > Thanks for your response. ... > > > I wonder, could you please post entire dmesg for your system? > > > > Working, non-working or both? > > Non working, especially if you also enable debug logs in > drivers/mmc/host/sdhci-pci-core.c. > > What I do not quite understand is that I think we should not be hitting > the case where pinctrl is already created for the device, which is the > code path my patch was changing. IIUIC we should be mostly executing the > "pinctrl not found" path and that did not really change. Maybe you could > also put some more annotations to show how/at what exact point the probe > order changed? Maybe log find_pinctrl() calls and compare? > > Linus, BTW, I think there are more problems there with pinctrl lookup, > because, if we assume there are concurrent accesses to pinctrl_get(), > the fact that we did not find an instance while scanning the list does > not mean we will not find it when we go to insert a newly created one. > > Another problem, as far as I can see, that there is not really a defined > owner of pinctrl structure, it is created on demand, and destroyed when > last user is gone. So if we execute last pintctrl_put() and there is > another pinctrl_get() running simultaneously, we may get and bump up the > refcount, and then release (pinctrl_free) will acquire the mutex, and > zap the structure. Oh, that's a lot of fixing ahead! But if you send anything to test, I would happy do it. > Given that there are more issues in that code, maybe we should revert > the patch for now so Andy has a chance to convert to UUID/LABEL booting? I believe it's not feasible, see below why. ... > > > I think the right answer is "fix the userspace" really in this case. We > > > could also try extend of_alias_get_id() to see if we could pass some > > > preferred numbering on x86. But this will again be fragile if the > > > knowledge resides in the driver and is not tied to a particular board > > > (as it is in DT case): there could be multiple controllers, things will > > > be shifting board to board... > > > > Any suggestion how should it be properly done in the minimum shell environment? > > (Busybox uses mdev with static tables IIRC and there is no fancy udev or so) > > I'm not sure, so you have something like blkid running? You just need to > locate the device and chroot there. This assumes you do have initramfs. I don't think this is working solution. My case is: I have build an environment with a script that has hardcoded mmcblk0 to mount from. When I run this script I do not know _which_ exact board I run on, it should work on any of them (same boards, but different UUIDs). While writing this I realised that the common denominator I have here is the physical device (as it's a PCI one), and it's on-SoC, so can't change its BDF. So, there seem to be a solution. Let me try to implement that. -- With Best Regards, Andy Shevchenko