Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5091019rwp; Sun, 16 Jul 2023 19:24:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlHY/DGve9LtWEMz7QLm61yafE5yY8lHgL7MfmnykUEj3E/qa0d/YVLQYu+XET+NyEA1XXfe X-Received: by 2002:a05:6a00:e0a:b0:668:834d:4bd with SMTP id bq10-20020a056a000e0a00b00668834d04bdmr6624564pfb.0.1689560685088; Sun, 16 Jul 2023 19:24:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689560685; cv=none; d=google.com; s=arc-20160816; b=t1w+7gAaM8I4DA7KJRwvWx8Z8dKp+X9t1w3iDc+vTyk4rg22LAqf1UCfc95zNLH/eW xcYKQpeDE2ak9/IGn549qhpT+dGviLrX/UfqbUf0YqfoQzL7m4D9u2zyoF/CXLe0lixk bwPOXmmx3NFeXI81YU7cTgToS2kK5wbXat900krVa6+TV7G+7rpWY/dra0aBI7D5xaHW dhYQjzw577INLDye29z9Dai+v+FXHJbQEojp1Art8KHV0gW5iNWeEqa2YyK3CZBIlByy AimxdNYTBO9Oj2b+w8570ksyQ8uPofdgNC4g+rsygkzd95i3lMWVnOI/dGPK0BhQOWEa Gk5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=lJjcGeSu1yBzoQ4uVSesM2ecyKuvRbwcrty4LUDKxlU=; fh=k6cx5Nt4/A2xLkOE4+BlCZlMTHYeoJ3tPJiEeK65TXA=; b=P5jhwOpSjyYXCzfYT1Dm8C13CtjM33SkedsWy4GjqBXrm6r+QfJho9PPVeFVOkiGnu G/fured24WuruBJxB2KaxJCMvtGB3Vu4pJDiHd4GbVoMTjui1lxb69z/g8+wrNkEZ55M L2gbrC3XNhtYEXTQfeX6GYH1+B1OnsaBTDMfcLSRp/+rlRJZfaOcpVypvIT1hsCu7f05 e3OQWE0Omik5uXaTMGfBm/yLamssGSPBWsN5C93RgCWbB32AKt9R2aveOAb2jKFyUDHn BCnYwERq0+QYkt/HckATeHKBSgUpCvFxFQ6HryQnSsHUrM0IxlQnmLWWrCPJlVe8+Ajk 7VOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=zxGaglwS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fc41-20020a056a002e2900b006826f17d020si11066499pfb.243.2023.07.16.19.24.33; Sun, 16 Jul 2023 19:24:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=zxGaglwS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229804AbjGQCHH (ORCPT + 99 others); Sun, 16 Jul 2023 22:07:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230389AbjGQCHE (ORCPT ); Sun, 16 Jul 2023 22:07:04 -0400 Received: from mail-vs1-xe30.google.com (mail-vs1-xe30.google.com [IPv6:2607:f8b0:4864:20::e30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5C69E6B for ; Sun, 16 Jul 2023 19:06:56 -0700 (PDT) Received: by mail-vs1-xe30.google.com with SMTP id ada2fe7eead31-4438f623370so1164744137.3 for ; Sun, 16 Jul 2023 19:06:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689559616; x=1692151616; 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=lJjcGeSu1yBzoQ4uVSesM2ecyKuvRbwcrty4LUDKxlU=; b=zxGaglwS9CAZ4msTb2quYvVyDdhCIfdP2OL8sIgGnG5ZrFeTCE1QL4ZnSKCEdj6i8U HDPe3D4zfgWy9P9W+agC7wGRI3sQRiTRoBug2lQICmfMxP2K0I/k5G4Fbctruv0fvLoo 5Es07Z8HBY+N6cD6d9Vx5Wax3v/pyCywcDRYs4p0aDfCtiM98L23hfe3kCQ52wtF8ixf lsDh/biJ5vpGPQegdVr4JAoKaJXir25xPHbt3SuzrctZ+GQVDLm3gD31jjnfOmiY4Kpl GhjsXDLHLeYMFzbUcdJzXCnFuuolCnWqPKidoYZOZ6hGqJXcOcBbsDS+OGRUPsdYt+f9 Cd8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689559616; x=1692151616; 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=lJjcGeSu1yBzoQ4uVSesM2ecyKuvRbwcrty4LUDKxlU=; b=hng977nRaEgEwpoi2JZqYZP/wQBR/aICndGvxpX/nP7wCP0FxhAtRteyCvD8Y63Zt/ aiYWsbzQWdGy8nOwk0eHfxuQKxzlJb3VcB+H+xu8quOlifV/0DDDEaaliQLXeZuhd93g 1V4F+C8/LyKRgoz7OAytKTJdbXzFwIVG4er+FEcoiqyNTvXnkaun3vPPseT8ReUJb9ls pf47p394+iHB4Z5fAAihNKuLretNY6WR9juqLqIv/vCLi7G0rh+HpgMER9orYmRj52sm YK6WmDrBXmzhxtOrEXUkAxE6KJYsnOpWNBUtTMV1qO1iJyibPl+cvtkwfN2pD+CZpYeh kVqw== X-Gm-Message-State: ABy/qLZ+pq8w7NZwvoqiDuDm3yT2zfwvdNs6Qaxi+QSPHKcA506vJ7PK PYCHD+Tv/VJ/mGHL5F0JwXW/oZEhRWmAGwnH45m5RA== X-Received: by 2002:a1f:5ed4:0:b0:471:1785:e838 with SMTP id s203-20020a1f5ed4000000b004711785e838mr5240616vkb.2.1689559615726; Sun, 16 Jul 2023 19:06:55 -0700 (PDT) MIME-Version: 1.0 References: <20230710223304.1174642-1-almasrymina@google.com> <20230710223304.1174642-7-almasrymina@google.com> <73971895-6fa7-a5e1-542d-3faccbc4a830@kernel.org> In-Reply-To: <73971895-6fa7-a5e1-542d-3faccbc4a830@kernel.org> From: Mina Almasry Date: Sun, 16 Jul 2023 19:06:44 -0700 Message-ID: Subject: Re: [RFC PATCH 06/10] net: add SO_DEVMEM_DONTNEED setsockopt to release RX pages To: Andy Lutomirski Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, netdev@vger.kernel.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesper Dangaard Brouer , Ilias Apalodimas , Arnd Bergmann , David Ahern , Willem de Bruijn , Shuah Khan , jgg@ziepe.ca Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 16, 2023 at 4:57=E2=80=AFPM Andy Lutomirski w= rote: > > On 7/10/23 15:32, Mina Almasry wrote: > > Add an interface for the user to notify the kernel that it is done read= ing > > the NET_RX dmabuf pages returned as cmsg. The kernel will drop the > > reference on the NET_RX pages to make them available for re-use. > > > > Signed-off-by: Mina Almasry > > --- > > > + for (i =3D 0; i < num_tokens; i++) { > > + for (j =3D 0; j < tokens[i].token_count; j++) { > > + struct page *pg =3D xa_erase(&sk->sk_page= pool, > > + tokens[i].toke= n_start + j); > > + > > + if (pg) > > + put_page(pg); > > + else > > + /* -EINTR here notifies the users= pace > > + * that not all tokens passed to = it have > > + * been freed. > > + */ > > + ret =3D -EINTR; > > Unless I'm missing something, this type of error reporting is > unrecoverable -- userspace doesn't know how many tokens have been freed. > > I think you should either make it explicitly unrecoverable (somehow shut > down dmabuf handling entirely) or tell userspace how many tokens were > successfully freed. > Thank you, the latter suggestion sounds perfect actually. The user can't do much if the kernel fails to free all the tokens, but at least it can know that something wrong is happening and can log an error for further debugging. Great suggestion! Thanks! --=20 Thanks, Mina