Received: by 2002:ab2:5c0e:0:b0:1ef:a325:1205 with SMTP id i14csp197068lqk; Wed, 13 Mar 2024 23:33:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxFRyhO5WqcKSXg3i82CAJqwtXkdBwl4hgr2W019kNtJ+2aYgsLJio+wEEcNRb4e9l5ujfvA3mnolJdHeMrHNRG5BUtA7tHFLuX2w5Yg== X-Google-Smtp-Source: AGHT+IEtVLZf2YChObK531tHV1xulDoqhSJFjrClJnFko6JJlZksNeYoFwcYW+/NV2n8CfmRvinF X-Received: by 2002:a9d:6d02:0:b0:6e4:f67f:9d46 with SMTP id o2-20020a9d6d02000000b006e4f67f9d46mr885218otp.31.1710397997115; Wed, 13 Mar 2024 23:33:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710397997; cv=pass; d=google.com; s=arc-20160816; b=xKpCP8o+0LW0+WEoZ7sxKiqSUsl+/oXV14JUM1O2h4QaJ7F6gSSmKXJA8LJMzp8yMw MHshjmSLit8Urn/xH5nw05NCSHu3yHJuwUcutvHQR2nHF6q0D0IETZ2jAfAiWMOaAAtH PBpXQkSmJDRWJPlCsqrbMuU+PP1ea79Hu01A8ncMpB8B0T4dvzwIemq5SshURfBe8V6+ SYxtEI/5DhmOK82dKKXcXMf+CadztDImgLJmVvw1/CJ/ttlFPj20uyS5DKZVQIC25DBN B7s33rp8hQS0BEDKdiimY9lQxd42U68OgBWQOJsjP3AqRW0aM4rqN8EYTEOSlOVsj9k3 x/8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature; bh=fzcZHh1jZiQwAFamoYOv8hYIGDtvvPG9onbC8+ulskc=; fh=GlZC0QO3GCq4mneEbeNezND8h4dl9rusCJ6O15QFlmo=; b=X8Vuqi8ui62QLufGjc0MM6XwYXBXZbrnTUgQTKHA8yC91Hrftdhow7Kf5tXp/YIv9B 4lOrdUEnXqaSGGIp6LxkpW+jQKrb8R1HnVTXvWJwVMFOf6xqgvAH0JkWoqg7Bi0IggyV rEe5CJfAHJ5DRVOKyWyTGHTQHtCCY8gin+tLnFHWAIAFeKP+ufFRn7x7smPmQD0vuQMo q/uU5T4mXXRR/8ccD8TmsctUl2yrNCD+NtWas6xH9So5F+rvYuBq6gkE3UhjmukC8YFN wB62P1IZmK8OtnWwr7S7xAIY7PG3Nn7ftGZJprzNbQ0VFMuA+y5dfTM66AbJtSF+e3/M FObg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cfw6EsqJ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-102881-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102881-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s205-20020a632cd6000000b005e438e94d35si965160pgs.2.2024.03.13.23.33.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 23:33:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102881-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cfw6EsqJ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-102881-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102881-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BCFF2283FA4 for ; Thu, 14 Mar 2024 06:33:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CE814A05; Thu, 14 Mar 2024 06:33:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cfw6EsqJ" Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B8892107; Thu, 14 Mar 2024 06:33:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710397989; cv=none; b=YJxhw7f3vmePRmjckuUZvzV/XQU7Dw8xH08g1agdwJvQVFEWeFQ4Ta0Yv1b3okMp7MQRh/lMosFs6CPUG4XgqxPeHx9UPbFc8occ2/cpPwt//Ww3C7tn4NPT8/pExW1FUWiVQ1Kg/YvWCSsrOTLptwrJ0bBV+OcQtbWkcyZ7lk8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710397989; c=relaxed/simple; bh=JREUaYIzmw23F3qZLagjrzXJ/nYk1/tWnql3BvD7gpw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NI8dyu78gp0F1UxXZ+Kp4fn/JmvcB6la0CybZ2rF3uLpG7K42Jktjheu5QUD1z7GdrxsI3t2uiYGuQsRRNNE+cVS/zsVu+HaB5IWN+SDjCZT0NX92/VMKUWp8YHkjsKLkCOdRpkQju3SHe5wFtBmeqmnN1SAUiU4ozq3O0cIvu8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cfw6EsqJ; arc=none smtp.client-ip=209.85.167.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3c19e18470aso484141b6e.1; Wed, 13 Mar 2024 23:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710397986; x=1711002786; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=fzcZHh1jZiQwAFamoYOv8hYIGDtvvPG9onbC8+ulskc=; b=cfw6EsqJJxkCSNdsSFh5gy1tJQk3XnlF6P+V00MvKjozjAY1Kfl7y5Ttr8al5Z6T7V TQD14bGIAtZkg3nxyoAySG0l0IwsIeGEgFWx3H8XKZlFRKmeMStfadTyFzrUiaaK3ThY 5JvuS4hJLca2Nao+TI0s9epr0oQWpNIyaAfUwE4iaR6bsnndUfYvraX37KkU0+AZSPUq mwwwDuu8aE7QRdEG9aO72PdNcde7cCVRjLp5w2M5J/rW+T2rJFofCqM/oh6Y8ePr4pyH vgZ9fpAX5bncM9966EIeaNshpgMH5WmeZMLW5hHwrln3PC3vQhxpMr+26bsRVnaAD1a5 LKTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710397986; x=1711002786; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fzcZHh1jZiQwAFamoYOv8hYIGDtvvPG9onbC8+ulskc=; b=o/OkOa6n5wiRhS5P8Oc9ztS8a+SsZJUNDCmBLvZgfEguGxaLPmE4uEOF36cSzjLTkt cN5mhn8NBkCrJnPL0ywWBGuA8+G+AdjL7kuytdLhnEgyUXivm1NsHRMVLCFuhmUmIJFB kYRyswGs/sofY9AtaTs75x/7f9AGIDhIMqJnrV56e+1xxkJu8AYeCDAZxBDdW3fS+rDV zJUTCNoAQ/PaOBeZdZyBADNYG/urPkJ3zWiFZ90iXQL+MHJd+6snwUzDD5BH9BVZAjAR QK9QAwaXgpB4SmEwKUL+gEftw27SrwJFhHX1o12kesW2lYE9VRUQbUSItm5RyzJOpNjr Vavg== X-Forwarded-Encrypted: i=1; AJvYcCWtgxzNxnqJa6wRHySQrq3370nNUjehb1mDdpXdU1xGwTfJMwMs6UmwvhtoZIj5XcDasIWjXhR9Lg36su2hI6uF8lvyCNxXnRt6nBKLxNxecqi9AAVyyAy3ueF1NczX9do7 X-Gm-Message-State: AOJu0YwbUCBsZT2zTygVBAgTf+DRx4Vr7LEoajWirh06zuob5WwW0W6B MQvMGm3yNFdX9Ave33p2aqGQ5MpDZdoxxzY1rY//pL5AqO2a8S/c X-Received: by 2002:a05:6808:30e:b0:3c1:33c7:68bb with SMTP id i14-20020a056808030e00b003c133c768bbmr857680oie.31.1710397985341; Wed, 13 Mar 2024 23:33:05 -0700 (PDT) Received: from fauth2-smtp.messagingengine.com (fauth2-smtp.messagingengine.com. [103.168.172.201]) by smtp.gmail.com with ESMTPSA id l9-20020ae9f009000000b0078861edc3bdsm421097qkg.2.2024.03.13.23.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 23:33:04 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfauth.nyi.internal (Postfix) with ESMTP id 0C1A61200043; Thu, 14 Mar 2024 02:33:04 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 14 Mar 2024 02:33:04 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrjeeigdeludcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhepffeljeelheevleetleetudfghfehvdekgfdvheefieffiefhiefgvddtuefh tdetnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghdpghhithhhuhgsrdgtohhmnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdo mhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedtieegqddujeejke ehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgr mhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 14 Mar 2024 02:33:03 -0400 (EDT) Date: Wed, 13 Mar 2024 23:33:01 -0700 From: Boqun Feng To: Florian Fainelli Cc: Frederic Weisbecker , "Russell King (Oracle)" , Joel Fernandes , Anna-Maria Behnsen , Linus Torvalds , linux-kernel@vger.kernel.org, kernel-team@meta.com, paulmck@kernel.org, mingo@kernel.org, tglx@linutronix.de, rcu@vger.kernel.org, neeraj.upadhyay@amd.com, urezki@gmail.com, qiang.zhang1211@gmail.com, bigeasy@linutronix.de, chenzhongjin@huawei.com, yangjihong1@huawei.com, rostedt@goodmis.org, Justin Chen Subject: Re: Unexplained long boot delays [Was Re: [GIT PULL] RCU changes for v6.9] Message-ID: References: <2fb110ed-ba04-4320-9ef0-8766c9df5578@gmail.com> <533151c9-afb5-453b-8014-9fbe7c3b26c2@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Mar 13, 2024 at 10:12:10PM -0700, Boqun Feng wrote: > On Wed, Mar 13, 2024 at 08:44:07PM -0700, Florian Fainelli wrote: > > > > > > On 3/13/2024 3:52 PM, Frederic Weisbecker wrote: > > > On Wed, Mar 13, 2024 at 03:04:26PM -0700, Florian Fainelli wrote: > > > > On 3/13/24 14:59, Russell King (Oracle) wrote: > > > > > On Wed, Mar 13, 2024 at 02:30:43PM -0700, Florian Fainelli wrote: > > > > > > I will try to provide multiple answers for the sake of everyone having the > > > > > > same context. Responding to Linus' specifically and his suggestion to use > > > > > > "initcall_debug", this is what it gave me: > > > > > > > > > > > > [ 6.970669] ata1: SATA link down (SStatus 0 SControl 300) > > > > > > [ 166.136366] probe of unimac-mdio-0:01 returned 0 after 159216218 usecs > > > > > > [ 166.142931] unimac-mdio unimac-mdio.0: Broadcom UniMAC MDIO bus > > > > > > [ 166.148900] probe of unimac-mdio.0 returned 0 after 159243553 usecs > > > > > > [ 166.155820] probe of f0480000.ethernet returned 0 after 159258794 usecs > > > > > > [ 166.166427] ehci-brcm f0b00300.ehci_v2: EHCI Host Controller > > > > > > > > > > > > Also got another occurrence happening resuming from suspend to DRAM with: > > > > > > > > > > > > [ 22.570667] brcmstb-dpfe 9932000.dpfe-cpu: PM: calling > > > > > > platform_pm_resume+0x0/0x54 @ 1574, parent: rdb > > > > > > [ 181.643809] brcmstb-dpfe 9932000.dpfe-cpu: PM: > > > > > > platform_pm_resume+0x0/0x54 returned 0 after 159073134 usecs > > > > > > > > > > > > and also with the PCIe root complex driver: > > > > > > > > > > > > [ 18.266279] brcm-pcie f0460000.pcie: PM: calling > > > > > > brcm_pcie_resume_noirq+0x0/0x164 @ 1597, parent: platform > > > > > > [ 177.457219] brcm-pcie f0460000.pcie: clkreq-mode set to default > > > > > > [ 177.457225] brcm-pcie f0460000.pcie: link up, 2.5 GT/s PCIe x1 (!SSC) > > > > > > [ 177.457231] brcm-pcie f0460000.pcie: PM: brcm_pcie_resume_noirq+0x0/0x164 > > > > > > returned 0 after 159190939 usecs > > > > > > [ 177.457257] pcieport 0000:00:00.0: PM: calling > > > > > > pci_pm_resume_noirq+0x0/0x160 @ 33, parent: pci0000:00 > > > > > > > > > > > > Surprisingly those drivers are consistently reproducing the failures I am > > > > > > seeing so at least this gave me a clue as to where the problem is. > > > > > > > > > > > > There were no changes to drivers/net/ethernet/broadcom/genet/, the two > > > > > > changes done to drivers/net/mdio/mdio-bcm-unimac.c are correct, especially > > > > > > the read_poll_timeout() conversion is correct, we properly break out of the > > > > > > loop. The initial delay looked like a good culprit for a little while, but > > > > > > it is not used on the affected platforms because instead we provide a > > > > > > callback and we have an interrupt to signal the completion of a MDIO > > > > > > operation, therefore unimac_mdio_poll() is not used at all. Finally > > > > > > drivers/memory/brcmstb_dpfe.c also received a single change which is not > > > > > > functional here (.remove function change do return void). > > > > > > > > > > > > I went back to a manual bisection and this time I believe that I have a more > > > > > > plausible candidate with: > > > > > > > > > > > > 7ee988770326fca440472200c3eb58935fe712f6 ("timers: Implement the > > > > > > hierarchical pull model") > > > > > > > > > > I haven't understood the code there yet, and how it would interact with > > > > > arch code, but one thing that immediately jumps out to me is this: > > > > > > > > > > " As long as a CPU is busy it expires both local and global timers. When a > > > > > CPU goes idle it arms for the first expiring local timer." > > > > > > > > > > So are local timers "armed" when they are enqueued while the cpu is > > > > > "busy" during initialisation, and will they expire, and will that > > > > > expiry be delivered in a timely manner? > > > > > > > > > > If not, this commit is basically broken, and would be the cause of the > > > > > issue you are seeing. For the mdio case, we're talking about 2ms > > > > > polling. For the dpfe case, it looks like we're talking about 1ms > > > > > sleeps. I'm guessing that these end up being local timers. > > > > > > > > > > Looking at pcie-brcmstb, there's a 100ms msleep(), and then a polling > > > > > for link up every 5ms - if the link was down and we msleep(5) I wonder > > > > > if that's triggering the same issue. > > > > > > > > > > Why that would manifest itself on 32-bit but not 64-bit Arm, I can't > > > > > say. I would imagine that the same hardware timer driver is being used > > > > > (may be worth checking DT.) The same should be true for the interrupt > > > > > driver as well. There's been no changes in that code. > > > > > > > > I just had it happen with ARM64 I was plagued by: > > > > > > > > https://lore.kernel.org/lkml/87wmqrjg8n.fsf@somnus/T/ > > > > > > > > and my earlier bisections somehow did not have ARM64 fail, so I thought it > > > > was immune but it fails with about the same failure rate as ARM 32-bit. > > > > > > Can you please boot with: > > > > > > trace_event=timer_migration,timer_start,timer_expire_entry,timer_cancel > > > > > > And add the following and give us the resulting output in dmesg? > > > > Here are two logs from two different systems that exposed the problem on > > boot: > > > > I found a pattern here, maybe related. > > > https://gist.github.com/ffainelli/f0834c52ef6320c9216d879ca29a4b81 > > [ 163.244130] kworker/-31 3D.... 44007us : timer_start: timer=b089b886 function=delayed_work_timer_fn expires=4294672340 [timeout=5000] bucket_expiry=4294672384 cpu =3 idx=192 flags=D|I > > ^^^ this timer was supposed to expired after around 5000 jiffies (i.e. 5 > second, since HZ=1000), but it expired way late (160 seconds later). > Hmm.. this is more a noise since it's a deferreable timer... > [ 163.261034] kworker/-31 3d.... 44012us : timer_start: timer=394b309f function=delayed_work_timer_fn expires=4294787991 [timeout=120651] bucket_expiry=4294791168 c pu=3 idx=277 flags=I > ... > [ 221.630578] -0 1..s.. 3287405us : timer_expire_entry: timer=7e541f87 function=process_timeout now=4294670584 baseclk=4294670584 > [ 221.643475] -0 0d.s.. 162361292us : timer_cancel: timer=95703ccd > [ 221.650896] -0 0..s.. 162361292us : timer_expire_entry: timer=95703ccd function=process_timeout now=4294829657 baseclk=4294670587 > but here: [ 221.555265] kworker/-44 0d.... 3279414us : timer_start: timer=95703ccd function=process_timeout expires=4294670586 [timeout=10] bucket_expiry=4294670587 cpu=0 idx =59 flags= this is a normal timer. [ 221.571298] rcu_sche-15 3d.... 3279417us : timer_start: timer=7e541f87 function=process_timeout expires=4294670579 [timeout=3] bucket_expiry=4294670580 cpu=3 idx= 52 flags= [ 221.587241] -0 1d.s.. 3283405us : timer_cancel: timer=7e541f87 [ 221.594488] -0 1..s.. 3283407us : timer_expire_entry: timer=7e541f87 function=process_timeout now=4294670580 baseclk=4294670580 [ 221.607388] rcu_sche-15 3d.... 3283416us : timer_start: timer=7e541f87 function=process_timeout expires=4294670583 [timeout=3] bucket_expiry=4294670584 cpu=3 idx= 56 flags= [ 221.623331] -0 1d.s.. 3287404us : timer_cancel: timer=7e541f87 [ 221.630578] -0 1..s.. 3287405us : timer_expire_entry: timer=7e541f87 function=process_timeout now=4294670584 baseclk=4294670584 [ 221.643475] -0 0d.s.. 162361292us : timer_cancel: timer=95703ccd [ 221.650896] -0 0..s.. 162361292us : timer_expire_entry: timer=95703ccd function=process_timeout now=4294829657 baseclk=4294670587 which got fired here. [ 221.663967] -0 0dns.. 162361296us : timer_cancel: timer=d03eaa1d [ 221.671388] -0 0.ns.. 162361297us : timer_expire_entry: timer=d03eaa1d function=process_timeout now=4294829657 baseclk=4294670856 And looks to me CPU 0 is the tick_do_timer_cpu CPU, since it's the first one that got timers after a long wait and was doing a few catch-ups. Now the problem is why CPU 0 didn't program its hardware timer to expire at 4294670587? I.e. the earliest timer. Regards, Boqun [...]