From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (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 CF36F2DCC04 for ; Thu, 9 Oct 2025 11:19:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760008792; cv=none; b=FZFjUEc+GxZJ74M2KZgXZLUqGeivxiY72DPOiMES+uKklUPkHOn1Khr1KLoFVmB44Y/OVlQ57/6+9+9LFBBtCNDQY0Fc7JeN/947gF0FuEhYCVGl4A2BAi2g85fPCr2xW4VqNWriqrI06vV2p3OoEbFhn0lGwNBtT5JNnEHGukA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760008792; c=relaxed/simple; bh=RzE7qmTe7VW1DwA3fxirB0NZxAahBI8Q2RnBonVma7w=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=BYmjyMyRH47VOQGNOQ75eQt+edk9jQ7MH5OMTyXx1U9+I4v2Sxx7zWzan2bsRhRU6jKr5zwDlJlyL8Nyz8w7Yv+b1T2vq0m5E3QUZ6F2ng2RuTVLfaKwXq5KHQw5PPheFyFTZcU8keuqA9TEkt3jtvHF1oOTJWpYB1ifjmKY1Ls= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=jnJhDsKo; arc=none smtp.client-ip=209.85.128.74 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--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="jnJhDsKo" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-46e4fa584e7so4137735e9.0 for ; Thu, 09 Oct 2025 04:19:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1760008789; x=1760613589; 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=2DUd84J0qxU625unTGoQRcfxjZI7PthQsRTwRgbjUIs=; b=jnJhDsKouKH/2v8ag22OrYmiNA+LN5wqg5z1Jvz9EgKTvAUEQ+dAR+83C0pf8H/t50 0Vh6DTyL3my8UhIyPz9i26H71oUYkoQGQ6kHha2otMhNilb0saru1XEmoofMWUcVNtch wthrPY37vpcajuI0bkLUvykuMKqDFjkFwvUHHejxTjAL6wOnMOcNnHwgsdn7Idub04tw uZw3Dqe+7n9QplNHSS4v4svul2HdbYHL8+qfZDf/LQ+JOhEWzNtwaKu4ms/PuhmdUjnG qexiHrk+PyHgzLorW1Jhrog962xFL8cYegghqb4/GiN8xhdbw2tJ8hXK7+mFFxQOd03Y YXuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760008789; x=1760613589; 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=2DUd84J0qxU625unTGoQRcfxjZI7PthQsRTwRgbjUIs=; b=dwv9JYay/lB4BDwPBLZ80g9maYL8QAwYz7ehXtKy85sO5OUi1ug/yD9ISblYpJv6eP X2BbTU4ctXRPhEmg4ckEw7AIDbfOJuG6+P7BxyL0y8dGivRptLITzpi8cyh+4L5c5Rhe Ssl899ZAb2iMAYzkv34BXFFSBoKInN0awev62FTPuC7bX2RNPH6S4/dosU6OIukern/A kSxorjfpQyIu5bwAjEOHG5O9HPkfA/DicbON+EIk5fdTTOh8MdqqLHedGCdN4nrIyjpE VybH5KlMthjd2EkW6wY9qiZBHwY7CxiiYaxMVb99soWovz6zAuD2JLvknSAC3b8wry+C DXcA== X-Forwarded-Encrypted: i=1; AJvYcCU7Xd1r5XOlFClmQl6wBYbxbl+wKFzps9hoEI7lec9LOKeTOCI/iEyajYdm8sfMCfYBLm7YwnQuZlDo95zbow==@vger.kernel.org X-Gm-Message-State: AOJu0YzzZVMy/9cEMy0neOEl7HgIGCU+r86ZM+Fc/LLzDToULYqdfW1A VY4FcTcd2wGmr1Ajk673V3PR/tT2rOHLb7OeEfQTUBLwBMva1yNmc/V2dKrzWd51jRHeFlFK+Ev 5E314/qPHmHLgfY+odQ== X-Google-Smtp-Source: AGHT+IHDNiC37K6gv5N9rlmQWR84UKoo8mya5NIGmasE//q5bLN74a4a6FScJ09rff60l5B8yC3SZYWSCfFYwx4= X-Received: from wmro18.prod.google.com ([2002:a05:600c:3792:b0:45d:dc32:3d4a]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:314b:b0:46e:2109:f435 with SMTP id 5b1f17b1804b1-46fa9a966f6mr49436855e9.11.1760008789266; Thu, 09 Oct 2025 04:19:49 -0700 (PDT) Date: Thu, 9 Oct 2025 11:19:48 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251007-binder-freeze-v2-0-5376bd64fb59@google.com> <20251007-binder-freeze-v2-1-5376bd64fb59@google.com> Message-ID: Subject: Re: [PATCH v2 1/3] rust_binder: freeze_notif_done should resend if wrong state From: Alice Ryhl To: Carlos Llamas Cc: Greg Kroah-Hartman , "Arve =?utf-8?B?SGrDuG5uZXbDpWc=?=" , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Suren Baghdasaryan , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Wed, Oct 08, 2025 at 04:52:54PM +0000, Carlos Llamas wrote: > On Wed, Oct 08, 2025 at 06:41:20PM +0200, Alice Ryhl wrote: > > On Wed, Oct 8, 2025 at 6:38=E2=80=AFPM Carlos Llamas wrote: > > > > > > On Wed, Oct 08, 2025 at 06:34:54PM +0200, Alice Ryhl wrote: > > > > On Wed, Oct 8, 2025 at 6:32=E2=80=AFPM Carlos Llamas wrote: > > > > > > > > > > On Tue, Oct 07, 2025 at 09:39:51AM +0000, Alice Ryhl wrote: > > > > > > Consider the following scenario: > > > > > > 1. A freeze notification is delivered to thread 1. > > > > > > 2. The process becomes frozen or unfrozen. > > > > > > 3. The message for step 2 is delivered to thread 2 and ignored = because > > > > > > there is already a pending notification from step 1. > > > > > > 4. Thread 1 acknowledges the notification from step 1. > > > > > > In this case, step 4 should ensure that the message ignored in = step 3 is > > > > > > resent as it can now be delivered. > > > > > > > > > > hmmm, I wonder what happens with 3 threads involved where the sta= te goes > > > > > back to the (unconsumed) initial freeze notification. Userspace w= ill > > > > > probably see two separate notifications of the same state? > > > > > > > > The way I implemented it, the work items report the current state w= hen > > > > the work item is *executed*, and they do nothing if there's no chan= ge > > > > since last notification. > > > > > > Oh I see, then that means the 2nd and 3rd notifications would do noth= ing > > > as the state went back to the last notification, correct? > >=20 > > Yeah. > >=20 > > If the state flips quickly, userspace might not get told about that if > > it's too slow to receive the update, but that's no different from C > > Binder. >=20 > I believe the difference is C binder doesn't report the current state at > the time of consuming the notification. So I'm thinking that it would > report two notifications regardless of the state, even if they are both > the same. Oh well. Yeah, I guess if it only toggles once, then C Binder will report that. On the other hand, if it toggles multiple times, then C Binder might not report it that many times. We could make Rust Binder faithfully report the callback the right number of times in the face of toggling, but it seems not worth it. Alice