From patchwork Tue Feb 6 13:41:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 197454 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1545109dyb; Tue, 6 Feb 2024 05:44:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHQ0gyQejYEz/eJ1ALWBO0/w+Il5f4P7YHSkERUN0o/bXf08SzArOoeFTDYDa4YdmMF9q79 X-Received: by 2002:a05:6402:750:b0:560:5748:40bb with SMTP id p16-20020a056402075000b00560574840bbmr1600718edy.33.1707227064958; Tue, 06 Feb 2024 05:44:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707227064; cv=pass; d=google.com; s=arc-20160816; b=RDxr/nWbCiS1mNulgJUv+XoR/uNcvsWPauBGVvrz/m/Ewpy9s+NH/fFwdyK8Os5Q8x R6DEy1+V40+N+07oh7OtvG20gWPGvzQ9mBVf5/OittL+Mb3vt32RvZUAOS7pw9b3fZmU +aHC4lYed8H05V8mhKeKUSv5DPfzPDIQ/MM6uuxdGtczncS35E1DjtYN+wyXWLPaXrVV GoroF+kqFm9vLNi71m15LSFmN7WCDFuvr5oLA9ylEgc409CEau8JyQE6E41PPx2SwMAx 6f4kJxu6s7A7AxZcUM9mBaLN53+/AfzdSTITzbHRZ+NTNqTPkYZ93F8rZ/mCtrtweyEj i6jQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=XDhpSmUsxRlABpJs00xPjqf8Aa1EgE/2ne9AAn2Cih0=; fh=NnyxVUCwShbGg8pfY0sl/N2lCoDyuPmITAPyGuSJEJM=; b=GvuDASlgkxkp/067XgOS2yRNWS9BhqDz24BouSZRA3ocUzLen6Q1jkrycHyoawCql2 6hEXqE0YBrl52f777WiDpYWCOnYlGguW8enSoFwrM05U8i+jzr83xs4loARUgVQJ2V2g GHGi6e6Q5PgB8iC8ikuwfI2bptWRddUYqi2ovOZQTfUi+ly9MIyJEuimoN3pNKE7xOMl L/HoX8K+lS8xO0KLKOiM5amfs+qBLPZbQlTo3tMX3CsfAOz4fJu14eRgSjTJgIbuqcX5 m4EjAvlcjt/F+bqpFkN/tWadeUKP37Xfq+N3OqLgWxiIoIECFq/vBgGNIO20StdyH7ZA H8bQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-55041-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55041-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUXztQwLqlthf4qpbPq9IxF+DVIH0Tli8PJbO3kV+Qp4H5KiRG+K1yUP4kNHGfsPiL/G9dG+DgdafgI9EoEN9e8isPisA== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d10-20020a50f68a000000b00560bac0e2cdsi252673edn.195.2024.02.06.05.44.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 05:44:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55041-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-55041-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55041-ouuuleilei=gmail.com@vger.kernel.org" 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 42F961F21A54 for ; Tue, 6 Feb 2024 13:44:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD0A413246F; Tue, 6 Feb 2024 13:41:51 +0000 (UTC) Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [195.130.137.89]) (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 B96E313172D for ; Tue, 6 Feb 2024 13:41:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.137.89 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707226909; cv=none; b=Q8js1ca4S/LGHgzsTRtlj2P+pSq1UkbZegAoZ27WJi4PGJsfw1LYFj50QPXqKGCWB8RlQ1SRY/knCQ3AVnszFAuqW8HGSIVV6idWjwGPRpM2GF0iVZno2Xwto/572LLJ5+/RWryVg7YCHYBbf5MGrHNG3mPOyhFpaikjo460wXg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707226909; c=relaxed/simple; bh=4wIZ2jTwtVGOUJGF0vRSAy0R6gYVisVKKtOkbt/2Z/U=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=iEFp5D/USuc1EwVABqEabvsnl2K7n4DQSzYC6wHerwMhqK91vOTNfDZ7aXoblLzxI2buPhVQifuUDqC4jFKZw/ThuMXfCXTh4KkpLMnLIiIegXtYeUV0KgpkLuEkZHnpavUVrhDDlZ5pEGv6JStg49VGBZDPSBTfg6WpMQnwwIY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.137.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:1289:761a:478e:8420]) by laurent.telenet-ops.be with bizsmtp id jphf2B00C1XjtVL01phfgc; Tue, 06 Feb 2024 14:41:39 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1rXLhg-00HNlB-Dt; Tue, 06 Feb 2024 14:41:39 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1rXLhj-002Hce-1x; Tue, 06 Feb 2024 14:41:39 +0100 From: Geert Uytterhoeven To: Jens Axboe , Pavel Begunkov Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH -next] io_uring: switch struct io_kiocb flag definitions to BIT_ULL() Date: Tue, 6 Feb 2024 14:41:37 +0100 Message-Id: <1960190f37b94276df50d382b9f1488cd6b6e662.1707226862.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790157326754705307 X-GMAIL-MSGID: 1790157326754705307 When building for 32-bit platforms: In file included from include/linux/bits.h:6, from include/linux/bitops.h:6, from include/linux/kernel.h:23, from io_uring/io_uring.c:42: include/vdso/bits.h:7:40: warning: left shift count >= width of type [-Wshift-count-overflow] 7 | #define BIT(nr) (UL(1) << (nr)) | ^~ include/linux/io_uring_types.h:538:35: note: in expansion of macro ‘BIT’ 538 | REQ_F_CAN_POLL = BIT(REQ_F_CAN_POLL_BIT), | ^~~ include/vdso/bits.h:7:40: warning: left shift count >= width of type [-Wshift-count-overflow] 7 | #define BIT(nr) (UL(1) << (nr)) | ^~ include/linux/io_uring_types.h:540:35: note: in expansion of macro ‘BIT’ 540 | REQ_F_CANCEL_SEQ = BIT(REQ_F_CANCEL_SEQ_BIT), | ^~~ The io_kiocb.flags variable was expanded to 64 bits, but none of the existing or newly-added flag definitions were updated, causing build issues on 32-bit platforms, where unsigned long is a 32-bit value. Fix this by switching all flag definitions from BIT() (32 or 64 bits) to BIT_ULL() (always 64 bits). Fixes: e247b2bea90786fb ("io_uring: expand main struct io_kiocb flags to 64-bits") Fixes: d964e844044278bf ("io_uring: add io_file_can_poll() helper") Fixes: 3bdfba1b2a1fc23a ("io_uring/cancel: don't default to setting req->work.cancel_seq") Signed-off-by: Geert Uytterhoeven --- Boot-tested on arm32 and arm64. --- include/linux/io_uring_types.h | 66 +++++++++++++++++----------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h index 431e099bb2c07682..f99330b177171003 100644 --- a/include/linux/io_uring_types.h +++ b/include/linux/io_uring_types.h @@ -472,72 +472,72 @@ enum { enum { /* ctx owns file */ - REQ_F_FIXED_FILE = BIT(REQ_F_FIXED_FILE_BIT), + REQ_F_FIXED_FILE = BIT_ULL(REQ_F_FIXED_FILE_BIT), /* drain existing IO first */ - REQ_F_IO_DRAIN = BIT(REQ_F_IO_DRAIN_BIT), + REQ_F_IO_DRAIN = BIT_ULL(REQ_F_IO_DRAIN_BIT), /* linked sqes */ - REQ_F_LINK = BIT(REQ_F_LINK_BIT), + REQ_F_LINK = BIT_ULL(REQ_F_LINK_BIT), /* doesn't sever on completion < 0 */ - REQ_F_HARDLINK = BIT(REQ_F_HARDLINK_BIT), + REQ_F_HARDLINK = BIT_ULL(REQ_F_HARDLINK_BIT), /* IOSQE_ASYNC */ - REQ_F_FORCE_ASYNC = BIT(REQ_F_FORCE_ASYNC_BIT), + REQ_F_FORCE_ASYNC = BIT_ULL(REQ_F_FORCE_ASYNC_BIT), /* IOSQE_BUFFER_SELECT */ - REQ_F_BUFFER_SELECT = BIT(REQ_F_BUFFER_SELECT_BIT), + REQ_F_BUFFER_SELECT = BIT_ULL(REQ_F_BUFFER_SELECT_BIT), /* IOSQE_CQE_SKIP_SUCCESS */ - REQ_F_CQE_SKIP = BIT(REQ_F_CQE_SKIP_BIT), + REQ_F_CQE_SKIP = BIT_ULL(REQ_F_CQE_SKIP_BIT), /* fail rest of links */ - REQ_F_FAIL = BIT(REQ_F_FAIL_BIT), + REQ_F_FAIL = BIT_ULL(REQ_F_FAIL_BIT), /* on inflight list, should be cancelled and waited on exit reliably */ - REQ_F_INFLIGHT = BIT(REQ_F_INFLIGHT_BIT), + REQ_F_INFLIGHT = BIT_ULL(REQ_F_INFLIGHT_BIT), /* read/write uses file position */ - REQ_F_CUR_POS = BIT(REQ_F_CUR_POS_BIT), + REQ_F_CUR_POS = BIT_ULL(REQ_F_CUR_POS_BIT), /* must not punt to workers */ - REQ_F_NOWAIT = BIT(REQ_F_NOWAIT_BIT), + REQ_F_NOWAIT = BIT_ULL(REQ_F_NOWAIT_BIT), /* has or had linked timeout */ - REQ_F_LINK_TIMEOUT = BIT(REQ_F_LINK_TIMEOUT_BIT), + REQ_F_LINK_TIMEOUT = BIT_ULL(REQ_F_LINK_TIMEOUT_BIT), /* needs cleanup */ - REQ_F_NEED_CLEANUP = BIT(REQ_F_NEED_CLEANUP_BIT), + REQ_F_NEED_CLEANUP = BIT_ULL(REQ_F_NEED_CLEANUP_BIT), /* already went through poll handler */ - REQ_F_POLLED = BIT(REQ_F_POLLED_BIT), + REQ_F_POLLED = BIT_ULL(REQ_F_POLLED_BIT), /* buffer already selected */ - REQ_F_BUFFER_SELECTED = BIT(REQ_F_BUFFER_SELECTED_BIT), + REQ_F_BUFFER_SELECTED = BIT_ULL(REQ_F_BUFFER_SELECTED_BIT), /* buffer selected from ring, needs commit */ - REQ_F_BUFFER_RING = BIT(REQ_F_BUFFER_RING_BIT), + REQ_F_BUFFER_RING = BIT_ULL(REQ_F_BUFFER_RING_BIT), /* caller should reissue async */ - REQ_F_REISSUE = BIT(REQ_F_REISSUE_BIT), + REQ_F_REISSUE = BIT_ULL(REQ_F_REISSUE_BIT), /* supports async reads/writes */ - REQ_F_SUPPORT_NOWAIT = BIT(REQ_F_SUPPORT_NOWAIT_BIT), + REQ_F_SUPPORT_NOWAIT = BIT_ULL(REQ_F_SUPPORT_NOWAIT_BIT), /* regular file */ - REQ_F_ISREG = BIT(REQ_F_ISREG_BIT), + REQ_F_ISREG = BIT_ULL(REQ_F_ISREG_BIT), /* has creds assigned */ - REQ_F_CREDS = BIT(REQ_F_CREDS_BIT), + REQ_F_CREDS = BIT_ULL(REQ_F_CREDS_BIT), /* skip refcounting if not set */ - REQ_F_REFCOUNT = BIT(REQ_F_REFCOUNT_BIT), + REQ_F_REFCOUNT = BIT_ULL(REQ_F_REFCOUNT_BIT), /* there is a linked timeout that has to be armed */ - REQ_F_ARM_LTIMEOUT = BIT(REQ_F_ARM_LTIMEOUT_BIT), + REQ_F_ARM_LTIMEOUT = BIT_ULL(REQ_F_ARM_LTIMEOUT_BIT), /* ->async_data allocated */ - REQ_F_ASYNC_DATA = BIT(REQ_F_ASYNC_DATA_BIT), + REQ_F_ASYNC_DATA = BIT_ULL(REQ_F_ASYNC_DATA_BIT), /* don't post CQEs while failing linked requests */ - REQ_F_SKIP_LINK_CQES = BIT(REQ_F_SKIP_LINK_CQES_BIT), + REQ_F_SKIP_LINK_CQES = BIT_ULL(REQ_F_SKIP_LINK_CQES_BIT), /* single poll may be active */ - REQ_F_SINGLE_POLL = BIT(REQ_F_SINGLE_POLL_BIT), + REQ_F_SINGLE_POLL = BIT_ULL(REQ_F_SINGLE_POLL_BIT), /* double poll may active */ - REQ_F_DOUBLE_POLL = BIT(REQ_F_DOUBLE_POLL_BIT), + REQ_F_DOUBLE_POLL = BIT_ULL(REQ_F_DOUBLE_POLL_BIT), /* request has already done partial IO */ - REQ_F_PARTIAL_IO = BIT(REQ_F_PARTIAL_IO_BIT), + REQ_F_PARTIAL_IO = BIT_ULL(REQ_F_PARTIAL_IO_BIT), /* fast poll multishot mode */ - REQ_F_APOLL_MULTISHOT = BIT(REQ_F_APOLL_MULTISHOT_BIT), + REQ_F_APOLL_MULTISHOT = BIT_ULL(REQ_F_APOLL_MULTISHOT_BIT), /* recvmsg special flag, clear EPOLLIN */ - REQ_F_CLEAR_POLLIN = BIT(REQ_F_CLEAR_POLLIN_BIT), + REQ_F_CLEAR_POLLIN = BIT_ULL(REQ_F_CLEAR_POLLIN_BIT), /* hashed into ->cancel_hash_locked, protected by ->uring_lock */ - REQ_F_HASH_LOCKED = BIT(REQ_F_HASH_LOCKED_BIT), + REQ_F_HASH_LOCKED = BIT_ULL(REQ_F_HASH_LOCKED_BIT), /* don't use lazy poll wake for this request */ - REQ_F_POLL_NO_LAZY = BIT(REQ_F_POLL_NO_LAZY_BIT), + REQ_F_POLL_NO_LAZY = BIT_ULL(REQ_F_POLL_NO_LAZY_BIT), /* file is pollable */ - REQ_F_CAN_POLL = BIT(REQ_F_CAN_POLL_BIT), + REQ_F_CAN_POLL = BIT_ULL(REQ_F_CAN_POLL_BIT), /* cancel sequence is set and valid */ - REQ_F_CANCEL_SEQ = BIT(REQ_F_CANCEL_SEQ_BIT), + REQ_F_CANCEL_SEQ = BIT_ULL(REQ_F_CANCEL_SEQ_BIT), }; typedef void (*io_req_tw_func_t)(struct io_kiocb *req, struct io_tw_state *ts);