From patchwork Fri Oct 28 21:53:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 12576 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1061529wru; Fri, 28 Oct 2022 14:57:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cXy9OToINxCf72JYb5XazZNcdlziuxr2TE2UFsGsrx1QRZa1yhJEHjEeLJ94NpFzK30Sb X-Received: by 2002:a17:902:e892:b0:187:35b:5a50 with SMTP id w18-20020a170902e89200b00187035b5a50mr1166567plg.160.1666994239973; Fri, 28 Oct 2022 14:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666994239; cv=none; d=google.com; s=arc-20160816; b=ROvri0mgknEeBmll1BCztqqbjHanMd0CUTbx+1exAvr6NMehryhBUXROXmS5HkjmNq rUVue3bj85HmjRZILbCwH4J78lAym2egb0oEKye4j2qkIuiPrZD4z+TVZ231CvrTjH7B iXhGdI2T3wQ6RQLHU0x72JhJ3DvUEEo3t2zgYPfJLVyed+T1Jpuf8BAvKWKdvNj2pVUJ /91FmvbQtyqkWqsX4mli5iL8Bmj0JkzqD0/wN9aHfG6X7pZGXvIuigm3B4PPsnsPJOxO 2UeIRiv5O4ZLwVO88cFkn8nWZV57a/Y3FHqP5gnuLI5cJyJEhRqlE1i2wwRpJ2A5vyzW jElg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=uwCxQi/lzbG99sopXdaVgVE2DsVCsrVGzk6dQZZnkc8=; b=RarWjapglI5RnKlGQtbX2gs/JB/dAmSp9dXv7SsHQISCR74OJvsIaZiIWw7Yii0/jz pzDOHrEVNTyM+dzK2j4QpxXqXSwvl0NKCB3HPUal2STw6T7YQgIRh9y0ny6g5igtc+5i YfzMu551ySdBXSBMlK+6pUMBrkaJufXA08PgPINs2qo6SOXAtWBiNrN+R/DE1J232UFU wJYB7wUqxkm72YXXVOtn61LAvehw8h51uY8Wdp5vusrJHLMn2GSBNtTBJ5os2DYB0f9E HahuLQP9ulQ6I7/d6SmfhwawufT28KJFuLNssb+k9zNEDbuRNYlIBtkl9ACOV1kR6tzS yVFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=I2wDE32i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a17090b070400b0020addb2c6e7si10088174pjz.85.2022.10.28.14.57.07; Fri, 28 Oct 2022 14:57:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=I2wDE32i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230116AbiJ1Vxa (ORCPT + 99 others); Fri, 28 Oct 2022 17:53:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbiJ1Vx1 (ORCPT ); Fri, 28 Oct 2022 17:53:27 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A182224BAA0 for ; Fri, 28 Oct 2022 14:53:26 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id u6so5938442plq.12 for ; Fri, 28 Oct 2022 14:53:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=uwCxQi/lzbG99sopXdaVgVE2DsVCsrVGzk6dQZZnkc8=; b=I2wDE32iuPDJS6Ln4R3C7D+1bXa0yvl0RCT+wy/Vt0bL7g0cgQTolmDJ1THfnJ8khZ jDEdnMGi8XvZMvYAHMAkQxMDjybr0ID5erEsw7n6tALBv/ktbg7bhZ4rLNKN82hdrShW J9ifmwTQrN86Sp5PxD+oOtzKrNwbXuElrxYMo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uwCxQi/lzbG99sopXdaVgVE2DsVCsrVGzk6dQZZnkc8=; b=MN8u9WiFoZCdgPgG1r+LlyO7/FxY4ufuW5Zk/BopGOl77n1bhf7e04sgs6GwbOUEzt 47VL8Atn2hXXGmQO4/Jbw4INDlfHsmGvnPaQCDApAg5Mb1QABNm4yjsQPTb5xKIxdqKS UHT6ADMBalghwJ168nZkg8dxljKeVUpLFCLXjhTBySKaFkHHr+DL0cu34cxCQTl+I+tZ YNYWjzMT1+lxWf54DZ4i8+TpTxAEPzMVlUJGmRdllBT4xs5S6j+9wCCOeDF7gOHWlsKW VHUsAcjNAxhC2AoLfcYPD2NlOj09Ln5HdZ5ZLJ3hDAEp90/YOoSzcc8BbSMSq3Ss3OXH cJmg== X-Gm-Message-State: ACrzQf0jCmH6kcLxqFCsuTgx4PQfr70LjCPRsGyloe7o/7BKk3pyTHFx 7iVWpuUwwbdIoxl1Dph/7mDqsg== X-Received: by 2002:a17:90b:3e81:b0:20d:bbe5:f332 with SMTP id rj1-20020a17090b3e8100b0020dbbe5f332mr19029604pjb.112.1666994006140; Fri, 28 Oct 2022 14:53:26 -0700 (PDT) Received: from localhost ([2620:15c:9d:2:65f9:c180:249c:190f]) by smtp.gmail.com with UTF8SMTPSA id a4-20020a621a04000000b00545f5046372sm3251964pfa.208.2022.10.28.14.53.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 14:53:25 -0700 (PDT) From: Brian Norris To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin Cc: Feng Tang , Jani Nikula , Chris Wilson , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , linux-kernel@vger.kernel.org, Daniel Vetter , Brian Norris , Daniel Vetter , David Airlie Subject: [PATCH] drm/i915: Set PROBE_PREFER_ASYNCHRONOUS Date: Fri, 28 Oct 2022 14:53:22 -0700 Message-Id: <20221028145319.1.I87b119c576d486ad139faf1b7278d97e158aabe4@changeid> X-Mailer: git-send-email 2.38.1.273.g43a17bfeac-goog MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747970151842145045?= X-GMAIL-MSGID: =?utf-8?q?1747970151842145045?= This driver often takes a good 100ms to start, but in some particularly bad cases takes more than 1 second. In surveying risk for this driver, I poked around for cross-device shared state, which can be a source of race conditions. GVT support (intel_gvt_devices) seems potentially suspect, but it has an appropriate mutex, and doesn't seem to care about ordering -- if devices are present when the kvmgt module loads, they'll get picked up; and if they probe later than kvmgt, they'll attach then. Additionally, I see past discussions about this patch [1], which concluded that there were problems at the time due to the way hdac_i915.c called request_module("i915") and expected it to complete probing [2]. Work has since been merged [3] to fix that problem. This driver was pinpointed as part of a survey of drivers that take more than 100ms in their initcall (i.e., are built in, and probing synchronously) on a lab of ChromeOS systems. [1] [RFC] i915: make the probe asynchronous https://lore.kernel.org/all/20180604053219.2040-1-feng.tang@intel.com/ [2] https://lore.kernel.org/all/s5hin4d1e3f.wl-tiwai@suse.de/ [3] Commit f9b54e1961c7 ("ALSA: hda/i915: Allow delayed i915 audio component binding") Signed-off-by: Brian Norris --- drivers/gpu/drm/i915/i915_pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c index 38460a0bd7cb..1cb1f87aea86 100644 --- a/drivers/gpu/drm/i915/i915_pci.c +++ b/drivers/gpu/drm/i915/i915_pci.c @@ -1371,7 +1371,10 @@ static struct pci_driver i915_pci_driver = { .probe = i915_pci_probe, .remove = i915_pci_remove, .shutdown = i915_pci_shutdown, - .driver.pm = &i915_pm_ops, + .driver = { + .pm = &i915_pm_ops, + .probe_type = PROBE_PREFER_ASYNCHRONOUS, + }, }; int i915_pci_register_driver(void)