From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) (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 462AD1D61BC for ; Thu, 16 Jul 2026 12:27:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784204837; cv=none; b=Lxc9D1NGgcA7ctWll/iCjV/FQ16Xtxzuo2S4WS4/Xi3yxlzYH5FZOci8aBDW+XgMf34R4Qw9gTybyQj8qVA8mA5EqrqMRkI/N7LKdQNhWsN0OQb+tge++8durMyOsM4tEZH3F4PuHjPPJ40KdRtkT1mWtdrd1JroQBy87KIDlSo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784204837; c=relaxed/simple; bh=7O4/0OSbH1Y/zp8zjFS4jShqd78HQDhbVFMaaX5tl9g=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=t+NVxdbHHL0DpQORd8PHb8wzVg6Dk9xMk5p37Z3r0aywpUqnhFjw3Xryq0fBobomK4c8CbLlH8To1h4Bfee0CJKh2xzCmzSpdyVG234W1YdeVIQnA1lHmx5XXEVMjOLy64jfEnOY0QkPRA9Vw4o5f/R06bxq2SR7irwk80NR/J8= 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=GTkdt2m5; arc=none smtp.client-ip=209.85.221.73 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="GTkdt2m5" Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-474170b59dfso3700735f8f.3 for ; Thu, 16 Jul 2026 05:27:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784204834; x=1784809634; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=vU+uWDxGjhxeFCEyixor39X4wa2P2p9cpoSP2aSeuPA=; b=GTkdt2m5hJIaeoyLuhwGuHGnWGtSWDgZVwC4Jwc+7GavmIDIlXk5+eBeGOozixn8M9 bvrMQcWybuC+TIGlzpUj4QtUGL2knk9dWqTRtsZTThItoXCHLgj7LOiB7aD6mp74oyKK LzvKvETPl7bQQlTl2W2lM6F9lo1ok/yqYTrX1uNTSbbIDs0hQilNXFCfSsmfcQtqoKP/ Z5ma5H+9kNGiHePUSIMZqkNa7AIgoDl0CcTCntK5kOS7GDvlY3cXVcooJf8MkAaQ0/L+ ga0d9OOWIqs/PUZPfeVJPl287piI38dZuGauuV1dWbgPrwB5nBq2mwS8nGP0bcovrXod dRqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784204834; x=1784809634; h=content-type: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:content-type; bh=vU+uWDxGjhxeFCEyixor39X4wa2P2p9cpoSP2aSeuPA=; b=MTiaCRrgm516Bkk1tlxZ2cGuuhIv+Ob1Jp+JC/Kblefk1B+uF7Km9C7W5jZUOtSz23 hWGBoBi9MHBxwy7sMv7H9ogcskp3WegXE/5d7Tsi2EwU9eqkU12bq/Sn1myn09+VMtmH hkW15o4p2sjfWJeYJ69iP3FCBtZXsvOqet/OnCuqiRSo/EPWsetCubYEE7K02LSJ0YXc 5JsySEI1wR6TeeT+yQHFrbnmEU/kPNRd6cL/AZ0CiUbxBOOgQtd4S/1nbta7SHbDiBsX kEtp+aPmx8xySwzD1HH2fv+HiNugKMP7nYDyKyaXxVoTTUYWFFHSX0XopeBBmxU9JKfH /+sA== X-Forwarded-Encrypted: i=1; AHgh+RrysEDR63bgc+1B9sms0md5nVFHZN4oBEj6xtR8hJqwxd71tYa/L6ml4SVBGgY5kE19wsi3IsXFd14psH4=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1nvY/yJiLvH3tKJfwgiQNidyUXbqPsnPiR65dJ49lsolJEjLd sCEdhuwWcDPM85JJ1vtT0mSnWpd18KFN+HLDFtEzySR0Psh8MtmfF1aa/ohAW8+CcfkWxdQ6Lsx Nk/XsVLSZ8AHK3rCP4w== X-Received: from wrrw12.prod.google.com ([2002:adf:f9cc:0:b0:47f:2bb3:93cf]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:2483:b0:47d:ecaa:3f97 with SMTP id ffacd0b85a97d-47f4fce6c1emr9350637f8f.45.1784204834069; Thu, 16 Jul 2026 05:27:14 -0700 (PDT) Date: Thu, 16 Jul 2026 12:27:12 +0000 In-Reply-To: <20260716-defer-complete-v1-1-ce0e38d30dc6@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260716-defer-complete-v1-1-ce0e38d30dc6@google.com> Message-ID: Subject: Re: [PATCH] rust_binder: add TF_DEFER_COMPLETE flag for avoiding userspace roundtrip From: Alice Ryhl To: Greg Kroah-Hartman , Todd Kjos , Carlos Llamas Cc: Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , "Onur =?utf-8?B?w5Z6a2Fu?=" , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Thu, Jul 16, 2026 at 11:20:56AM +0000, Alice Ryhl wrote: > + { > + // This performs a deferred push so that `read` can wait for the next incoming > + // transaction without a userspace roundtrip. > + let mut inner = self.inner.lock(); > + inner.push_work_deferred(completion); > + // However, if `TF_DEFER_COMPLETE` is not set, then set `process_work_list` to make > + // the push non-deferred. This forces a userspace roundtrip. > + inner.process_work_list |= info.flags & TF_DEFER_COMPLETE == 0; > + } Sashiko makes a good point that we must be a bit more careful here. If we find that that the thread-local queue only contains the deferred completion, but that the process-global queue is non-empty, we must still deliver the deferred completion first before taking anything from the process-global queue. Alice