Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp673666pxb; Wed, 18 Aug 2021 11:15:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7qwVeMKs4I6+UzCSKFvfaFRYTzK/cuZQjMDklB39G68Hf1DqM1cXdMfIrIwb9JAXtilPL X-Received: by 2002:a05:6402:1011:: with SMTP id c17mr11331603edu.144.1629310511654; Wed, 18 Aug 2021 11:15:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629310511; cv=none; d=google.com; s=arc-20160816; b=RgkUAwzsi9sr6p2an5OATLJYbeSU42wTvHvzFQM5oizEh5BO3+W8zH4O3v5vRNRAyL 95GMG4E0Bz76SOv1YVFwI8zy/DBiaG1WIxziR9SRMbhP2xgGNdkaDh9u+kU4cTvIyj3w 4eGznBrcSv4XufKh5G8n0jYG9Pid8qo48wRaUwvX8u/z95V2vcWoAcdnBvv23EsnUw/+ d/pzvzhFhroIdr9ZABwy/fbZ3g+AW0yZsyUqCmX807ItiU3M0XIV+pm9z8s6cXn6mKqK 3u+exieQ86A0Uir16WovAHem5ORa/nB5t+x07uzhglgki9BnxDukDMoC7tMH5nmq+9tU 42EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:subject:from; bh=tuGPtbbpOHD+c0xt6c7RIViSCDI+hpMp9ou3Jp2RO9M=; b=RFSE18HSpgX3Jz/uWeoTFDkACp8f9Z4oMMBSifh4Nrf6wknv/79Ayins6UWTQHAb05 B8ATuEpzQrC5v486iYjKXPXkXePjIXOa117PEVIOOTEa+jJR30huTSWkNKf46EojL0a5 SsrG6By7/p+vqZ2JYcAzLV7ytsf5RLpDuoQzBga8cAJh6KYpnuTA5W4qFi6WdhvZuUCQ skaNJx1ZFTrXkftJTQJmsJMmcnSrsoiOXfDDHbagKnQt5+JFRERDLT/hShbtD91uIPce CyVv1EIIDd3fRELq5o+NTFfLfV6md9evDeylLqnapq5ydbAfFLAFO7B7Z9GiMWCwU+xC Qtgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id og26si653622ejc.418.2021.08.18.11.14.41; Wed, 18 Aug 2021 11:15:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229667AbhHRSK3 (ORCPT + 99 others); Wed, 18 Aug 2021 14:10:29 -0400 Received: from mga18.intel.com ([134.134.136.126]:59554 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229533AbhHRSK2 (ORCPT ); Wed, 18 Aug 2021 14:10:28 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10080"; a="203539660" X-IronPort-AV: E=Sophos;i="5.84,332,1620716400"; d="scan'208";a="203539660" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2021 11:09:50 -0700 X-IronPort-AV: E=Sophos;i="5.84,332,1620716400"; d="scan'208";a="449858802" Received: from smendon-mobl.amr.corp.intel.com (HELO [10.212.121.30]) ([10.212.121.30]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2021 11:09:46 -0700 From: Pierre-Louis Bossart Subject: Re: [RFC PATCH 1/2] driver core: export driver_deferred_probe_trigger() To: Greg Kroah-Hartman Cc: alsa-devel@alsa-project.org, "Rafael J . Wysocki" , tiwai@suse.de, linux-kernel@vger.kernel.org, liam.r.girdwood@linux.intel.com, vkoul@kernel.org, Mark Brown , Geert Uytterhoeven , Jason Gunthorpe , Dan Williams , Andy Shevchenko , Christoph Hellwig References: <20210817190057.255264-1-pierre-louis.bossart@linux.intel.com> <20210817190057.255264-2-pierre-louis.bossart@linux.intel.com> <20210818115736.GA4177@sirena.org.uk> <20210818134814.GF4177@sirena.org.uk> <14235b8d-d375-6e2d-cae9-33adf9c48120@linux.intel.com> Message-ID: <244b3030-0d24-300f-354d-46878b708056@linux.intel.com> Date: Wed, 18 Aug 2021 13:09:44 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>>> a) we have to use request_module() >>> >>> Wait, why? >>> >>> module loading is async, use auto-loading when the hardware/device is >>> found and reported to userspace. Forcing a module to load by the kernel >>> is not always wise as the module is not always present in the filesystem >>> at that point in time at boot (think modules on the filesystem, not in >>> the initramfs). >>> >>> Try fixing this issue and maybe it will resolve itself as you should be >>> working async. >> >> It's been that way for a very long time (2015?) for HDAudio support, see >> sound/pci/hda/hda_bind.c. It's my understanding that it was a conscious >> design decision to use vendor-specific modules, if available, and >> fallback to generic modules if the first pass failed. > > If it has been this way for so long, what has caused the sudden change > to need to export this and call this function? Fair question, I did not provide all the context with a cover letter that was already quite long. Here are more details: In the existing Intel audio drivers, we have a PCI device that first get probed. The PCI driver initializes the DSP and exposes what the audio DSP can do, but the platform-specific configuration for a given board is handled by a child device [1]. We have all kinds of hard-coded lookup tables to figure out what the board is and what machine driver should be used based on the presence of other ACPI devices and/or DMI quirks [2][3]. We must have used this solution since 2010, mainly because 'the other OS' does not rely on platform firmware for a description of the audio capabilities. In the 'soon' future, that machine driver will probed with its own ACPI ID and become generic, with all the information related to the board described in platform firmware and parsed by the driver. This is how the 'simple card' works today in Device Tree environments, platform firmware describes how host-provided components are connected to 3rd-party components. I cannot provide more details at this time since this is a not yet a publicly-available specification (this specification work does take place in a standardization body). That change in how the machine driver gets probed creates a new problem we didn't have before: this generic machine driver will probe in the early stages of the boot, long before the DSP and audio codecs are initialized/available. I initially looked at the component framework to try to express dependencies. It's really not clear to me if this is the 'right' direction, for ASoC-based solutions we already have components that register with a core. I also started looking at other proposals that were made over the years, this problem of expressing dependencies is not new. No real luck. In the end, since the DeviceTree-based solutions based on deferred probes work fine for the same type of usages, I tried to reuse the same deferred probe mechanism. The only reason why I needed to export this function is to work-around the request_module() use. I am not claiming any award for architecture, this is clearly a domain-specific corner case. I did try the async probe, I consulted with Marc Brown, had an internal review with Dan Williams and Andy Shevchenko. While nobody cheered, it seemed like this export was 'reasonable' compared to a re-architecture of the HDaudio/HDMI support - which is a really scary proposition. There is no immediate rush to make this change in this kernel cycle or the next, I am open to alternatives, but I wanted to make sure we don't have any Linux plumbing issues by the time the specification becomes public and is used by 'the other OS'. Does this help get more context? [1] https://elixir.bootlin.com/linux/latest/source/sound/soc/sof/core.c#L234 [2] https://elixir.bootlin.com/linux/latest/source/sound/soc/intel/common/soc-acpi-intel-tgl-match.c#L323 [3] https://elixir.bootlin.com/linux/latest/source/sound/soc/intel/boards/sof_sdw.c#L50