Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp627678lqs; Tue, 5 Mar 2024 11:22:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXgk4FzBnA6haLkEjE8tjYUVAKd2s/4UNJLrMFtsMezFK3LShw7Ag67KzsKsW4jFHUiCyxuQlpKpX/HFgO8S7q5GUsT7D4TUisHTrKbAg== X-Google-Smtp-Source: AGHT+IEw8XRQjAd/UY5GwvYttdvJkycwr5JSNyjsB2r2hx5/gJKv5fG4hVPYxEgI5duVUNY0Kphg X-Received: by 2002:ac2:5332:0:b0:513:4706:1c0b with SMTP id f18-20020ac25332000000b0051347061c0bmr2013961lfh.20.1709666571802; Tue, 05 Mar 2024 11:22:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709666571; cv=pass; d=google.com; s=arc-20160816; b=UH8djlRF4NrqjRoGti7EprgkLCDq1RblQEIhbaiMZn+eEPsPz1BQeuHlc3mS7I97t1 TTBTEMA+lGjY9xUVrZ6LPal8bJk30pX+E1LEnn2SdOCO26E3ZBHJMOi7lkDJe9GxNHeP RAuuhgql1luUR8tYnLkTQwxvzsg+vTsQ9W0DuLRQTWE4OKuOhLPIfC9mMoemHKfyoxhv npH0ErcUIAjjni7tyq0C9wc9A4qEjAUVNeYV/K30POp7ceTHN9SOheymgJzHuB2HPOc0 2V/LEr+3ZIkvT1gmHsqxqki3fFjr0nr3H9VOWY/l0iU0DHGSpphTwIqsxw21p8nH/ZMG vNxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Zz04MsiLPf1EieQ9O8SZKHnfGRYziipBu1MQvsGASi0=; fh=SlPo65lZ0A77+P4MDMEUNOKXiheP7UedP0UVWMRGOPs=; b=tuM5LxD01KlF4WeN8JyDKs9zA54peKYGaGmSma5steaGpDFcjjkpFyXupPtYGxGoVC PAsoqFoaacs4COSw2Q6/ystJvf3ErTZEDzVqsqOculGGeOOFsdXgh0yib9QhDrnCNqsc yrbDBNTb+WuNQIcmcXxj+4b67dPQdDhJwoZYM7/SqAS0Vs4vtu9LN3v8o0U8Y9PPftQc pN+Z9F7FqF1deIs4gUTtx/txkdf14MmpqaS992kpz5ze4mFHmp2zTsk/9Wvddi1xvilh F7wJHVEKRBSWcA8O8wg51GY6ZKltuFV8MEDm5j5csnu8+Rr2YFNNfn4EPm3FWza8QvnN E0yA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=HB+2fcJF; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-92882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92882-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h20-20020a170906591400b00a3cef7298b4si5279515ejq.217.2024.03.05.11.22.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 11:22:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=HB+2fcJF; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-92882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92882-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 148581F26237 for ; Tue, 5 Mar 2024 19:22:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3043A84FC1; Tue, 5 Mar 2024 19:22:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HB+2fcJF" Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 32AA638FAF for ; Tue, 5 Mar 2024 19:22:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709666554; cv=none; b=BHyjhHrUPgHAxILJRnHw/j5HwMZTBeQvVntU9cHnCxHPwU0St6kACG4kAVHsYOiXkPKRGMw0A34pM344DoCEtkBUkiK585REvX40lOSu3GypKENbeXAx1xo3eVZfhnUE8QCNTkLiLAIwFFiVP3GxqUFORyibcvM3BWI+st+VcFk= 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.46 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 Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a4515f8e13cso348136566b.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=B7SVzLW6YqLSrXHzPNr1LaJZQyJvCpmXyORxoE4Jsf7dLpQWoEIHUwhL9q+Cij1d+J 6XI05VxvW9jTsErFOWz06re6f+AjnNz+kEhSMcsIpDt9OaQ/SG5V3oMXJeO4HbjNs+Yh zU1jJRDJ5yk08NL1zcUTlZNO6RjGBJGCIrtePtCn/ceXJY+bvhtOKXjhujGtBtoAjiFc 1U4DcXAirVXlfmnJMkM70+BlIxz1BpNQmZpVdnCVOML00hv8kJFfzz8gp7ut5SMEwCEE aDvGAvuLLpbiEcPsD2HS3mk1kymABjJWCQUakjPhDpk20C4GTm5qvyPuLUkdsk8uM68x Cs/Q== X-Forwarded-Encrypted: i=1; AJvYcCW+eNGOhAemUI4eF2II7K5yGlt3+D4OkkEke41uh4iUv/FGhIOjavn7zhpwS0ls9dgxK6/42AJ2B7IxwHiD6+J/2inhYaQqFAQCJ2oo X-Gm-Message-State: AOJu0YxrxDQFd/gwDvc1+r+/KkStC7RiwhK4hV/3COUFCRnGhCUa0TuM sUIlMqx0TJLbPXW7eQSkQUDBpEtqGZCT84SksRSgRo8AvyFmuo02gb0149iGnwQuFr0UvSQRq+U njyK93LHVpo0CzaPlYEj7iBKLthrvKVaXbIAr/EKgMRYJ5AJPwqwU 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-kernel@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