From patchwork Sat Sep 21 10:08:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Raphael Tiovalen X-Patchwork-Id: 1988131 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=O18kqqfx; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=lsY7A061; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X9lgk5slCz1y34 for ; Sat, 21 Sep 2024 20:22:42 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/SCgfmWTDTv3KgGhNoAupDMtb4F/IqKcgXHdNzzll/w=; b=O18kqqfxD2rNzG 2oxszI+cTW8hnbuPFD9Jm4kYGXMSHXfVgeDDLK+2fjJ1Nm2GVQ2jvmox0qvVJAWvzMm0Pa3MDdqHP VHlcSNea2nsNsjQQlRk8iwV8YWjHuez1SKJJUC0+U0AwX9Ku7IP60y61PCsK3C3AUbzkfbLyIoy2w D/siSnBgSSm1qQHVEkoNMGQGVSPv92IyfL+elmgRW1KFbA+1IZuz0XTJrI+NQPg50daXSHYl5P7hT JabIaALaSeeAZOLzRA2FenNN8ZlXE6ge0ySrJyxU8wsMDIScGAzGezHSxdfOpw1pMTYhZkeFVZoqF t8DzkYyFUFVupM2oXwog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1srxGD-0000000Dbpu-276z; Sat, 21 Sep 2024 10:22:41 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1srx2i-0000000DaWR-03Pw for kvm-riscv@lists.infradead.org; Sat, 21 Sep 2024 10:08:45 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-718816be6cbso2242519b3a.1 for ; Sat, 21 Sep 2024 03:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726913323; x=1727518123; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wKeR26fKWW24AqGwklYBuZ/CX5RZfiOMbUMOXvSoTdQ=; b=lsY7A0618WPHciOzs8xwLZlkIJ1RSklZLSEZ9SwBr8V2t0aeWLOMnwji0qliBR7sKV lVKfvGaxaOcaM8HruMgiSfrNFJ1thJ/F45NBFxWpFHi7l46ggODa30PDlVtUHOcQhSEI KokUFuuS4KY+0bmoQGaWzNWHQRDD5Cvczt0dO3A47YO6InJXEglMZ0t94N1tLqYBhJuD RdDLS9gxRQ8OeIbbiFbAOOHM8s6SOmTw76DC46gZr1wyGTn/Vu5x2eSY+vZTqUd7loAO PQzvlN7NpFkz2k7Rcmr1olIv+65Mf2Bq9LwDHjVloS5IIf6HKDZnUiK2fHn3GHzTa0he hZ5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726913323; x=1727518123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wKeR26fKWW24AqGwklYBuZ/CX5RZfiOMbUMOXvSoTdQ=; b=jKj7lKINVC1OMHP4/QLROLedzex9VU1KZNKmpYBkjZrVT6mKNhv62XuwhcMbZcPsPA iZxH1r+8gIq+v8NIe62TCLHNJrFW8gx3Ct7AHbKjMsNpf4vSr5xyYVWZ6HLuMkia5pt/ 4kP6SbLxqfQyE0DmnniT0mFoZ3HU1p0MsKnvnbRPwHMWpPJwtP6URnfnqsazUJRfz1gh VABcUeRBVfcJMZFxwuS5GClppWWH8lDih1H3+AOLZHMfOdOwbEWM/qyhUTSpDdoDrTTu SNhRTeHHsbowmLa1KJwrYUppdypxE+XadP0XAGvuv6fgI+PxO3r163jttajOq4MF46cF wJLw== X-Forwarded-Encrypted: i=1; AJvYcCXNwp08pt/VD+R8/wEf6tLzEKc+QJeoCYzzjtsV+a1Kcz/HsXCL7lZLHJ4UY9kQwg3Y92elj5c1O7Y=@lists.infradead.org X-Gm-Message-State: AOJu0YzeQHO92Ljy+ygRAryAog22pzktmPjGfK7RWLtoldzrrw2qpIyU NEfHbePfEgQMKocLMS6xVura3q3n6dH2qpIAE0+mpPVLDq62o9V8 X-Google-Smtp-Source: AGHT+IFqEt+sAml1MwSoxe/AAbU+GYbDUS6+AJasT6OAnDfupYS56nbuVhq6qnLPs//IFiu9+aoRkA== X-Received: by 2002:a17:90a:62c1:b0:2d3:dca0:89b7 with SMTP id 98e67ed59e1d1-2dd7f38132fmr6611862a91.3.1726913322867; Sat, 21 Sep 2024 03:08:42 -0700 (PDT) Received: from JRT-PC.. ([203.116.176.98]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2dd6ee7c03fsm5680024a91.11.2024.09.21.03.08.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Sep 2024 03:08:42 -0700 (PDT) From: James Raphael Tiovalen To: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org Cc: andrew.jones@linux.dev, atishp@rivosinc.com, cade.richard@berkeley.edu, James Raphael Tiovalen Subject: [kvm-unit-tests PATCH v5 4/5] riscv: Add helper method to set cpu started mask Date: Sat, 21 Sep 2024 18:08:22 +0800 Message-ID: <20240921100824.151761-5-jamestiotio@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240921100824.151761-1-jamestiotio@gmail.com> References: <20240921100824.151761-1-jamestiotio@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240921_030844_075402_B97A128F X-CRM114-Status: UNSURE ( 9.27 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: When a CPU abruptly stops during the RISC-V SBI hart stop tests, it is considered to be offline. As such, it should be removed from the cpu_started mask so that future tests can initiate another smp_b [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:42d listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [jamestiotio(at)gmail.com] X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When a CPU abruptly stops during the RISC-V SBI hart stop tests, it is considered to be offline. As such, it should be removed from the cpu_started mask so that future tests can initiate another smp_boot_secondary. Add a helper method to allow the RISC-V SBI boot hart to remove a dead CPU from the mask. Signed-off-by: James Raphael Tiovalen --- lib/riscv/asm/smp.h | 2 ++ lib/riscv/smp.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/lib/riscv/asm/smp.h b/lib/riscv/asm/smp.h index b3ead4e8..5d379a7a 100644 --- a/lib/riscv/asm/smp.h +++ b/lib/riscv/asm/smp.h @@ -26,4 +26,6 @@ secondary_func_t secondary_cinit(struct secondary_data *data); void smp_boot_secondary(int cpu, void (*func)(void)); void smp_boot_secondary_nofail(int cpu, void (*func)(void)); +void set_cpu_started(int cpu, bool started); + #endif /* _ASMRISCV_SMP_H_ */ diff --git a/lib/riscv/smp.c b/lib/riscv/smp.c index eb7061ab..eb7cfb72 100644 --- a/lib/riscv/smp.c +++ b/lib/riscv/smp.c @@ -74,3 +74,11 @@ void smp_boot_secondary_nofail(int cpu, void (*func)(void)) while (!cpu_online(cpu)) smp_wait_for_event(); } + +void set_cpu_started(int cpu, bool started) +{ + if (started) + cpumask_set_cpu(cpu, &cpu_started); + else + cpumask_clear_cpu(cpu, &cpu_started); +}