Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1473740pxb; Fri, 1 Apr 2022 14:45:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJze/2z8hDhtxU1yxQwvlYcg8sw77ILSlm568eRO9ICn8trHmIXESqHBBpVlFod4WWzL4um3 X-Received: by 2002:a17:902:b941:b0:14d:af72:3f23 with SMTP id h1-20020a170902b94100b0014daf723f23mr12777071pls.6.1648849535223; Fri, 01 Apr 2022 14:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648849535; cv=none; d=google.com; s=arc-20160816; b=x/UC8asWwIctSrWD2OpAV8CwjqzgqnoRWhwGXcmEukEZxbZjQAVSyst6k0d1XOWlEb UFHl7xXeRmIPf8btWMdHvDXOcHUvt8PebgP/w5KAUs/C0FO0rd4yTbiKjbjb29zv7+Jx //T8ZSyAIaHxf6jOQUEpfmuGGEWfHvryzfmBj77pybsdD8/X8IwGOrZnWxPmp8FoRQaR Az4B0yTUiLKwqPBMo0mAXNh6HFA+ih1INjlDHVk/eeUeLQPcyR3XTwaiU72Jb1zYEkm1 LQxkVhhTkoGHy/+WlBc/UNNUlx7oXg/wg+Ep/litY2JmkxkVmTzbELgkQ76CKpxKDmDP GZdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=6aSqh8t2BYpvepsKwdaEj1ou1yqlDXevbgf6RBEOluU=; b=Sel8pD5BKu0q61nyR8B8Sg59OTfXfG7+IENJhetqJDGpW8HdLT/leCqnMtPXSRyjW3 X5xr45/F+nmdPQNetxs4Wbl9c9gqySolAcAg0QyHXxqzR0byb1+LMJLmS7e4604DPpiU xJ6roYrDSAUA0UHoLo1QPautabvfW71VgpvUhZU3155/rp6ikURyxcTz01n0WsX80xAb ZspqjIGK3jAInj/OZjOSqxKbPQAhCP4LA+BlDk/oM/Ea9PKnXIAsiCLfHjdovyurpIoA eL8T8pQ0UCGWi4RF350cQSb7kmJxpBlbgloRwgaD9dd7pUzFo8UZENF3MjC2fnBxI7VI wCJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@citymesh-com.20210112.gappssmtp.com header.s=20210112 header.b=x3RG4p4A; 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=fail (p=NONE sp=NONE dis=NONE) header.from=citymesh.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t14-20020a170902e84e00b00153b2d165b1si3320652plg.441.2022.04.01.14.45.20; Fri, 01 Apr 2022 14:45:35 -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=@citymesh-com.20210112.gappssmtp.com header.s=20210112 header.b=x3RG4p4A; 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=fail (p=NONE sp=NONE dis=NONE) header.from=citymesh.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346487AbiDANwx (ORCPT + 99 others); Fri, 1 Apr 2022 09:52:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241902AbiDANwu (ORCPT ); Fri, 1 Apr 2022 09:52:50 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 701941C60F9 for ; Fri, 1 Apr 2022 06:51:00 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id g22so3066308edz.2 for ; Fri, 01 Apr 2022 06:51:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citymesh-com.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=6aSqh8t2BYpvepsKwdaEj1ou1yqlDXevbgf6RBEOluU=; b=x3RG4p4AlxUrIj7eUzOZ6cZozpv8RTywvdn4EP59i7LoI96cwfCaT5l0+fbQnFblma +wNNDGBYFwGlcpEYNNoJryJBmUtVCemDP5ARcPJPiY60skPIooA06/jTvtoI3PjSknfS 0sOyVa/raQ1hOk2rQwXkHh99El3lQ9AvIMBFQnSFk7Y/7mS+zbjthNgt1xFQR0PnIWlC sG2pq75816M4FXl+p+75fr310eoi8BMpYO49AzzAmXoDawC16grvK7cbcfPXtllQPugI JoeIwxL+wlQjO7kDuDv87TaZWJgjUEJ6pcq3n4LM1xcCNO86p8pxkSuqOXyHZvY1SJ2J WZSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=6aSqh8t2BYpvepsKwdaEj1ou1yqlDXevbgf6RBEOluU=; b=rfdyKrNdWEjdrwHWI/JPlqpRbPhHJYzQlMUKeDRICiCZsaHHP6FdAODSPYnXjieBUG ulOq4nwbj2WV6Xd1UEcObMAYS1ULszoWl0aT1EHB01Hqd0mFUOwI3HnQj0xJzjZ+PTRW EC4jHHMk9NdUhbxhcL6a/WkWKVW6IPbVU1GASbhkGnbXQHr/X4iGD79HMDFf79BN8cJk sGic1yRMQTWhpJv05wh2t0HNSn/2Mfmzb0yDNmilfsAoPRkiNUnyp0Hg4Pw4FrMoGLes TkK2DwEYhxaG7wrbYY/NUup5ys/oatF4zltho1dQZAml3figMBWlKX584IU2b5tVbYaC ccAg== X-Gm-Message-State: AOAM5302oqis3R0+zJcCUJdLTpkIOzih8h7+h26nRj/ws5m0PMHRK6Ds rcppQ15atsN0It6KhGEfOnhT/A== X-Received: by 2002:a05:6402:26c7:b0:41b:7aef:bdf6 with SMTP id x7-20020a05640226c700b0041b7aefbdf6mr8221907edd.210.1648821058896; Fri, 01 Apr 2022 06:50:58 -0700 (PDT) Received: from [10.202.0.7] ([31.31.140.89]) by smtp.gmail.com with ESMTPSA id d23-20020aa7d5d7000000b00418f7b2f1dbsm1217075eds.71.2022.04.01.06.50.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Apr 2022 06:50:57 -0700 (PDT) Message-ID: <46ae7788-dade-3ff4-a353-985544f12c19@citymesh.com> Date: Fri, 1 Apr 2022 15:50:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: PCI: Race condition in pci_create_sysfs_dev_files (can't boot) Content-Language: en-US To: =?UTF-8?Q?Krzysztof_Ha=c5=82asa?= , Bjorn Helgaas Cc: =?UTF-8?Q?Pali_Roh=c3=a1r?= , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Pieralisi , Gregory Clement , Andrew Lunn , =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Dexuan Cui References: <20220208234023.GA505306@bhelgaas> From: Koen Vandeputte In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 On 15.02.22 07:35, Krzysztof HaƂasa wrote: > Hi Bjorn, > > Bjorn Helgaas writes: > >> Koen collected some interesting logs at >> https://lore.kernel.org/all/cd4812f0-1de3-0582-936c-ba30906595af@citymesh.com/ >> They're from v5.10, which was before all of Krzysztof W's nice work >> converting to static attributes, but Koen's log shows the error >> happening in the pci_sysfs_init() initcall, which is *after* >> imx6_pcie_probe(): >> >> imx6_pcie_probe # probably device initcall (level 6) >> ... >> pci_create_sysfs_dev_files >> >> pci_sysfs_init # late initcall (level 7) >> pci_create_sysfs_dev_files >> "sysfs: cannot create duplicate filename" > Well, imx6_pcie_probe() is called indirectly by > platform_driver_register(). I guess it doesn't know about the initcall > ordering, after it's registered. > > It looks like the problem is the imx6_pcie_probe() (via > dw_pcie_host_init() -> pci_host_probe()) is interfering with > pci_sysfs_init(). This may eventually cause some invalid memory access > as well. > > BTW I thought for a moment that maybe 5.14 is free from this. I was > wrong. The problem doesn't manifest itself on my custom i.MX6 device > (using Tinyrex CPU module from Voipac/Fedevel, perhaps because I don't > use any PCI devices there). It does on Ventana SBC from Gateworks, > though. BTW the above (and below) is v5.16. > > It goes like this: > [0.096212] do_initcall_level: 6 > [0.105625] imx6_pcie_init > [0.106106] imx6_pcie_probe <<<<<<<<<<<<<<<<<<<<< > [0.106412] imx6q-pcie 1ffc000.pcie: host bridge /soc/pcie@1ffc000 ranges: > > [0.322613] imx6q-pcie 1ffc000.pcie: Link up > [0.322776] imx6q-pcie 1ffc000.pcie: PCI host bridge to bus 0000:00 > [0.322790] pci_bus 0000:00: root bus resource [bus 00-ff] > > [0.405251] do_initcall_level: 6 ENDs but imx6_pcie_probe() still active > [0.405262] do_initcall_level: 7 > > [0.410393] pci_sysfs_init <<<<<<<<<<<<<<<<<<<<< > [0.410423] pci 0000:00:00.0: pci_create_sysfs_dev_files > > [0.410532] [<8068091c>] (pci_create_sysfs_dev_files) > [0.410551] [<80918710>] (pci_sysfs_init) > [0.410568] [<8010166c>] (do_one_initcall) > > [0.410717] pci_sysfs_init END <<<<<<<<<<<<<<<<<<<<< > > [0.533843] [<803f1c74>] (pci_bus_add_devices) > [0.533862] [<803f574c>] (pci_host_probe) > [0.533879] [<80414310>] (dw_pcie_host_init) > [0.533895] [<80681ac8>] (imx6_pcie_probe) > [0.533915] [<8045e9e4>] (platform_probe) > (Repeats multiple times, I guess for each PCI device) > > [0.543893] imx6_pcie_probe END <<<<<<<<<<<<<<<<<<<<< > > [0.692244] do_initcall_level: 7 END Hi all, Any update on this topic? I just tested kernel 5.15 on imx6 (gateworks Ventana 5200) and as soon as I connect a pcie device on one of the ports, following happens: https://pastebin.com/raw/mgfSvTRB Any idea if this is related? Thanks, Koen