From patchwork Thu May 4 12:18:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 90065 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp277281vqo; Thu, 4 May 2023 05:32:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ61/EwwxQ1xFq6XmH0HixQz0Xj0NOQW+D+KPLALr3dFPZeI3eq2HPp/ZHG5ijQ2NI0Q8qn4 X-Received: by 2002:a05:6a20:a5a8:b0:e7:7844:903a with SMTP id bc40-20020a056a20a5a800b000e77844903amr1961744pzb.53.1683203559317; Thu, 04 May 2023 05:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683203559; cv=none; d=google.com; s=arc-20160816; b=h7670PyT5XTDSG/0xmbvE7d3IiSY5ScobKxSK1E+TXZ3PifsNrTvjgi0Pw+D1/1El3 66BRBn1+rAGnTX1AqjD0gMCizkhQNNqy9pPmA2f0rOg8kTzurFqKciGv6Ipt3f/AjB1v swNiLfx9wllj81wWbqzaKhQ9i1AU/UAOEjY52iyhQ7cqn3ez2HOWy75VwSSfb+0j7YYP ExiFj40E1CJu7d+FGVhiJM3srVdE5qMtnaiwYgAlZzvhODHAwi69cT9AgNRrTu0xR4DS SOPgsZ2tvSSseFzNiyFXr0dZX/8BIXzQGyfFtx5uCUsssPAC4zFEx8PSjRa1hiryA1dx caSQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=it1Jg8DeNZi+uSQaZN6tyTLLss5U0nLB9ujTI6DLQlE=; b=w1yriPwDHz+cMtYITNyDOWEbJejSeNYOOIrsU2ZU6qINYYAeujUAZIHzNoseW4ExOT AWho5NSo7Z4f05L0Mlkh1yM5wzhPuoIsM8hnJYXJozemJJuABUCj/bahxFmWSfV1Y7qd bF5Bd2R/w2eXxtYZnH3zZLt2FHH42obZNVhR2Da+JP3ArM0Qhcuma6+a0rgxeWJFR4Uk 9UXP3PbfE/1eAdEF7AzQhQ06QG5ZjVVrgwRoavr+kAKYDxCXs/hBnxVFDqSSD6gXO1+G 3OC58+XPRPYzc9k/GBxxyJBhhlAik06RPOV5a+9du8M5PJrqEOAykazpOsRLJA0OPlkd f7YQ== ARC-Authentication-Results: i=1; mx.google.com; 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 o23-20020a635d57000000b00528bd891345si14687609pgm.111.2023.05.04.05.32.24; Thu, 04 May 2023 05:32:39 -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; 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 S230451AbjEDMTT (ORCPT + 99 others); Thu, 4 May 2023 08:19:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230415AbjEDMTK (ORCPT ); Thu, 4 May 2023 08:19:10 -0400 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9505618B; Thu, 4 May 2023 05:19:08 -0700 (PDT) Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3064099f9b6so259169f8f.1; Thu, 04 May 2023 05:19:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683202747; x=1685794747; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=it1Jg8DeNZi+uSQaZN6tyTLLss5U0nLB9ujTI6DLQlE=; b=I2EcyFal6Slt1X71bBmBCA1jLd9RXN2G5Sl8E8Z1DnTyyUFK/ML4aNCDsnwEU6Gm28 YHOv1H4uhD0GyLHu0TI4Aw+5b47rGSXnAlh10kZQ78obYMAqZ09INVdqZSPZcSmoavrz 9YxqXKC/XSBj9ao7zCg0CyBLiDlqzIazbuSVvbVBHDXbs+Kd4uy3QX71OnLsaMRxDcF+ szmkygZKJqhjOksQShanmCryb1j58OjOms7gVAatUj2eHZ65EMdlbCSClPdjcgWCROG6 tNT3RLbp2+qtKumgiOmwZqvoM61SjfmhvQ/L7hqOOGy72OBty9usXfT7YO23tYllbK8h CgpA== X-Gm-Message-State: AC+VfDwX7UXE0NBF1cs6thGJ9E2kcXFYuWaUXlFA4DB/S0T53Pv1cN0k FSSnr5hisvEndxtcQe6w9QhrbuxlAx3dXw== X-Received: by 2002:adf:fec7:0:b0:307:41a1:dc86 with SMTP id q7-20020adffec7000000b0030741a1dc86mr902784wrs.67.1683202747127; Thu, 04 May 2023 05:19:07 -0700 (PDT) Received: from localhost (fwdproxy-cln-030.fbsv.net. [2a03:2880:31ff:1e::face:b00c]) by smtp.gmail.com with ESMTPSA id m18-20020adffa12000000b003047297a5e8sm29871228wrr.54.2023.05.04.05.19.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 May 2023 05:19:06 -0700 (PDT) From: Breno Leitao To: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, asml.silence@gmail.com, hch@lst.de, axboe@kernel.dk, ming.lei@redhat.com Cc: leit@fb.com, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, sagi@grimberg.me, joshi.k@samsung.com, kbusch@kernel.org Subject: [PATCH v4 3/3] io_uring: Remove unnecessary BUILD_BUG_ON Date: Thu, 4 May 2023 05:18:56 -0700 Message-Id: <20230504121856.904491-4-leitao@debian.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230504121856.904491-1-leitao@debian.org> References: <20230504121856.904491-1-leitao@debian.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764966855061570027?= X-GMAIL-MSGID: =?utf-8?q?1764966855061570027?= In the io_uring_cmd_prep_async() there is an unnecessary compilation time check to check if cmd is correctly placed at field 48 of the SQE. This is unnecessary, since this check is already in place at io_uring_init(): BUILD_BUG_SQE_ELEM(48, __u64, addr3); Remove it and the uring_cmd_pdu_size() function, which is not used anymore. Keith started a discussion about this topic in the following thread: Link: https://lore.kernel.org/lkml/ZDBmQOhbyU0iLhMw@kbusch-mbp.dhcp.thefacebook.com/ Signed-off-by: Breno Leitao Reviewed-by: Christoph Hellwig Reviewed-by: Ming Lei --- io_uring/uring_cmd.c | 3 --- io_uring/uring_cmd.h | 8 -------- 2 files changed, 11 deletions(-) diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index ed536d7499db..5e32db48696d 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -70,9 +70,6 @@ int io_uring_cmd_prep_async(struct io_kiocb *req) { struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd); - BUILD_BUG_ON(uring_cmd_pdu_size(0) != 16); - BUILD_BUG_ON(uring_cmd_pdu_size(1) != 80); - memcpy(req->async_data, ioucmd->sqe, uring_sqe_size(req->ctx)); ioucmd->sqe = req->async_data; return 0; diff --git a/io_uring/uring_cmd.h b/io_uring/uring_cmd.h index 7c6697d13cb2..8117684ec3ca 100644 --- a/io_uring/uring_cmd.h +++ b/io_uring/uring_cmd.h @@ -3,11 +3,3 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags); int io_uring_cmd_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); int io_uring_cmd_prep_async(struct io_kiocb *req); - -/* - * The URING_CMD payload starts at 'cmd' in the first sqe, and continues into - * the following sqe if SQE128 is used. - */ -#define uring_cmd_pdu_size(is_sqe128) \ - ((1 + !!(is_sqe128)) * sizeof(struct io_uring_sqe) - \ - offsetof(struct io_uring_sqe, cmd))