Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1157027pxb; Wed, 6 Apr 2022 10:04:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaZs8G7XyqcCyq6JjzMknT0b32Nv7ikhrYLzeBjW4+DoRFIB6RBdVE8y9wWDD7jN6zzQ8a X-Received: by 2002:a17:902:f70b:b0:14d:643d:9c99 with SMTP id h11-20020a170902f70b00b0014d643d9c99mr9721949plo.18.1649264640292; Wed, 06 Apr 2022 10:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649264640; cv=none; d=google.com; s=arc-20160816; b=HdD15SbckYZtz20sO8+yNwgegJFEq0Owj4QRJgNsnHraNFrzoK7nRZNvfNPuUDLfK9 QlIjJAygcQoU0CH02a3n1Rl5scVOdhjAvRzjsSsF8vHPRacXtQUQ8FfY8DiEBWHxhuc4 xDAuS2k5YfCuMBhT9Cb1brOedC9xdk+6tYn5qYAjUunAUln9bziOyMP2T90lAkR09shg A/W0TEjrh9jAXkkRNkxppuV60h6XlbvfzrBbcFpvgCRcWrQltl8EFFVPT13ZwUhQsRL/ f5ClLecQheqneeH3t3BEWpCeoFYVIahXsCSv05wqB2sIO6NEsnH1waqLKHx3YQVzMI78 Cnow== 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:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=0vB0HGTZga7f1q5BSSNIpY7EWpeHhv69aCzFJKru474=; b=ic/dZQruwwRqnbWckY/AFiIdCiH0lkXwmwm9wrdRbjeLeBPA1Duqf/EX8BRxL21e26 2iC/ycBMOBaxqXX47uoFGQHG55WfEFrirTtmJj2K3WQRYs4ZeuKOFv9uts/mn4XC/4yq 0niKsKHL3G4V6BI7swna9e5RpjteC4GIUffwXb1zMzXVBHEtmhCJ6fm9RJzG93MA1Fjf 4ouRp7XWM1D33RgWZCbyxgEHStOv4/vXBg4eL6kcawOvLlFcJVf2MWvzh2yEIs+nTXkB wlfQ+ZJI4OfxXnKvkkYxp55qTUq6oiM3khGpcyVOLxIjjGPj4YEHZWA5OVCTDndkyQCX lYTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@citymesh-com.20210112.gappssmtp.com header.s=20210112 header.b=YR4saWBL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id ls15-20020a17090b350f00b001c6fd746c71si6006499pjb.119.2022.04.06.10.03.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 10:04:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@citymesh-com.20210112.gappssmtp.com header.s=20210112 header.b=YR4saWBL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=citymesh.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0BCCD32EE6; Wed, 6 Apr 2022 09:44:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237823AbiDFQqu (ORCPT + 99 others); Wed, 6 Apr 2022 12:46:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238207AbiDFQqh (ORCPT ); Wed, 6 Apr 2022 12:46:37 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DC0241F62F for ; Wed, 6 Apr 2022 07:08:33 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id ot30so4451672ejb.12 for ; Wed, 06 Apr 2022 07:08:33 -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 :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=0vB0HGTZga7f1q5BSSNIpY7EWpeHhv69aCzFJKru474=; b=YR4saWBL03E5JaVc5I7gV8BN7YddSjnralclSOIA6N4CT86w8Y+PrzP2yiWNIYoyZM oOmgZhEt7oeM0Al7wehEE9ouNObjhMHFCyMBxsibfCG1e3Tov9AU2WFrgVEMLUMw/hoP n9RCd8vAADzKkDqum4k8a/tPXDIyJp7voCAViQpsRROlOWrlnPgVca5aanhGOI1btz2h 7qskbxHhy6FSG5HhYgePw18LUjQR/m4Ut6ak5P8Osjb5mq0Y88CmThNYnL4QHTJXnKeu 0uFO8OQDuflKtWMKqFfCe1Xxgo3jXicCZZuRnIZ1XN6Uw9hLHBGE5lBIfvRHqdXjg6Ij I8gg== 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:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=0vB0HGTZga7f1q5BSSNIpY7EWpeHhv69aCzFJKru474=; b=MPmg0qShfPM/Z/kjhiCwhm+PU2nnkiBYfBtcpwDJCDmdivp/bd/h2CJH68PGZH2Gxa NJB7GT4HmiIK1K0qpZ0YyeQv51QrwVgsMo83Ta6im+HDPhRF1oPaj3QvPKq6Cu+lakyh dAlZHJ66ZGNy3+tZTOxYCf27u2CdNKNb9aFF0BnoDwtE75gcHxUyaO2jTvzrJy9FFz9y LLpy8AVH2+8wJHgINoL1PPR443sVjl8Z2gghRiV+1V+8WdgvLeZ7zwlChZ44i8L6MOH1 x0LEUjJZQI2KPA+fkGNEQH0eRe06zUyFHBhzKQwx2bRfA8meS+c0nIPSHDlxqgIsn1Rs /IDg== X-Gm-Message-State: AOAM531CorlRYz+Kkzmi6Q0z5fUyfhPCiCLpUF7IsKPzoII987IQUOIh ZHo17FHtM3GNabyDvm1LmLCfng== X-Received: by 2002:a17:907:7815:b0:6ce:5242:1280 with SMTP id la21-20020a170907781500b006ce52421280mr8545575ejc.217.1649254111344; Wed, 06 Apr 2022 07:08:31 -0700 (PDT) Received: from [10.202.0.7] ([31.31.140.89]) by smtp.gmail.com with ESMTPSA id e26-20020a50ec9a000000b004193fe50151sm8228591edr.9.2022.04.06.07.08.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Apr 2022 07:08:30 -0700 (PDT) Message-ID: <7873617a-b2ab-1f26-55ac-d98229aa4485@citymesh.com> Date: Wed, 6 Apr 2022 16:08:29 +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 From: Koen Vandeputte 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 , =?UTF-8?Q?Petr_=c5=a0tetiar?= , Piotr Dymacz References: <20220208234023.GA505306@bhelgaas> <46ae7788-dade-3ff4-a353-985544f12c19@citymesh.com> In-Reply-To: <46ae7788-dade-3ff4-a353-985544f12c19@citymesh.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 01.04.22 15:50, Koen Vandeputte wrote: > > 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 > Hi all, I tested a bit more today and simply let the board reboot all day long. After roughly 20 reboots, it suddenly booted once stable without any errors/warnings. Looks like a race condition .. Any idea? Thanks, Koen