Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp65397rdb; Fri, 16 Feb 2024 21:42:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVjQ7DXNwiVBfASjysNMgeRF6Al3Ftuinnx+jP6LSrBHiZTaYbWMsMUgXKQMjeOoLtPzlg1qEjvifAw01fiaTFAHaZ1p1rTW+Y1FMO8VA== X-Google-Smtp-Source: AGHT+IFBxaLhJdd/LuI1PRB/5+iDiAu+jPZiwA5pwj7ytaRJDoVUk+sJ3vk2iX/yq1pWFBE5J4gf X-Received: by 2002:a05:622a:27c5:b0:42d:d095:ea55 with SMTP id gx5-20020a05622a27c500b0042dd095ea55mr5375955qtb.13.1708148572592; Fri, 16 Feb 2024 21:42:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708148572; cv=pass; d=google.com; s=arc-20160816; b=0Bq7gZZ0nmURJ7Rg4nl5+OjeQr5a72Lvw3+H22xLoIQ2ZySup9FjuyUGiM8W5ih1VT CVV36sWFLLE/ntrizcWa1iA8JU3+osDrawGYZTbwOLFxOgRRW74bJ5SffR36C1Jc8jMa hOgjXc+k6XfoWF8mDIgWIlAUDsKMhp5XXtMVUZ8NPs5RHQ7juGzjxdPt5UKF24CB7Kvu vZt1hHVVuwZ0GIVtE6lzMLUyWYrjKhMnM14duzoz3P/pocx45nxiyo6s/1mtId3r+wpm MWaynW9kg8HYeOSbEDhHO0wOZNHTo+U7fdbfzGbn7LMjYOevzG6+CmQsV+r3bx05aDun Cklg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Q2XJqDi+VWb+RWFjBl96LehTOOg8v5aVoczUYhI4x1E=; fh=9rFYsHV0JoFDecf3ZgG9qE3cHwveu4TI7H5Soqz4h1Q=; b=V3Vk2wUcTWz93kT3e4HFEwHgB+w03JasvfatG6L9+3crgh097j2YmbHUL28QikERBO RRysTEH4N5me6mm9snCTLeJBzJJ+cGJSZXmn8+A06YqDSMTMC7Stoe7b2J2oxJ0GvPFG O2AKrdDdS7VwybF73Y3pJSw8CJ2f4XVZZp07MSNiU/yQg9GQfX6H0DsNvc0GNGIFE3pP kfRCwiFHVOP7VYbH71ynP3rAcdgnAVB4L+1qU0RXMe+Rf4YPvf51vlRx3x4mVsZnXeBb 19azp+QJ2GH5WJN8fbWqOgZOe+naZXsb4hbGKPFXFwi70OCeyUu9xWYHrw6FQTKU7Cjw gzmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=K3G6Op5s; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-69694-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69694-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y9-20020a05620a44c900b007871f016edbsi1787602qkp.620.2024.02.16.21.42.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 21:42:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69694-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=K3G6Op5s; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-69694-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69694-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 55A791C20FC8 for ; Sat, 17 Feb 2024 05:42:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 990D31CA9F; Sat, 17 Feb 2024 05:42:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="K3G6Op5s" Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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 07CAC149DE0 for ; Sat, 17 Feb 2024 05:42:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708148564; cv=none; b=tTuRJu9IaBVA8gFs1vhe+2vLJNTtzhMt5xKHX1OeUe0KhNFPhzj/OfBn5K8FaTDimVhQtU339Q2y+27KzVhpwbdTZ2Aw4QVgZmNTD6NCOFl3ZHxytvvEsMBZ2v3xK5bJ1w9zefpHM4CV5rp6Hltt6FxcWeJnDOIlM1yREEzLhI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708148564; c=relaxed/simple; bh=Q2XJqDi+VWb+RWFjBl96LehTOOg8v5aVoczUYhI4x1E=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=FoW0ZCn9aS2qnnCvwZ2kHj/KejGu1kQpoefi+RI2KxFUBTIvy0soPjSaPl3sIkRUcNwH3o7pRPN8GAcns28avVZWxTccH9A58lJEjFz/F4fmjZBBBoje1vdCAhA6ovETDGlkLbhwJkipR5ScrdkV1UEITSD0KBYTjBVuIR3H3Ss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=K3G6Op5s; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-511ac32fe38so4066255e87.1 for ; Fri, 16 Feb 2024 21:42:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1708148561; x=1708753361; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Q2XJqDi+VWb+RWFjBl96LehTOOg8v5aVoczUYhI4x1E=; b=K3G6Op5sje0wQ/2M8WNZ5+PUz2OXrBG5Tms28bIyeb2v4GJVfJ4KyZ9MP1ACdYQVuK NXK9XHOMf7mzge/ec2Bt0Pnj+mGTicMQiwDK1BpuN4sea8rn8CUi/Lgz8mcd5dEVcWP6 FcDPKWIL1d++2ihJoIcKsY1E72LfOPWSCEmRGrR5SzovEY+nQrD6okhGK1oe5Vp59Vwb KXbXL+12Bk85ythDrC8xuANCdnV4b2O51jW2vWYSqixnBZ1o62U+Jsx9UH5OLCf8jYZd 6HzRl5Y3c8TtHIscZ8B0QKnPwRPfg6ZnQIAw9cxZvE4SLc992z36RZKEOqP7PZ5VSZjl DJ3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708148561; x=1708753361; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q2XJqDi+VWb+RWFjBl96LehTOOg8v5aVoczUYhI4x1E=; b=lR2+LdU3m4KYN0Rhe5NTNQNvp2dkcbxPjgSqhA42BoUX9EXF7Be4UTnipLPLrN6jq4 jfNC2e31cC2b787zdjDxaHL5rVT6uAqA0WMcT5Zn7ygOHWJXdy3MJGkk9Rhloz0MOyBV scbvqW6rLo8m1/hEuBnWhg4IdRNiXMdiMGK3GAh2jrniYKBmotLFLKlEmby/j5XdI50L afYO/XUS24f7TyH5vjZTyK5/qfNcyOdGuSJOgvw0XLllZxZzP1e/JB1UbNqLuAUAVVgw GLHd1Fz7Dn2bNBY4m6nB5TMpLM8QD3pgy5U3gt1HnwDcNipVGe8lGBY9ngMXCKo+2ZXP rYnw== X-Forwarded-Encrypted: i=1; AJvYcCV0Q3onxixUOIMSS7vwO8ssOw6+74WMg+tsixtZpJr8wxUqZPBGHXVj0FfjaFCM8qFLOR1xcxaGoZ0MYlvA3P1EKOvrhCezPDLGsMrI X-Gm-Message-State: AOJu0YzLOn/PaI60GSA5mXmDnzy/MFZP5Y2qFA7mKbuz4HpT7/WN2+/P HQqKziCAvf4gDKByH+D3RxBeyu6UzHEtS9j3wKqflAPDaIJVC076u6Lcw1SvlPcT68IE/3NVqt3 7hN7yz5mXqoNEN+twIG6ji1+Lkkmly4Flm2GiLg== X-Received: by 2002:a05:6512:526:b0:511:96d0:5ae1 with SMTP id o6-20020a056512052600b0051196d05ae1mr5084453lfc.40.1708148560820; Fri, 16 Feb 2024 21:42:40 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240127161753.114685-1-apatel@ventanamicro.com> <20240127161753.114685-15-apatel@ventanamicro.com> <87jzn4ctks.ffs@tglx> <878r3kcg7e.ffs@tglx> In-Reply-To: <878r3kcg7e.ffs@tglx> From: Anup Patel Date: Sat, 17 Feb 2024 11:12:29 +0530 Message-ID: Subject: Re: [PATCH v12 14/25] irqchip/sifive-plic: Convert PLIC driver into a platform driver To: Thomas Gleixner 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Feb 17, 2024 at 1:52=E2=80=AFAM Thomas Gleixner wrote: > > 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 whe= n 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? Ahh, yes. Good catch. For the "maxcpus" in kernel command-line, we can't rely on the cpu_online_mask. I will preserve the plic_cpuhp_setup_done check in the next revision. Regards, Anup