From patchwork Thu May 9 07:12:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1933349 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=z1wnmo8t; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=BdjWoA4Y; 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=opensbi-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 4VZjs66LzYz20fZ for ; Thu, 9 May 2024 17:12:58 +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: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:In-Reply-To:References: List-Owner; bh=2/OJOQGZ2seeHGM/UfR4GhXF+861fVQL2A4SP3ZoKiM=; b=z1wnmo8tOMBp32 XwKx5sSMNYkDZvrnD6+Uyyoh4JGIOKDfu3M/hwMLdWtDavu6bv5Hnd0cwmxjlCyHjk1dLqCZ5Qz6r r5SXIoiUfmSUtbVrtpPinjD/9r1mtRbC8GodPEe/mA5hkCkZoBzCx+qgx9ZA05CvUgrkC0myEYWSa DjJyx4rLXHHYHMWoGn01KSjuljDVfos6f2nY11KG0+kV6ejNUseof3MBm4JPdzbsTdXto+h2j7ayI 9SdAmWd142lgupdE7RHimnLW5v+d/h4fo63joqYIZg7b3tblYPjtv3R6xoJDUOFdPYV2wDmlwkQC9 AYJJkIPU3uCGwcd0M5xg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4xxQ-00000000fVw-2r5c; Thu, 09 May 2024 07:12:48 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4xxN-00000000fVK-1fsS for opensbi@lists.infradead.org; Thu, 09 May 2024 07:12:46 +0000 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-6eb86b69e65so311786a34.3 for ; Thu, 09 May 2024 00:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1715238758; x=1715843558; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=mNKEnMM7F9UnZO/ZCx0QbyFHmuA+eit0p+akYXwVG8c=; b=BdjWoA4Y6wGJxWfmqgIjbCenRiLVY5HgVPgFjeQe60M4R7H/q9laZbi3yYqhAFaTpN tPDupeqRrtKIf3aWMZ6DOsdgqBLvL8QdQcbbzuyENY2kFbQL6zMVIdTaw4bom0ofXPqn hWhRDxIAQYVWfw2EVg7YUCEDDmvg9KOqwUlyIHkvJ95skq+/ScVB0LYqypyxbX0Q1qFx ChdezfHC2SPt/2YdiIzG++YbjG2eRR7nVobClpSJ/MUeH0l5Ygf143Srx5YU5VO1Hs9i ZZKzw3rKnAU83ruktYpbDUmcO5Svay5oB9PfKXzk94Bp4WYCqfzGBURGtOVxnZANzlJY CblA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715238758; x=1715843558; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mNKEnMM7F9UnZO/ZCx0QbyFHmuA+eit0p+akYXwVG8c=; b=nmvKlbaD8opgZdwucaxyvjLQv3Azs6EkikC5QB4FaJnMY3CrZUg1adugJHUvpDQ5J2 DbiBLsjLTZPUXn9PAbhTbwM6sKxXQkN3L4HtvGAUc+tNGvmZH3hC7Xqe02I2FHlyqroq 2jxuHM8g606tZB/IR9ue9pFUxp2CxF9Yiv1pjXEOzzP5jWD8MDIQdqEJGYIOM5AZptm9 7LsMyr/EXkSpkR32gkuc2ZB54EyD6XatwPBKdRutWxSRIctzSaXSoYamFP23tkd/LDTY AUDR10rMxTCc9g5uWyNtrvXDvhdZNDbd3OUNpgoVidw2NW92tgFt+h7fJmTpQhhzoTDf XDgQ== X-Forwarded-Encrypted: i=1; AJvYcCUGN/siyoQ0mLG95zCKm6RsZQzA0FDMzFG3dTpubJoFR7l4dEjTzQYonDsprntn/4DJdHcUaK6lhT7D0UOh1S7WUAa0EQfCnc3pnRs= X-Gm-Message-State: AOJu0Yw+CaKqzQlTMEzuGYaNT1HNNnH2LwIo+r7hzrhUIMcOIppFxbiz g+l+sS1+dgv+JJaPZuplNaoIeJbp6B+X1BxEfBc+H5CziNATeawH/XKwzprC/Vk= X-Google-Smtp-Source: AGHT+IFaXiDwjO7C8jyBVzqPmq6atIF7Ef+PngOyM1ofG+GhjWu0U3wvJURgsI9AL0zh2wEvLG+70A== X-Received: by 2002:a9d:7857:0:b0:6f0:465c:34c6 with SMTP id 46e09a7af769-6f0b7942e13mr5429787a34.14.1715238758281; Thu, 09 May 2024 00:12:38 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6f0e01b7d5esm151572a34.31.2024.05.09.00.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 00:12:37 -0700 (PDT) From: Anup Patel To: Atish Patra Cc: Andrew Jones , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Himanshu Chauhan , Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH] lib: sbi: Put event after use in sbi_sse_exit() loop Date: Thu, 9 May 2024 12:42:28 +0530 Message-Id: <20240509071228.1401289-1-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240509_001245_469615_022413D3 X-CRM114-Status: GOOD ( 11.49 ) X-Spam-Score: -0.2 (/) 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: Currently, the sbi_sse_exit() gets event in a loop but does not put it back after use. This results in global events remaining locked causing hangs on sub-sequent calls to sse_event_get() for global e [...] Content analysis details: (-0.2 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:32a 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_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Currently, the sbi_sse_exit() gets event in a loop but does not put it back after use. This results in global events remaining locked causing hangs on sub-sequent calls to sse_event_get() for global events. Fixes: c8cdf01d8f3a ("lib: sbi: Add support for Supervisor Software Events extension") Signed-off-by: Anup Patel Reviewed-by: Himanshu Chauhan --- lib/sbi/sbi_sse.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/sbi/sbi_sse.c b/lib/sbi/sbi_sse.c index 18dfdb6..0cd6ba6 100644 --- a/lib/sbi/sbi_sse.c +++ b/lib/sbi/sbi_sse.c @@ -1121,13 +1121,18 @@ void sbi_sse_exit(struct sbi_scratch *scratch) for (i = 0; i < EVENT_COUNT; i++) { e = sse_event_get(supported_events[i]); - - if (!e || e->attrs.hartid != current_hartid()) + if (!e) continue; + if (e->attrs.hartid != current_hartid()) + goto skip; + if (sse_event_state(e) > SBI_SSE_STATE_REGISTERED) { sbi_printf("Event %d in invalid state at exit", i); sse_event_set_state(e, SBI_SSE_STATE_UNUSED); } + +skip: + sse_event_put(e); } }