Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1337741rdb; Fri, 16 Feb 2024 12:22:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVt+gJE9LSQjasNHGSNj+yinUtoYlBtJCjvOdwcu3ngW3XPg8K+UacleM1gAY0JMsSnrbjaMYxZY14mEwQnYuvTCJQjg5imonwrnyXE1w== X-Google-Smtp-Source: AGHT+IGVToMh+wfR1EEJb9OSuJSPEcy1t7TajTG26gGwmMxNs5NUCa9azZy7xoVExFFvy2slGusP X-Received: by 2002:aa7:c412:0:b0:563:e3f5:7711 with SMTP id j18-20020aa7c412000000b00563e3f57711mr2247836edq.30.1708114946982; Fri, 16 Feb 2024 12:22:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708114946; cv=pass; d=google.com; s=arc-20160816; b=ogaogkkLc2lKTulHqXyvkKVjmzscYShHaLUwEoPBQuH3jpmDQ7gzj9bMjyupt/d1NF NfW9kbj6Yjj1tFx/Y7ZZOW2N5nGebXcVF0tXyEkU+NQrh0HPZJtcIdAES7KWPd/N/Aq4 0xaRpC0Qv+g4Ei9uZwQFn5WimM9ZIvND/gsp+D7YSBCJgZwYWDUAcmDFHB7baLrZJjdn bqvozyhx4TkUXF3ghR327wjuCm8zOz/DIDEf05MOy9ftShxGORP2QbK7WuwyYDHZFlOx YNWjQwnZFNSs7W0Ef48fGEeqXFCevuqFVjVCl8vWfrk8mKc5qV1iEmDgkLD/xdqSrj19 q30A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=le97KJdlsGBLqsiJ8aQfiKStXYCU6YwRihA6kx6vD50=; fh=Ng4a2dRuM1Cs3yBq2AQhEyLCh4eSr/c4GBMkDHYIjUU=; b=bYYCPLiBj7w77aZJIZsXqyjaNBDh0xanPdhgmXm1kREHQqK1t6q5m5VKredGzyk7o9 O9pGauZtuMM52wCeiVbYfMo7ukFA0XuPnijd8DDZSqn05yGsUCBj/1LZB87iiDfHEbM/ +lQe8T4Txp0bOEOv49du6loYfQxJUhHeq371t14gzxMpcWyv2eGcklrFxvNxzFaLUrGu GTkjq0laKkphtSZR5/JOy6BGC8nykzurbs6p8W4NnwVtdcEtfK7RBzqLPIAKZK4SgsQQ R2WIIQKnVVHMpXQWVb7ahhkXW+VkW5s/e8lwqkEDipaDsO+LHMBx49xvnIKRKaY1+sMm MPnw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=YNtWCZN+; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-69287-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69287-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a23-20020aa7cf17000000b00563952383ebsi259059edy.68.2024.02.16.12.22.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 12:22:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69287-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=YNtWCZN+; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-69287-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69287-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 am.mirrors.kernel.org (Postfix) with ESMTPS id B9C731F23457 for ; Fri, 16 Feb 2024 20:22:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A80C13957E; Fri, 16 Feb 2024 20:22:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="YNtWCZN+"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QdVOnBs3" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 3E5CB12FF60; Fri, 16 Feb 2024 20:22:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708114937; cv=none; b=fdFZ99MKkc3QjERHWlLb9MIQFJSmy/A8txiGVgduQnwvp2nor64uHmNN+mV3+HXMzSZjdvbOJ552ZtoHe5N1DTbKMRJLUAIrQnwNWDlPUMD93G5bMKCGYtT/lTw/CKJ82+A2vmAmsTfmmVqx7Nkzs14BbV5py386iGBTuvf2QXM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708114937; c=relaxed/simple; bh=nypb2KZnPJWR1XM7XwoJ16qmP0FPMeXO2miQqYZ+euc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=NOkRVgMjejxNga2bXFF+kBKZlxfpv5bSsOodeaiPAaAh6ITcGPmce8pR4NcuOqooq2ti3MkGTYtglCqnCIYhPVobvoShjmHQtdvYacfCjby/0ROeDdI3gIm9GfcDFyB+iQmPSOD3DQLCIXbXh8WARoQo3a31NSjbzFraAMYlsbE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=YNtWCZN+; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=QdVOnBs3; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708114934; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=le97KJdlsGBLqsiJ8aQfiKStXYCU6YwRihA6kx6vD50=; b=YNtWCZN+oyza7Psrnp+o015RwbGOpg7nwPBmGlhWYhJoroMvc1j1yPwMbdlPkFxbZ099DY cStpTLOPTTibGQZ6dRsFGbknNWj8VO1bsaW0+eIPgqMroaaMzbPCD9kzTrmYNUuMFWb7Rj ujCSgGzYaticow53nctzXgJ7gXOWC7OHA853+v+EVBm0Dfhgy8aJUr2OraiKqXEDadV/3w 6oHgKU9uZR+LgRSztvgBVrr5BHhCt3HKME+aXGG9fOPGB7PbQ3OGIwarKrqfLDj1DRPg+y ibA8yxPAnWLA+2R6lNb0h0dxwF1h8gILaiyDbknkPS3KZEXgJ990PuKUR4aPzw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708114934; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=le97KJdlsGBLqsiJ8aQfiKStXYCU6YwRihA6kx6vD50=; b=QdVOnBs3rHq1ra9e49kCrw2tSi/Be1PmqZXRATLKXzAosslD2EHYAtI+BnLejPsm8NkGNU OKEsdip73eiy+dBQ== To: Anup Patel Cc: Anup Patel , Palmer Dabbelt , Paul Walmsley , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Conor Dooley , Marc Zyngier , =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , Atish Patra , Andrew Jones , Sunil V L , Saravana Kannan , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v12 14/25] irqchip/sifive-plic: Convert PLIC driver into a platform driver In-Reply-To: References: <20240127161753.114685-1-apatel@ventanamicro.com> <20240127161753.114685-15-apatel@ventanamicro.com> <87jzn4ctks.ffs@tglx> Date: Fri, 16 Feb 2024 21:22:13 +0100 Message-ID: <878r3kcg7e.ffs@tglx> 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=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, Feb 16 2024 at 22:41, Anup Patel wrote: > On Fri, Feb 16, 2024 at 9:03=E2=80=AFPM Thomas Gleixner wrote: >> I don't think that removing the setup protection is correct. >> >> Assume you have maxcpus=3DN on the kernel command line, then the above >> for_each_online_cpu() loop would result in cpuhp_setup =3D=3D true when = the >> instances for the not onlined CPUs are set up, no? > > A platform can have multiple PLIC instances where each PLIC > instance targets a subset of HARTs (or CPUs). > > Previously (before this patch), we were probing PLIC very early so on > a platform with multiple PLIC instances, we need to ensure that cpuhp > setup is done only after PLIC context associated with boot CPU is > initialized hence the plic_cpuhp_setup_done check. > > This patch converts PLIC driver into a platform driver so now PLIC > instances are probed after all available CPUs are brought-up. In this > case, the cpuhp setup must be done only after PLIC context of all > available CPUs are initialized otherwise some of the CPUs crash > in plic_starting_cpu() due to lack of PLIC context initialization. You're missing the point. Assume you have 8 CPUs and 2 PLIC instances one for CPU0-3 and one for CPU4-7. Add "maxcpus=3D4" on the kernel command line, then only the first 4 CPUs are brought up. So at probe time cpu_online_mask has bit 0,1,2,3 set. When the first PLIC it probed the loop which checks the context for each online CPU will not clear cpuhp_setup and the hotplug state is installed. Now the second PLIC is probed (the one for the offline CPUs 4-7) and the loop will again not clear cpuhp_setup and it tries to install the state again, no? Thanks, tglx