From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (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 31D9A1B809 for ; Tue, 5 Mar 2024 19:22:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709666554; cv=none; b=GULmP7WFxPNT4POIhAiW0X0SQ+8/v+6CVNi+Dd/RmQmU6n/zyEyK+aoVEHZl9BFViYGuZGwZPOggX0GLdOhTPV9ujf6RdfENueQTTGkqqxc7VqH4UUe6HMIh2R+plxm4fTE4JKCqR0s+u/ZLuXggcfqOCBncGD2wzzjkNTB1AfE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709666554; c=relaxed/simple; bh=kV74Yj1MzqVyf6NNGDQ2CeGxlzKebgu7sxAA/z9x7pk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=di9iMuJtmr/L0BIsdBY2ZoJeLTIcJtiQAPsZuWTXgenrCFTKyVBV8FuNx6x187gB+Tls8jQB+5nRzHZk59ZkAwmH8/Ammi226wcchEqXkOkAh3ztXjpOTh81Hwf476zRpempOCn0cBnXlmVhpUq5cd55lgiC19MJlvFd1C1I0xc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=HB+2fcJF; arc=none smtp.client-ip=209.85.218.51 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HB+2fcJF" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a4515f8e13cso348137466b.3 for ; Tue, 05 Mar 2024 11:22:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709666549; x=1710271349; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Zz04MsiLPf1EieQ9O8SZKHnfGRYziipBu1MQvsGASi0=; b=HB+2fcJF8i4aysA250J5V59Sykrt6RAA7OXvzat/EnHx2gkocUpUFfYcL8Laz1ldgo uiq13FWYw/j0TY+/6iyX/O6AUybIRCjMfzwKCPIgKaUfkCNCLj3y0UY2V8JiX33j0wen OwgHQb+0rmI4v39A53bSy1Om0beyGkFDa3QQvfHNJTTfum6Inur6L+BWAqkAGRFlS9YP 3xSpuMB/U6nEoVyuBlUgOtuPjXyCtuh77HZyW+u7qIRHC47PKwtOqESealfxelh235M8 Z7o8aAj05QR3jtuf8U2ilcjw+0l2nsg02feqIqxDTH5A3GXCM5ehYD5yLdpoqIGWrNBh rl2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709666549; x=1710271349; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zz04MsiLPf1EieQ9O8SZKHnfGRYziipBu1MQvsGASi0=; b=jvUJmsQ6KESPDlOu6r/AQwkTJTZJbS5+dpwgLgm8ecAYCoxIjGJNIqpRhWwNgX+9oB WSKdVVSPMjWgcd5V1V+edUiLjoMedo1mt0v3e8PVJ71FSv3OtVXWmz32QvQQp4RzHrUR 3o8xSi9zgoLsra8CKtoGkIApbq0O8CRnhPrcBU39P1qplZu3qPHsm2Zjlu4Y3teJkKeK kWqRQJqRt7y0HkboO0TgzXZWtLzo63oHkrq686fZiMsNteYS8hgOlDS+hBoXHOdiU7vF Q7t+bhEI+jOrSR3YKpA48E43vNJIxMC666C5xdCiwmafKgc/1waA01np5f8apfMkbcgj ag8w== X-Forwarded-Encrypted: i=1; AJvYcCWMDAw0cj7vwKHrWa4mCbemgg626U6/JagZTJTbNnh+z2cWvnLez5UXdtEuqGlUGTWu3Nbk3lWfLf1YdwwR7QNMYVYi+sszwOpelww= X-Gm-Message-State: AOJu0YxD7VniX4MpugIFDqALFtzu2QLDh7kKHydbToL9I3YAADtgJ6qz 4pVXJb6etZap18aRqijmvkpm3RGZwLfgSgf9s7UjjH3k/rBKdrScYOYTWOBHvcVw33hCYULwUJ/ 2DmEd/ifoMxqj11FWCbgTfyMRVy4nXlaWjX4d X-Google-Smtp-Source: AGHT+IGfm5Q9d1QQtEV+FHngrLRB7RaEIdB98iS7LcjxrbCUYiUnZIxAhZ7sX2WiKXZhI6ep9u27+39/LAWZPVIzVjw= X-Received: by 2002:a17:906:1cd5:b0:a44:15c3:c8e9 with SMTP id i21-20020a1709061cd500b00a4415c3c8e9mr10269704ejh.28.1709666549065; Tue, 05 Mar 2024 11:22:29 -0800 (PST) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240305020153.2787423-1-almasrymina@google.com> <20240305020153.2787423-13-almasrymina@google.com> In-Reply-To: From: Mina Almasry Date: Tue, 5 Mar 2024 11:22:15 -0800 Message-ID: Subject: Re: [RFC PATCH net-next v6 12/15] tcp: RX path for devmem TCP To: Arnd Bergmann Cc: Netdev , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Linux-Arch , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Bogendoerfer , "James E . J . Bottomley" , Helge Deller , Andreas Larsson , Jesper Dangaard Brouer , Ilias Apalodimas , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , David Ahern , Willem de Bruijn , shuah , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , Pavel Begunkov , David Wei , Jason Gunthorpe , Yunsheng Lin , Shailend Chand , Harshitha Ramamurthy , Shakeel Butt , Jeroen de Borst , Praveen Kaligineedi , Willem de Bruijn , Kaiyuan Zhang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Mar 5, 2024 at 12:42=E2=80=AFAM Arnd Bergmann wrote= : > > On Tue, Mar 5, 2024, at 03:01, Mina Almasry wrote: > > --- a/arch/alpha/include/uapi/asm/socket.h > > +++ b/arch/alpha/include/uapi/asm/socket.h > > #define SO_PEERPIDFD 77 > > +#define SO_DEVMEM_LINEAR 79 > > +#define SO_DEVMEM_DMABUF 80 > > --- a/arch/mips/include/uapi/asm/socket.h > > +++ b/arch/mips/include/uapi/asm/socket.h > > #define SO_PEERPIDFD 77 > > +#define SO_DEVMEM_LINEAR 79 > > +#define SO_DEVMEM_DMABUF 80 > > --- a/arch/parisc/include/uapi/asm/socket.h > > +++ b/arch/parisc/include/uapi/asm/socket.h > > #define SO_PEERPIDFD 0x404B > > +#define SO_DEVMEM_LINEAR 98 > > +#define SO_DEVMEM_DMABUF 99 > > --- a/arch/sparc/include/uapi/asm/socket.h > > +++ b/arch/sparc/include/uapi/asm/socket.h > > #define SO_PEERPIDFD 0x0056 > > +#define SO_DEVMEM_LINEAR 0x0058 > > +#define SO_DEVMEM_DMABUF 0x0059 > > --- a/include/uapi/asm-generic/socket.h > > +++ b/include/uapi/asm-generic/socket.h > > @@ -135,6 +135,11 @@ > > #define SO_PEERPIDFD 77 > > +#define SO_DEVMEM_LINEAR 98 > > +#define SO_DEVMEM_DMABUF 99 > > These look inconsistent. I can see how you picked the > alpha and mips numbers, but how did you come up with > the generic and parisc ones? Can you follow the existing > scheme instead? > Sorry, yes, this is a bit weird. I'll change this to use the next available entry rather than leave a gap. > > diff --git a/include/uapi/linux/uio.h b/include/uapi/linux/uio.h > > index 059b1a9147f4..ad92e37699da 100644 > > --- a/include/uapi/linux/uio.h > > +++ b/include/uapi/linux/uio.h > > @@ -20,6 +20,16 @@ struct iovec > > __kernel_size_t iov_len; /* Must be size_t (1003.1g) */ > > }; > > > > +struct dmabuf_cmsg { > > + __u64 frag_offset; /* offset into the dmabuf where the frag = starts. > > + */ > > + __u32 frag_size; /* size of the frag. */ > > + __u32 frag_token; /* token representing this frag for > > + * DEVMEM_DONTNEED. > > + */ > > + __u32 dmabuf_id; /* dmabuf id this frag belongs to. */ > > +}; > > This structure requires a special compat handler to run > x86-32 binaries on x86-64 because of the different alignment > requirements. Any uapi-visible structures should be defined > to avoid this and just have no holes in them. Maybe extend > one of the __u32 members to __u64 or add another 32-bit padding field? > Honestly the 32-bit fields as-is are somewhat comically large. I don't think extending the __u32 -> __u64 is preferred because I don't see us needing that much, so maybe I can add another 32-bit padding field. Does this look good to you? struct dmabuf_cmsg { __u64 frag_offset; __u32 frag_size; __u32 frag_token; __u32 dmabuf_id; __u32 ext; /* reserved for future flags */ }; Another option is to actually compress frag_token & dmabuf_id to be 32-bit combined size if that addresses your concern. I prefer that less in case they end up being too small for future use cases. --=20 Thanks, Mina