From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (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 3BB7A2F999F for ; Thu, 4 Dec 2025 05:57:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764827858; cv=none; b=nlcCaATzp8EwWQsqT9NARLEj4/WtwyLQ5k3fgy/iLNXV7oVjZ/ehLV5qiXMzjUhKbe7jOP2c3KkXqiU4Ffx6M4jWkzO3+2tFobgkvk9/Taq1oPJtVHihpL9eZQkuZy73bbO57tdk5Bl/GJE1T0AdXdVmAk2KWcIAaW46Yc6oTLM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764827858; c=relaxed/simple; bh=blEZffRyZpO4Hg7IHEZOiauemeeoXhWzUfpSf09z7+w=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=gLrk3ZDs33KiH/1FyP+TtdNwEuLMLX5EawhSct00/I4uT/FA6pEXcKTEcoIjDz7QcMDouYJ2fhR9WB2J7zaAU+ZEUmvhHFVOEsEdqcu7adKOjZnIL25YCdbb9gVinXCXZrT3lbttbUlmz+oFIIQYc5xVn5z3HwtHhi/FP4ppthQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joonwonkang.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=YAV87Uh+; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--joonwonkang.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YAV87Uh+" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-29848363458so11646515ad.2 for ; Wed, 03 Dec 2025 21:57:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764827856; x=1765432656; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=blEZffRyZpO4Hg7IHEZOiauemeeoXhWzUfpSf09z7+w=; b=YAV87Uh+G/cpLR5SKebAfYIpEnIxuZlTakcMK9l2hh3nL80VLTMk0ZnwV4ZAI/wMe5 PEqAcuI4OtLlbIVYd3nOJqEZJIqwNw7KpE3xL3wB4txdzO5J8iN4BChEHASeZmprN0hL BuAg65G+dJDZro20Bxkxt+1yfKxGQoWCvZ0eWm5Z2WfR+WBeABlIWZMwcSL6JE0nxP3a cqTFHy7jcyzXNuVV7kPKfVvRmBShJg4bpYLycb5gDj3k5MjND1q6Xgmc87cTAgo7NfLe Pvrwl1lPf744HheTzYaJhG18+4TLB93U7aIJ8q5ih/RtyB4fpDKwojvUeh2pJa0n2Opz PzEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764827856; x=1765432656; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=blEZffRyZpO4Hg7IHEZOiauemeeoXhWzUfpSf09z7+w=; b=MVJqXmLG6G75LTL9ymLpsDnfDztB50Un6AQH6wjrEh2tRTIblsL5/AX1ue/C5HVwjn lm4wqaJleZ3cLlk1tcLu7N/X90gmIPXEznT1OgbPP1LxvDHHw8mK5axd51ARq5yQ1AQ1 L/co3RJllw87DBs9Lz0Jcc4k3yjBzGd4il5q3QY+2S3K9dKpPAyfL9djB1MzbXeaqsX1 yUJQMFpKJYcf6u3N/JHx0P6aeEjPO5ziAzzW0YEQ/vQhEKz56/N5IEJuE/cJFKLmQo7a C4sFRnRqT5iYayaB7Nj7uiWrhn3Fkymm7AKoSq7AQpjVlsJPoV26uq8j2L0rwWV8NA2F xBWQ== X-Forwarded-Encrypted: i=1; AJvYcCUh5k5Nz6lT8Qd1xpkGMaocozxoGtW79SqsyTuqCxruKxnwnWjhWCNxzwP0Tym6rj0E+PTkOa1gBnKPh9w=@vger.kernel.org X-Gm-Message-State: AOJu0YyKcC9ZBkmKH6xznICayiZMwag2oMWrKUbFslD80d6A00pvUM9J 9vNwgAae5XLsuzdWAte9bxtnYUyEpPyx9DrbFm5ILmTCsEjRg3ubRS/4rbZ2sDXwtfqdkSqSKdO LbLMZlTBxZesGHKYiPp+1QqD8qA== X-Google-Smtp-Source: AGHT+IGGdsOd+6IRU7Ej0PHwl65BnsEmBghpXLHgWt75PsWalTRARYqT7mZ95s65ZctLl5c16wMaYqeLbGNokcs6Xw== X-Received: from pgn16.prod.google.com ([2002:a63:d50:0:b0:baa:d89d:7ea1]) (user=joonwonkang job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:9997:b0:35f:46d3:f28e with SMTP id adf61e73a8af0-363f5e6d0f2mr6451083637.43.1764827856542; Wed, 03 Dec 2025 21:57:36 -0800 (PST) Date: Thu, 4 Dec 2025 05:57:26 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.52.0.177.g9f829587af-goog Message-ID: <20251204055733.759998-1-joonwonkang@google.com> Subject: Re: [PATCH] mailbox: Allow NULL message sending From: Joonwon Kang To: jassisinghbrar@gmail.com Cc: jonathanh@nvidia.com, joonwonkang@google.com, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, thierry.reding@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Nov 25, 2025 at 11:00=E2=80=AFPM Joonwon Kang wrote: > > > > Clients may want to send interrupt only without any useful message > > involved. Since the current mailbox framework does not allow NULL > > message sending(although it allows receiving it), the clients should > > allocate a dummy message buffer and pretend sending it. Besides, if > > the mailbox controller calls `mbox_chan_txdone()` when the client > > drivers happen to send NULL message anyway, it will result in unexpecte= d > > results by making the tx status messed up. This commit lifts the > > limitation and allows the clients to send interrupt only without any > > message buffer allocated. > > > Interrupts without data messages are called 'doorbells' and we already > support them. > thanks I am not sure if it is already supported. Let me draw two cases which imply that it is not supported. If the cases make sense, could you reconsider the patch? If it is supported in another branch, could you refer me to that branch? I am currently referring to the `for-next` branch of your mailbox repo. Case 1: Send API never returns. ``` mbox_client->tx_block =3D true; mbox_chan =3D mbox_request_channel(mbox_client, index); /* * This send function never returns. It is because the mailbox framework * will **not** call `complete(&mbox_chan->tx_complete)` when the sent * message is NULL. Refer to `tx_tick()` implementation. */ ret =3D mbox_send_message(mbox_chan, NULL); ``` Case 2: TX status is messed up when NULL and non-NULL messages are sent. ``` /* Thread 1: Send NULL message to the remote. */ ret =3D mbox_send_message(mbox_chan, NULL); /* * Let's say that the mailbox controller has not received an ACK interrupt * from the remote. In this case, the mailbox framework should **not** try * picking up the next message from `mbox_chan->msg_data[]` and sending it. */ /* * Thread 2: However, the mailbox framework will think that there is no * pending message in `mbox_chan->msg_data[]`, because `mbox_chan->active_r= eq` * is NULL, and thus try sending the message of `msg_buf`. Now, * `mbox_chan->active_req` will point to `msg_buf`. */ ret =3D mbox_send_message(mbox_chan, &msg_buf); /* * Let's say that the mailbox controller now has received an ACK interrupt * for the NULL message sent by Thread 1 and not received it for Thread 2 y= et. * Then, it will call in chain `mbox_chan_txdone(mbox_chan, 0)` --> * `tx_tick(mbox_chan, 0)`, and the last function will mark as if the messa= ge * sent by Thread 2 is done by assigning `mbox_chan->active_req` with NULL. * Now, the TX status is messed up. */ ``` Thanks.