Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp114392lqb; Thu, 14 Mar 2024 06:58:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXbEyAljsw/DD+HDQM0P05v9pITkOnAiCL+LOInyxd7KfZ1dz0FkEFLIcOHwiys2XEwZ5ndO619sGUwq3YbCT3XFKg09LVKnn48LsueVg== X-Google-Smtp-Source: AGHT+IEJ4wXrK0/S6aR3JTY/akMYM1ker7Vw1/d9KZaPHUieVxA2Rkhc+kTtTUpVx9YqURlojl9b X-Received: by 2002:a05:6a20:4b2a:b0:1a1:4ea8:1844 with SMTP id fp42-20020a056a204b2a00b001a14ea81844mr120368pzb.26.1710424730984; Thu, 14 Mar 2024 06:58:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710424730; cv=pass; d=google.com; s=arc-20160816; b=G0oTu08QXz4z1PXW3NGESOg/q81F+/laDcFHC+KfWkM+sW2MUk58goi1nx0/39wvAv /fWupIuAYMTleayYk4/dw60ILxmQMKpdD/Ba1+kacg2f8MCmAQoo3OUOtn55jqToo0Vb mwqEygltWi87EPsVxA7p6I0cTnO7xmdiQCsL14kENufvIbdPcNZFAcLzDSARgLNmeLgA 13cPZ20+ZDAYCDAAF4R5cwiUgKjJEtyEEHgCGXcHZFdaIAuNbbqMvNvPsGFbTJbWnRDm ZQPnSiV5QmJYyX4mVYg6Yfeau6ToHX98pb/Lwmggzb99ECNDH83mofvlxHdXoZo+F5/b D68g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date; bh=IDJQg9gXssCJoVAslcaU5eXmZfJVb+T/F/7dq9Ia9fQ=; fh=Hd3SeLYkvyx9VDCtRUarSiMUFj4FFrIJvr/uREOq8OM=; b=gCS4XMlpCz+oVr8LWzgHRd908LfE0G5Pd/14irAq0tfVpCefCGKwcj6ITZ2v34TU6B CNGJpnPiifmei86/6/3KV6jO60dKQRb1FyIQWTsayCkTxaF9V/20oC0ELStdtjxfH/bi zDjVm3KqePflZS3AOAbLNMJUTT38Vs8kARC3SCiBXgUslAjxheimbBxCMuFuAPOH8x74 5KsG4nmbpVd9qcU/O8yLLOQPDmgLnBTUzOkgPPe77cDVDNu/FGd1jGgvjvK+rD/2gMUv SHgmziTDZK7GPz005GUoJ5JxSphrb+QuINH9Fvu5Ycy9QdtKjwhT1R6mcQ5Z2c1PuMVx MQ4A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-103332-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103332-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id le13-20020a056a004fcd00b006e6caf96691si1508223pfb.258.2024.03.14.06.58.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 06:58:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103332-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-103332-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103332-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D4A4DB2211B for ; Thu, 14 Mar 2024 13:58:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B0E406FE1E; Thu, 14 Mar 2024 13:58:02 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32D3E59149; Thu, 14 Mar 2024 13:58:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710424682; cv=none; b=TbGwcL0q063y80KBTeH46II8wRNNWPFPyjyYivvpwT5ZrvTBx2sYZZsfhJXQtpmXXKxr9tNPCAxCefpx+l9TCa7g0zDmdOvTrz/H1NbSFYPfmHeyTJPsZnH2BAi9TSw1bEyYUbC6RmzVgsQvvUe0GIEmZ6lBMkzstSYsSD2jD/Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710424682; c=relaxed/simple; bh=dN4BV68IDf8HGWh30bz2lvsC1qhK7iq0GQPEZC4iLFE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=t7UBXf5jkDX1z3p6ZFRFOLSQC6iYgHNfJUqrYh5HS2Y8CQBWe69/K7IwOGdu8nEYwLnVQXSQ9G9uY41ZG9kQdGIE9I6UtLZ8ksD4iS4DYRmZrN4tkmly+fosgb6bY+a/gb3wikTY0Hvocgc1hnIGCwW9roJObUUZ+b23NM2lS6E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6083BC433F1; Thu, 14 Mar 2024 13:57:57 +0000 (UTC) Date: Thu, 14 Mar 2024 13:57:54 +0000 From: Catalin Marinas To: Marek Szyprowski Cc: "Russell King (Oracle)" , Sudeep Holla , "Christoph Lameter (Ampere)" , Mark Rutland , "linux-pm@vger.kernel.org" , "Rafael J. Wysocki" , Viresh Kumar , Will Deacon , Jonathan.Cameron@huawei.com, Matteo.Carlini@arm.com, Valentin.Schneider@arm.com, akpm@linux-foundation.org, anshuman.khandual@arm.com, Eric Mackay , dave.kleikamp@oracle.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, robin.murphy@arm.com, vanshikonda@os.amperecomputing.com, yang@os.amperecomputing.com, Nishanth Menon , Stephen Boyd Subject: Re: [PATCH v3] ARM64: Dynamically allocate cpumasks and increase supported CPUs to 512 Message-ID: References: <9352f410-9dad-ac89-181a-b3cfc86176b8@linux.com> <432c1980-b00f-4b07-9e24-0bec52ccb5d6@samsung.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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Mar 14, 2024 at 01:28:40PM +0100, Marek Szyprowski wrote: > On 14.03.2024 09:39, Catalin Marinas wrote: > > On Wed, Mar 13, 2024 at 05:13:33PM +0000, Russell King wrote: > >> So, I wonder whether what you're seeing is a latent bug which is > >> being tickled by the presence of the CPU masks being off-stack > >> changing the kernel timing. > >> > >> I would suggest the printk debug approach may help here to see when > >> the OPPs are begun to be parsed, when they're created etc and their > >> timing relationship to being used. Given the suspicion, it's possible > >> that the mere addition of printk() may "fix" the problem, which again > >> would be another semi-useful data point. > > It might be an init order problem. Passing "initcall_debug" on the > > cmdline might help a bit. > > > > It would also be useful in dev_pm_opp_set_config(), in the WARN_ON > > block, to print opp_table->opp_list.next to get an idea whether it looks > > like a valid pointer or memory corruption. > > I've finally found some time to do the step-by-step printk-based > debugging of this issue and finally found what's broken! > > Here is the fix: > > diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c > index 8bd6e5e8f121..2d83bbc65dd0 100644 > --- a/drivers/cpufreq/cpufreq-dt.c > +++ b/drivers/cpufreq/cpufreq-dt.c > @@ -208,7 +208,7 @@ static int dt_cpufreq_early_init(struct device *dev, > int cpu) > ??????? if (!priv) > ??????????????? return -ENOMEM; > > -?????? if (!alloc_cpumask_var(&priv->cpus, GFP_KERNEL)) > +?????? if (!zalloc_cpumask_var(&priv->cpus, GFP_KERNEL)) > ??????????????? return -ENOMEM; > > ??????? cpumask_set_cpu(cpu, priv->cpus); > > > It is really surprising that this didn't blow up for anyone else so > far... This means that the $subject patch is fine. > > I will send a proper patch fixing this issue in a few minutes. Nice. Many thanks for tracking this down. I'll revert the revert of the CPUMASK_OFFSTACK in the second part of the merging window (I already sent the pull request). -- Catalin