From patchwork Fri Aug 11 14:16:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13512 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1146404vqi; Fri, 11 Aug 2023 07:44:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1mVcQ8gv6Sg3Z8hR/Il7H57RHyEt2yyT/SMlYuRvTxjHPmqYDBhe9NDqV1jJOjnmWIUZe X-Received: by 2002:a17:906:186:b0:99c:7333:199d with SMTP id 6-20020a170906018600b0099c7333199dmr2180530ejb.30.1691765072496; Fri, 11 Aug 2023 07:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691765072; cv=none; d=google.com; s=arc-20160816; b=tOJiqKc8594xfEEFxsB5i+IljgkoMuTTLhh2S/RAEvMl0w5NiI8SqCWRkyrdttzwEj NRvhii4mlud/g4eTUw+Au2gBHRL3vq1tUEoOR0fyqTprLo+VKPUTIZlLmmaxH3DInQB4 n6G2SBlyl4EDQrzLEBj35jST8Ujr+6okAx4wdLl98vEaL3E+72rI1PU8T2EBNCEg/1vI Q2dScaMBes3uPim+vEbZTyAgS2v++Hz9/WLg0PExCaZlah2m99KDNBrHcvnnlbEhXsjy iWDXlonW1ynkJoRSlAVbC30FN0mro6agkFh4o4urKaapOroJ037xkE8zTzI3/4A1xSXe JR2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=JfMLgTShUSv1TlLgjUBNX5q2wHntjjltNqKMlW1h7RQ=; fh=xY0VmqRb/OwVaUU/BARE6avnVxISkXqM+VA223N/o5g=; b=hAlW886+2fDP8VgHKo6KwHYH3jKc7PfdW03xq9QxTTkXMPDlbFgTdTMIQRV7aw9tBC of6sDi+97P42zSnrqKUl6sVPu3k2ZVD7rtQE3D1HdyDTQxk4HcBcBeJs7xeiw6L9w0oU 7LGg8fCLjS1k6KTRp7itERK6/5zB3B2vDncpaFS9hC2EinWkihZrzrREAlESjyIZH5ly R7v9tbIuNY3Rv5MbMO30xXj9sK2zr8gIAzHuHsLYTwRcKgjNt+YyuPEPHzmZVk+nX+Uq 8JHI6YY13m48CXa8RoUxTo0vHLYLBUTXRr/O/eVYnlzKkihhKqHNfRTDbsYyJuKR6scz uqQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20221208.gappssmtp.com header.s=20221208 header.b=hrVzUCCs; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o16-20020a17090608d000b00965a6d6b536si3422278eje.335.2023.08.11.07.44.06; Fri, 11 Aug 2023 07:44:32 -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=@kernel-dk.20221208.gappssmtp.com header.s=20221208 header.b=hrVzUCCs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235301AbjHKOQa (ORCPT + 99 others); Fri, 11 Aug 2023 10:16:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233429AbjHKOQ3 (ORCPT ); Fri, 11 Aug 2023 10:16:29 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A901FA for ; Fri, 11 Aug 2023 07:16:29 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-686f74a8992so348951b3a.1 for ; Fri, 11 Aug 2023 07:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20221208.gappssmtp.com; s=20221208; t=1691763388; x=1692368188; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=JfMLgTShUSv1TlLgjUBNX5q2wHntjjltNqKMlW1h7RQ=; b=hrVzUCCsH+uAnErBgiunYK/+X5Y5Ua2wVZMVmjqIyfEo3SF/ie8pBpcZVA0hfhzdrQ /yaWM+tRd2bTUfNs4B9pz4wMGQ082DyuIcGeOLAAM52QWUGmMH2dik5E9L1mCKx85vaU 5HbNo/iYNnj8Mzbn9uhuqAD0mvKUOLrkDAL3tXcQHufy1Q1qTI8BcVcSxvT0QJMX7MNW huixyhrOlk2o1VP0yWqWsnMv3e7uzSywaMTWsjYudrszuUzyvP2urETVAuqLM6M6STrK 0vVC4x6yGap89NbbukLcALHfJItxy8uyFwY8gLQVB3ljr6c3wo0b8tMoLfgm01OdZiko kflQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691763388; x=1692368188; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JfMLgTShUSv1TlLgjUBNX5q2wHntjjltNqKMlW1h7RQ=; b=JP/jXZe9Fhtx+gZeAdeo6HeaHfaB4AGcgBknmd8ID3Le9YYWFeHLAWe7kDmmUP2OrC lGdGINTz6VuzcFOENOz9w0rr+lIntl2wF0pRZHhyVTh+eP2SI/BLSpSKfWjbx4YYBm5B gm1FdTmjB6AYSrfn6+lPq0BoItJEZlHxf98eg1Du2Bs0omTyV1r463vx1mQNmpME+YYD +xr9D1gZ+ApQvLyeIz7vAji1+znuhSlYqkJ6ozQqZVyhP+vpacLnuzbVkEC2BdXM4kaZ B52p200hDDsOgUkiN8+T7eWMf2QGp4Ox0QG3Ym/FAQVi+JTERCQFEcWYpYMyxUV3C3/s mUPQ== X-Gm-Message-State: AOJu0YzPBZCfcAyWYG+jZaUXgq0AHFUvG6r0eYwuz7KFcPRYAMkHqlHv 10qB5jpMBM1BZ/oMYqjalZlfF2Y7PcI2oCjORXE= X-Received: by 2002:a05:6a20:7f8b:b0:111:a0e5:d2b7 with SMTP id d11-20020a056a207f8b00b00111a0e5d2b7mr3085327pzj.4.1691763388551; Fri, 11 Aug 2023 07:16:28 -0700 (PDT) Received: from localhost.localdomain ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id s21-20020a639255000000b00564ca424f79sm3422311pgn.48.2023.08.11.07.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Aug 2023 07:16:28 -0700 (PDT) From: Jens Axboe To: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Cc: brauner@kernel.org, arnd@arndb.de Subject: [PATCHSET v3 0/5] Add io_uring support for waitid Date: Fri, 11 Aug 2023 08:16:21 -0600 Message-Id: <20230811141626.161210-1-axboe@kernel.dk> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773944252663944709 X-GMAIL-MSGID: 1773944252663944709 Hi, This adds support for IORING_OP_WAITID, which is an async variant of the waitid(2) syscall. Rather than have a parent need to block waiting on a child task state change, it can now simply get an async notication when the requested state change has occured. Patches 1..4 are purely prep patches, and should not have functional changes. They split out parts of do_wait() into __do_wait(), so that the prepare-to-wait and sleep parts are contained within do_wait(). Patch 5 adds io_uring support. I wrote a few basic tests for this, which can be found in the 'waitid' branch of liburing: https://git.kernel.dk/cgit/liburing/log/?h=waitid Also spun a custom kernel for someone to test it, and no issues reported so far. include/linux/io_uring_types.h | 2 + include/uapi/linux/io_uring.h | 2 + io_uring/Makefile | 2 +- io_uring/cancel.c | 5 + io_uring/io_uring.c | 3 + io_uring/opdef.c | 9 + io_uring/waitid.c | 312 +++++++++++++++++++++++++++++++++ io_uring/waitid.h | 15 ++ kernel/exit.c | 129 ++++++++------ kernel/exit.h | 30 ++++ 10 files changed, 450 insertions(+), 59 deletions(-) The code can also be found here: https://git.kernel.dk/cgit/linux/log/?h=io_uring-waitid Changes since v2: - Get rid of 'f_flags' in kernel_waitid_prepare() (Christian)