Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2811519rwb; Fri, 11 Nov 2022 15:30:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf6KcBcYnWIAk7j5rZRyK/PXfr+AHw5itUBZdfVxFLe+swvc9/2wvAVJhAeuT21zN2jyKT3I X-Received: by 2002:a17:906:b891:b0:7a5:f8a5:6f81 with SMTP id hb17-20020a170906b89100b007a5f8a56f81mr3387784ejb.570.1668209426216; Fri, 11 Nov 2022 15:30:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668209426; cv=none; d=google.com; s=arc-20160816; b=hLPQ33Ee0JiBUQFT2IVn+9G6c9G1pwWSzrKjeneFRJlKScx+TnO/dKl2v6BsRUqKiy /TXsKJxauS3sM69umMpZMgQZ8E0lWlsTeIkukivh4Yeu6XxETq7s7QX/6FDd1359fZb/ i+erfkmBvY6mMOh3CUQqCq11NWWXbs3V6L+G+nyH8PK7KsJ7LbryFUCbvWza2d3OxvLp Ar9OxdveK/KPibR3dMVOsHkB4rZ+vAwj4oqyjYrjkY3lNnEYw5vnHz1C/rkp8Xodmd+m 3MU8Ksi7rLoURJXngayV4wyLpcM5mFuAkIcnWsUXfMOD6fA7knnitgnLBzttiyGzc1vF dC1Q== 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=vmjht/hVO1qKtZApkaycgUVmJWkPJQVFE4gCtMvHeIQ=; b=GKZEV/r11wYLAiWblCVM8vwTHqPIQvHvYaf5pIytSt37wEvaPPps/SI8xvAdY2DY5U +P69sUQOBLSepm4HjQNO2uzOrTQgh3TuXLwt0jxhzAdsjYNch2Id38eTssAsk/jDNYpw kDTbSD/nCYxURnb3duRcQyiHoVTFhwcu0rF585Uq+7R/A2DZ/idcbHqZG0DNNAJShES1 3piVMGV3//ROi+6v9NCsg1l4SO3RQJK1FJbWL71nwxL5NBexsyyvSyGSWuWC3BveWWr+ K9RFr/2UtSiqXxano7/l+IMpGSY2e9K/b5Trzjin7gIgkEkV3Bq6S4ISsE1ufK69XHJY g61A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mi7vvLSb; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc12-20020a170907168c00b007a11c253eaasi3397678ejc.809.2022.11.11.15.30.04; Fri, 11 Nov 2022 15:30:26 -0800 (PST) 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=mi7vvLSb; 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 S233651AbiKKXNL (ORCPT + 90 others); Fri, 11 Nov 2022 18:13:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbiKKXNJ (ORCPT ); Fri, 11 Nov 2022 18:13:09 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD3E363CC7 for ; Fri, 11 Nov 2022 15:13:08 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id b62so5530416pgc.0 for ; Fri, 11 Nov 2022 15:13:08 -0800 (PST) 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=vmjht/hVO1qKtZApkaycgUVmJWkPJQVFE4gCtMvHeIQ=; b=mi7vvLSbUqjf6eYDklwz4PxdGeRjRl5icdTCigGyh7vAmd7DxvW1+VQn3OC6on3njF ZXQbtjY2evJ4xsO1M58pR3sWEibkDblu8PJvoLQs1pf61kbKF25CvcjCHM6SQ2dgNIAC IqrM9FseUitb/bwaO2ZoBazNavf0OEswXHM/U= 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=vmjht/hVO1qKtZApkaycgUVmJWkPJQVFE4gCtMvHeIQ=; b=daQKtCBW3c6TVTv1VIFAbH2eIa6/0eRz2sU0b5S4W7Gnj0vQiNwdILmIzJLfpZucVc 2uPMuNWOGUa0PwDLUYGxCeTp+IEuFYaOdTU2WJ0lS/YxSIT+yD73fzMwYgYMLVUEAyxA H7Ehs2rNmyjs1aLWP4VzSgQzojV/Wkv4cha/ZC6TqpGYvapOX1It6/L/Y85D0s6DvNgs uOqguT/+lJSKo+sYXdMc7aagHo2k+Or1eO+xUtncrxlwqjS6GGeEBlXeRIWh0yAgutB6 Kyi4h2mlT+aRgL+hUZ+6EcRmnP82ifzgRqQgEaW41pbtTIc66e6ug7UNGN8yX3qqCUtl CwUg== X-Gm-Message-State: ANoB5pm65tn6YH+kKVZ4Tox2KWn+7iy3HeWtx9u2KOzDHap7RJmUdMfJ lzuHFDTPVxv3r+w4inGENcLjvQ== X-Received: by 2002:aa7:8813:0:b0:56b:f64b:b385 with SMTP id c19-20020aa78813000000b0056bf64bb385mr4651731pfo.68.1668208388204; Fri, 11 Nov 2022 15:13:08 -0800 (PST) Received: from localhost ([2620:15c:9d:2:dc0d:97e5:4cb6:b4d3]) by smtp.gmail.com with UTF8SMTPSA id i188-20020a6254c5000000b0056e0ff577edsm2087362pfb.43.2022.11.11.15.13.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Nov 2022 15:13:07 -0800 (PST) From: Brian Norris To: Benson Leung , Guenter Roeck , Tzung-Bi Shih Cc: Dmitry Torokhov , Stephen Boyd , Brian Norris , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] platform/chrome: cros_ec_lpc: Force synchronous probe Date: Fri, 11 Nov 2022 15:13:01 -0800 Message-Id: <20221111231302.3458191-1-briannorris@chromium.org> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 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 This reverts commit bd88b965ae8c ("platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS"), and then some. It has been reported that there are issues with 'cros-ec-keyb' devices that are children of this. As noted in the initial patch for its ACPI support (commit ba0f32141bc5 ("Input: cros_ec_keyb - handle x86 detachable/convertible Chromebooks")), it's possible to probe an ACPI child device before its parent is probed -- hence the need for EPROBE_DEFER. Unfortunately, poking your parent's dev_get_drvdata() isn't safe with asynchronous probe, as there's no locking, and the ordering is all wrong anyway (drvdata is set before the device is *really* ready). Because this parent/child relationship has known issues, let's go the other direction and force synchronous probe, until we resolve the issues. Possible solutions involve adding device links, so we ensure the child doesn't probe before the parent is done; or perhaps some other larger refactoring (auxiliary bus?). But that might take a little more effort and review, as there are many other potential sub-devices of cros_ec_lpc that could need patching. Note that we don't have the same problem for non-ACPI cros-ec hosts, like cros-ec-spi (commit 015e4b05c377 ("platform/chrome: cros_ec_spi: Set PROBE_PREFER_ASYNCHRONOUS")), because its sub-devices aren't created until cros_ec_register(), or they don't exist at all (e.g., FPMCU uses). Fixes: bd88b965ae8c ("platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS") Signed-off-by: Brian Norris --- drivers/platform/chrome/cros_ec_lpc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c index 2e4dba724ada..7fc8f82280ac 100644 --- a/drivers/platform/chrome/cros_ec_lpc.c +++ b/drivers/platform/chrome/cros_ec_lpc.c @@ -557,7 +557,12 @@ static struct platform_driver cros_ec_lpc_driver = { .name = DRV_NAME, .acpi_match_table = cros_ec_lpc_acpi_device_ids, .pm = &cros_ec_lpc_pm_ops, - .probe_type = PROBE_PREFER_ASYNCHRONOUS, + /* + * ACPI child devices may probe before us, and they racily + * check our drvdata pointer. Force synchronous probe until + * those races are resolved. + */ + .probe_type = PROBE_FORCE_SYNCHRONOUS, }, .probe = cros_ec_lpc_probe, .remove = cros_ec_lpc_remove, -- 2.38.1.431.g37b22c650d-goog