Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2334094rdg; Mon, 16 Oct 2023 00:27:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhplxhBblOS07PqbfkSq+d2YkWD0IDqoU9ZYTp+gPCNywTcc9PsEKzCgdAewimjzaE6Y2/ X-Received: by 2002:a05:6a00:3916:b0:693:3f7a:eec2 with SMTP id fh22-20020a056a00391600b006933f7aeec2mr31326741pfb.29.1697441221524; Mon, 16 Oct 2023 00:27:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697441221; cv=none; d=google.com; s=arc-20160816; b=c8KgkXwpenlViD9ytsImtTEkioWEWEbv7kS53AHqTOEmnEJ6UryqiMRM303EjfEC3X KVrHvXRzdivaGIM6vi/JnEysaMw7TY4Tcicm5n4Hn06l4pa95a0gXEyKbfzyubcfABdt wJ4ZbF2qpeq5B5Kk74OKNRSRgRXu6qL8ckmU1luGiGaPnTt3s5jcIeNSrvIPW6DcLGUi L528zJWs1eT44zmHtD2uKS/QHfAh9V03EiiwkmzZMaJpaFXCkKwCaC1ntV7hrsjv13FF yhApNmw8GY558ERxZjLrW6s6EaJDzerYeKn7FGZQsdFdgFBwg4+mF7q1pUkEyroklko6 UwNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=XvK4iHCSe9c2KCq6iEz0wBdYHL1D41ldZc7PNjSNPMw=; fh=nhMuIlvpKOCChS12ibSXMPKcg2owj7YS8ovgsTJ04o8=; b=SS9l0WKqCfJPhfr+Cya0i5jkiKnBnud2vI5HLzYQsCs6qJlswmjK0GXdQ3Zl7hr2Km biaOJw0/pb0Pf/0Pk30nqrqcoGPqhkSQ0vLnEu+VzsM4vQ9pDWriw4phYZP9hQbEMuAW d5wBJSvk7zw5TfFsg9GpXVFr01vznZiqZm55HfYOhvQHmhjoNM9MPKP4BHYOYmqMOyYL lJeUCFTmaO90A3Xd7pgMrNhVUR4CpYda6i2gs/JTkEk46cOvY7B91RvP/bZgxPq1yFxo azkZJd2h55Oz0Dz2wEsnQrktfFB3bnn/qZvY/b8a39//dCg1naEoHOZDxOUwf9P1pjTm bbeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bk13-20020a056a02028d00b0059d25cedc5asi10146583pgb.637.2023.10.16.00.27.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 00:27:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9129580A2657; Mon, 16 Oct 2023 00:27:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232133AbjJPH04 (ORCPT + 99 others); Mon, 16 Oct 2023 03:26:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232113AbjJPH0x (ORCPT ); Mon, 16 Oct 2023 03:26:53 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8E59D9 for ; Mon, 16 Oct 2023 00:26:50 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qsHzz-0002wL-97; Mon, 16 Oct 2023 09:26:47 +0200 Received: from [2a0a:edc0:2:b01:1d::c0] (helo=ptx.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qsHzy-0021tg-LG; Mon, 16 Oct 2023 09:26:46 +0200 Received: from sha by ptx.whiteo.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1qsHzy-00EhVy-GZ; Mon, 16 Oct 2023 09:26:46 +0200 Date: Mon, 16 Oct 2023 09:26:46 +0200 From: Sascha Hauer To: Jens Axboe Cc: Boris Pismenny , netdev@vger.kernel.org, John Fastabend , linux-kernel@vger.kernel.org, io-uring@vger.kernel.org, kernel@pengutronix.de, Jakub Kicinski , Pavel Begunkov Subject: Re: Problem with io_uring splice and KTLS Message-ID: <20231016072646.GV3359458@pengutronix.de> References: <20231010141932.GD3114228@pengutronix.de> <20231012133407.GA3359458@pengutronix.de> <20231013054716.GG3359458@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 00:27:00 -0700 (PDT) On Fri, Oct 13, 2023 at 07:45:55AM -0600, Jens Axboe wrote: > On 10/12/23 11:47 PM, Sascha Hauer wrote: > > On Thu, Oct 12, 2023 at 07:45:07PM -0600, Jens Axboe wrote: > >> On 10/12/23 7:34 AM, Sascha Hauer wrote: > >>> In case you don't have encryption hardware you can create an > >>> asynchronous encryption module using cryptd. Compile a kernel with > >>> CONFIG_CRYPTO_USER_API_AEAD and CONFIG_CRYPTO_CRYPTD and start the > >>> webserver with the '-c' option. /proc/crypto should then contain an > >>> entry with: > >>> > >>> name : gcm(aes) > >>> driver : cryptd(gcm_base(ctr(aes-generic),ghash-generic)) > >>> module : kernel > >>> priority : 150 > >> > >> I did a bit of prep work to ensure I had everything working for when > >> there's time to dive into it, but starting it with -c doesn't register > >> this entry. Turns out the bind() in there returns -1/ENOENT. > > > > Yes, that happens here as well, that's why I don't check for the error > > in the bind call. Nevertheless it has the desired effect that the new > > algorithm is registered and used from there on. BTW you only need to > > start the webserver once with -c. If you start it repeatedly with -c a > > new gcm(aes) instance is registered each time. > > Gotcha - I wasn't able to trigger the condition, which is why I thought > perhaps I was missing something. > > Can you try the below patch and see if that makes a difference? I'm not > quite sure why it would since you said it triggers with DEFER_TASKRUN as > well, and for that kind of notification, you should never hit the paths > you have detailed in the debug patch. I can confirm that this patch makes it work for me. I tested with both software cryptd and also with my original CAAM encryption workload. IORING_SETUP_SINGLE_ISSUER | IORING_SETUP_DEFER_TASKRUN is not needed. Both my simple webserver and the original C++ Webserver from our customer are now working without problems. Do you think there is a chance getting this change upstream? I'm a bit afraid the code originally uses signal_pending() instead of task_sigpending() for a good reason. Sascha > > diff --git a/net/core/stream.c b/net/core/stream.c > index f5c4e47df165..a9a196587254 100644 > --- a/net/core/stream.c > +++ b/net/core/stream.c > @@ -67,7 +67,7 @@ int sk_stream_wait_connect(struct sock *sk, long *timeo_p) > return -EPIPE; > if (!*timeo_p) > return -EAGAIN; > - if (signal_pending(tsk)) > + if (task_sigpending(tsk)) > return sock_intr_errno(*timeo_p); > > add_wait_queue(sk_sleep(sk), &wait); > @@ -103,7 +103,7 @@ void sk_stream_wait_close(struct sock *sk, long timeout) > do { > if (sk_wait_event(sk, &timeout, !sk_stream_closing(sk), &wait)) > break; > - } while (!signal_pending(current) && timeout); > + } while (!task_sigpending(current) && timeout); > > remove_wait_queue(sk_sleep(sk), &wait); > } > @@ -134,7 +134,7 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) > goto do_error; > if (!*timeo_p) > goto do_eagain; > - if (signal_pending(current)) > + if (task_sigpending(current)) > goto do_interrupted; > sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk); > if (sk_stream_memory_free(sk) && !vm_wait) > > -- > Jens Axboe > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |