From patchwork Tue Apr 9 10:02:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 1921320 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=Sd3CkF13; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=BWLYFavl; 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 4VDM2v4Rxkz1yYH for ; Tue, 9 Apr 2024 20:02:47 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AHvsNwWmrZ917AM6eZ/hekGxkHp5dVfjle4qdPOY3i0=; b=Sd3CkF13wR4uVe bfAcVYA5cQROmN+1bhkTfT0DUu92xAZ5n2ktZt45hNJTZ+3F3ypgNaJjBdInCTBitWOZVFFa1t3/A MHDAyXQKDS268+HONwNSfKM4YDvtOjDp9qaT8eD9G5HEWOERIFg43RF7b5W2Rcw9875j/LsRboVYQ nBiz3t0vTvaamtOa1vugtcyJw3IzgDCEc6/JtJZgf2btIqKpSyEDaUrdUNx3o8FkGVbWXDnIeVW72 iSaW+DkksB4RI/i1PX4/Sdq5PsHuhJVMKIuQRALne545ptLr8A6xOg6+dqS/nEQm8LjYFpVdzQBLu NyQ7VVuix8cFhV3TK06A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ru8JL-00000001KUL-20e1; Tue, 09 Apr 2024 10:02:39 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ru8JH-00000001KOI-2W4W for opensbi@lists.infradead.org; Tue, 09 Apr 2024 10:02:37 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-416463e82fbso4177155e9.1 for ; Tue, 09 Apr 2024 03:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712656947; x=1713261747; 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=wORAhNzS/jwRC4yXYuFPUIy1IRDY3giDhqJ9orTOEVU=; b=BWLYFavl8nH2Xc9aqqcAxbSmNirAPbUSMxHg6sVMiNfsJHElxIncLVPkPQV4gPRYX6 78FfmGyo0iHfPCMhS8UsMN/1zazRUvHOyZCCj0Phq+xWpqE2RHD5Kpq4Rr9x9LAN7W38 Gv+lwF6lCSJKIuhafDhRPwOchaO2navkZ4qenHKvz/Xn4vjtcfOqlUOSJW+ClDvnhd7x Mv6YEpEGq0xmfFYZ3jSqP58m18Jb+HFmn08FW8Mx4KqnrcWT1BqU9kj4VWugBq7KMXlE yZJV89Por5RO6RKYev28d2G2y/H6B7qStub654s/epCFDdoj40jzKnheNzj6xB3droon u4kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712656947; x=1713261747; 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=wORAhNzS/jwRC4yXYuFPUIy1IRDY3giDhqJ9orTOEVU=; b=TYf+pgr+FZllZDNAOgoJzpCV5dnIG5H/+yI+Jlbn8WzgGb0Cw27yjuuA3QlIgrDJN+ BpFqsngwcMR5wRNHJQ1FGNPL+t+QihbuwHkpNuCcnBOwfDveTTt+nS6gVu8fGZ78OreY mPg4KfDPCafl2WH5KRPOYfyUQPwO5jeQgcuBevLXT969GRfBAsNtgXweAgbOWOuSSiPM ApW1ecfysLZpdmahXILB8V/HVKK9bnCDDxfk4yWVHmOEZ2aezH9aAYKY1zUNy8c4459e ISFBODTyq9RcipYBqIxPE5AMsZg8jzDJ708sDFs+hdoRpa4RymyYWXLcgSkUF89AO4lY Lsew== X-Gm-Message-State: AOJu0YzxxGlKu9ReBljw2ZbkAI4c4ATU5G86ETdZ+zFxV1rt1cAnM6Or y3EfFT1REUJrvnHXigZt1pGNBZzXGlK5ssEfALE8t5tub/3hMZmGq6Uyq5+j9J8Pi6Ankup36hI mHOU= X-Google-Smtp-Source: AGHT+IGzqdhKJlYELF5H6PBfRPNibI2PHfxgkbZC25HEQwBOemjynZvTyspMrshIbOoG7C1B1eBgCw== X-Received: by 2002:a05:600c:3b96:b0:416:7b2c:df09 with SMTP id n22-20020a05600c3b9600b004167b2cdf09mr3433946wms.1.1712656946953; Tue, 09 Apr 2024 03:02:26 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:322c:7eda:35fd:4614]) by smtp.gmail.com with ESMTPSA id a20-20020a05600c349400b00416b28651e1sm862972wmq.36.2024.04.09.03.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 03:02:26 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: opensbi@lists.infradead.org Subject: [PATCH 5/7] lib: sbi: sse: call enable callback before sending IPI Date: Tue, 9 Apr 2024 12:02:06 +0200 Message-ID: <20240409100216.263256-6-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240409100216.263256-1-cleger@rivosinc.com> References: <20240409100216.263256-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240409_030235_765591_826F5A0E X-CRM114-Status: UNSURE ( 9.36 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: =?unknown-8bit?q?Spam_detection_software=2C_running_on_the_sy?= =?unknown-8bit?q?stem_=22bombadil=2Einfradead=2Eorg=22=2C?= =?unknown-8bit?q?_has_NOT_identified_this_incoming_email_as_spam=2E__The_ori?= =?unknown-8bit?q?ginal?= =?unknown-8bit?q?_message_has_been_attached_to_this_so_you_can_view_it_or_la?= =?unknown-8bit?q?bel?= =?unknown-8bit?q?_similar_future_email=2E__If_you_have_any_questions=2C_see?= =?unknown-8bit?q?_the_administrator_of_that_system_for_details=2E?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_preview=3A__Move_the_enable_callback_call_before_s?= =?unknown-8bit?q?ending_the_IPI=2E_Even?= =?unknown-8bit?q?_though_the_event_is_locked_and_no_race_condition_can_happe?= =?unknown-8bit?q?n=2C_this_is_more?= =?unknown-8bit?q?_logical=2E_Signed-off-by=3A_Cl=C3=A9ment_L=C3=A9ger_=3Ccle?= =?unknown-8bit?q?ger=40rivosinc=2Ecom=3E_Reported-by=3A?= =?unknown-8bit?q?_Samuel_Holland_=3Csamuel=2Eholland=40sifive=2Ecom=3E_---_l?= =?unknown-8bit?q?ib/sbi/sbi=5Fsse=2Ec_=7C_6_+++---?= =?unknown-8bit?q?_1_file_changed=2C_3_insertions=28+=29=2C_3_deletions=28-?= =?unknown-8bit?q?=29_?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_analysis_details=3A___=280=2E0_points=2C_5=2E0_req?= =?unknown-8bit?q?uired=29?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_pts_rule_name______________description?= =?unknown-8bit?q?_----_----------------------_------------------------------?= =?unknown-8bit?q?--------------------?= =?unknown-8bit?q?_-0=2E0_RCVD=5FIN=5FDNSWL=5FNONE_____RBL=3A_Sender_listed_a?= =?unknown-8bit?q?t_https=3A//www=2Ednswl=2Eorg/=2C_no?= =?unknown-8bit?q?_trust?= =?unknown-8bit?b?IFsyYTAwOjE0NTA6NDg2NDoyMDowOjA6MDozMzEgbGlzdGVkIGluXQ==?= =?unknown-8bit?b?IFtsaXN0LmRuc3dsLm9yZ10=?= =?unknown-8bit?q?_0=2E0_SPF=5FHELO=5FNONE__________SPF=3A_HELO_does_not_publ?= =?unknown-8bit?q?ish_an_SPF_Record?= =?unknown-8bit?q?_-0=2E0_SPF=5FPASS_______________SPF=3A_sender_matches_SPF_?= =?unknown-8bit?q?record?= =?unknown-8bit?q?_-0=2E1_DKIM=5FVALID_____________Message_has_at_least_one_v?= =?unknown-8bit?q?alid_DKIM_or_DK_signature?= =?unknown-8bit?q?_0=2E1_DKIM=5FSIGNED____________Message_has_a_DKIM_or_DK_si?= =?unknown-8bit?q?gnature=2C_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: , Cc: Anup Patel , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Move the enable callback call before sending the IPI. Even though the event is locked and no race condition can happen, this is more logical. Signed-off-by: Clément Léger Reported-by: Samuel Holland Reviewed-by: Anup Patel --- lib/sbi/sbi_sse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sbi/sbi_sse.c b/lib/sbi/sbi_sse.c index 61d1f78..8b448bf 100644 --- a/lib/sbi/sbi_sse.c +++ b/lib/sbi/sbi_sse.c @@ -686,12 +686,12 @@ static int sse_event_enable(struct sbi_sse_event *e) sse_event_set_state(e, SBI_SSE_STATE_ENABLED); sse_event_add_to_list(e); - if (sse_event_pending(e)) + sse_event_invoke_cb(e, enable_cb); + + if (sse_event_is_global(e) && sse_event_pending(e)) sbi_ipi_send_many(1, e->attrs.hartid, sse_ipi_inject_event, NULL); - sse_event_invoke_cb(e, enable_cb); - return SBI_OK; }