From patchwork Mon Jul 8 19:57:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 11035765 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D94C13BD for ; Mon, 8 Jul 2019 19:58:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3ECAC285E0 for ; Mon, 8 Jul 2019 19:58:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 331A3285EC; Mon, 8 Jul 2019 19:58:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D35F8285E0 for ; Mon, 8 Jul 2019 19:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404762AbfGHT6A (ORCPT ); Mon, 8 Jul 2019 15:58:00 -0400 Received: from mail-pf1-f175.google.com ([209.85.210.175]:33648 "EHLO mail-pf1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727663AbfGHT6A (ORCPT ); Mon, 8 Jul 2019 15:58:00 -0400 Received: by mail-pf1-f175.google.com with SMTP id g2so3319552pfq.0 for ; Mon, 08 Jul 2019 12:57:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q+4vD/7jOOisFh2GKSZdPJeUoY2ScvqHM1ihSaIpmiI=; b=P7U2vVi5QmQ8Nzb7G3iO9+opt4E6yjWw086TNqEdBhSTunilQ66T13a9CqzAD6jEX9 TwX6RunNpLz4DeXxr1eKI5z6pY/gjniND19MsfAAyMOFHiaMfOXYNag2+D6piszKJwzh 9RQF1Ig+K7ysW3Tu4jiy/xIEkFBstRbUSgrc8TlTU5vtJXnUyddKhfPC6moVvQZ1N2pK ZGE51AbBvA+YP0s0V/abYmbPbrXTcsx2Rl1o0ibzU+h3QGMmbvC+XRmPw4WDqEEtQdmL KW636GENfM3KGbjekPf9TvlJi3S0tdWitz798bovXD0RYa0mZDz4QxsqZruimoZHMR5z 5MnQ== X-Gm-Message-State: APjAAAUYrXs8SFC0bGCjZZsk5M+UqaX74v1sXkVi7qtWUccTzAP/yxuN JoL2EQ1Re8GKgIXwMeZstcs/H1oh X-Google-Smtp-Source: APXvYqx2ySh0haekZ5ZE0OLfCXf73Xvn6Op7wJIK3BxluoUAZ0o/khkAnVO5kpYXJ3/KDjCCLh2yyQ== X-Received: by 2002:a17:90a:cb81:: with SMTP id a1mr27369490pju.81.1562615879295; Mon, 08 Jul 2019 12:57:59 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:202:4308:52a3:24b6:2c60]) by smtp.gmail.com with ESMTPSA id t8sm298043pji.24.2019.07.08.12.57.58 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 08 Jul 2019 12:57:58 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Bart Van Assche Subject: [PATCH liburing 1/4] Makefiles: Support specifying CFLAGS on the command line Date: Mon, 8 Jul 2019 12:57:47 -0700 Message-Id: <20190708195750.223103-2-bvanassche@acm.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190708195750.223103-1-bvanassche@acm.org> References: <20190708195750.223103-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch makes the liburing build work as expected for e.g. the following command: make CFLAGS=-m32 and avoids that the build fails as follows for the above command: make[1]: Entering directory 'liburing/test' cc -m32 -o poll poll.c -luring /usr/bin/ld: cannot find -luring collect2: error: ld returned 1 exit status Makefile:18: recipe for target 'poll' failed make[1]: *** [poll] Error 1 make[1]: Leaving directory 'software/liburing/test' Makefile:12: recipe for target 'all' failed make: *** [all] Error 2 Signed-off-by: Bart Van Assche --- examples/Makefile | 3 ++- src/Makefile | 2 +- test/Makefile | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/Makefile b/examples/Makefile index 6fe9bb9d15b2..ed73fcdcdaa2 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,4 +1,5 @@ -CFLAGS ?= -g -O2 -Wall -D_GNU_SOURCE -L../src/ +CFLAGS ?= -g -O2 +override CFLAGS += -Wall -D_GNU_SOURCE -L../src/ all_targets += io_uring-test io_uring-cp link-cp diff --git a/src/Makefile b/src/Makefile index b68b57e73013..954e05ea6160 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,7 +3,7 @@ includedir=$(prefix)/include libdir=$(prefix)/lib CFLAGS ?= -g -fomit-frame-pointer -O2 -CFLAGS += -Wall -I. +override CFLAGS += -Wall -I. SO_CFLAGS=-shared -fPIC $(CFLAGS) L_CFLAGS=$(CFLAGS) LINK_FLAGS= diff --git a/test/Makefile b/test/Makefile index b94e29ecbbff..52b4c9e53d22 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,4 +1,5 @@ -CFLAGS ?= -g -O2 -Wall -D_GNU_SOURCE -L../src/ +CFLAGS ?= -g -O2 +override CFLAGS += -Wall -D_GNU_SOURCE -L../src/ all_targets += poll poll-cancel ring-leak fsync io_uring_setup io_uring_register \ io_uring_enter nop sq-full cq-full 35fa71a030ca-test \ From patchwork Mon Jul 8 19:57:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 11035767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A2C013BD for ; Mon, 8 Jul 2019 19:58:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A35D285E0 for ; Mon, 8 Jul 2019 19:58:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E8A2285EC; Mon, 8 Jul 2019 19:58:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EB13285E0 for ; Mon, 8 Jul 2019 19:58:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404763AbfGHT6B (ORCPT ); Mon, 8 Jul 2019 15:58:01 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:40439 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731772AbfGHT6B (ORCPT ); Mon, 8 Jul 2019 15:58:01 -0400 Received: by mail-pf1-f196.google.com with SMTP id p184so8099382pfp.7 for ; Mon, 08 Jul 2019 12:58:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2QairLB5Hv2Yhw5Yh+wUwQUjZMuGxJMFVnN+G6Rj5Dk=; b=oCeAPof6WjmSx8XIQlHRUUpNOq4lTHJ2NrgRvu0xfeWzCRgi4yiOqqMFWVrs7YygTq yQHFhakje33WL08MSlmzVWgvVyzNBfRZDr3nZ1BN8gL9Fpwob9Qs1nGTnU9gWoNwetgc gsF4UZ6eQeu/oNbIc8mymPsG9C1oU+lnyXr1UkjE9pYzx7z3vY15SB7upjuSq7Uak3de bDwjjJzbIvNolBkCp3pcMP91pJ5i6Ycilp/BdsCyQFAeXC8a708P6LOg4canRw2yAPgu g1iSlHCwiinM57ffWQlZ8kET2xC86rsmK8FoLEpAGZmnYyDarZcpSI7taKlVZSIII/YQ zkxg== X-Gm-Message-State: APjAAAXjeeY3Hio17ft3UYTYDf1zL6H6mDME4qzIsSUn9izQuOEAkFDz b4XwT/OCeAZArZu05bgSnfEhvL+p X-Google-Smtp-Source: APXvYqxfAVrHZi7stdiyQky7L5KZyXAGzA+CPbwS9YUmGHiZuuzEpt3c7D3HtUg68xnyj66Tov6OKw== X-Received: by 2002:a17:90a:1785:: with SMTP id q5mr27741381pja.106.1562615880637; Mon, 08 Jul 2019 12:58:00 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:202:4308:52a3:24b6:2c60]) by smtp.gmail.com with ESMTPSA id t8sm298043pji.24.2019.07.08.12.57.59 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 08 Jul 2019 12:57:59 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Bart Van Assche Subject: [PATCH liburing 2/4] Fix the 32-bit build Date: Mon, 8 Jul 2019 12:57:48 -0700 Message-Id: <20190708195750.223103-3-bvanassche@acm.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190708195750.223103-1-bvanassche@acm.org> References: <20190708195750.223103-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix the warnings reported when building liburing as follows: make CFLAGS=-m32 Signed-off-by: Bart Van Assche --- test/io_uring_register.c | 11 ++++++----- test/send_recvmsg.c | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/test/io_uring_register.c b/test/io_uring_register.c index 070d0ff3d511..32e52179af29 100644 --- a/test/io_uring_register.c +++ b/test/io_uring_register.c @@ -140,7 +140,7 @@ test_max_fds(int uring_fd) perror("mmap fd_as"); exit(1); } - printf("allocated %lu bytes of address space\n", UINT_MAX * sizeof(int)); + printf("allocated %zu bytes of address space\n", UINT_MAX * sizeof(int)); fdtable_fd = mkstemp(template); if (fdtable_fd < 0) { @@ -178,7 +178,8 @@ test_max_fds(int uring_fd) fds = mmap(fds, 128*1024*1024, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, fdtable_fd, 0); if (fds == MAP_FAILED) { - printf("mmap failed at offset %lu\n", (char *)fd_as - (char *)fds); + printf("mmap failed at offset %lu\n", + (unsigned long)((char *)fd_as - (char *)fds)); exit(1); } } @@ -217,7 +218,7 @@ test_max_fds(int uring_fd) close(fdtable_fd); ret = munmap(fd_as, UINT_MAX * sizeof(int)); if (ret != 0) { - printf("munmap(%lu) failed\n", UINT_MAX * sizeof(int)); + printf("munmap(%zu) failed\n", UINT_MAX * sizeof(int)); exit(1); } @@ -244,7 +245,7 @@ test_memlock_exceeded(int fd) ret = io_uring_register(fd, IORING_REGISTER_BUFFERS, &iov, 1); if (ret < 0) { if (errno == ENOMEM) { - printf("io_uring_register of %lu bytes failed " + printf("io_uring_register of %zu bytes failed " "with ENOMEM (expected).\n", iov.iov_len); iov.iov_len /= 2; continue; @@ -253,7 +254,7 @@ test_memlock_exceeded(int fd) free(buf); return 1; } - printf("successfully registered %lu bytes (%d).\n", + printf("successfully registered %zu bytes (%d).\n", iov.iov_len, ret); ret = io_uring_register(fd, IORING_UNREGISTER_BUFFERS, NULL, 0); if (ret != 0) { diff --git a/test/send_recvmsg.c b/test/send_recvmsg.c index e6cda69664a5..9187906d3dbf 100644 --- a/test/send_recvmsg.c +++ b/test/send_recvmsg.c @@ -64,7 +64,7 @@ static int do_recvmsg(void) memset(sqe, 0, sizeof(*sqe)); sqe->opcode = IORING_OP_RECVMSG; sqe->fd = sockfd; - sqe->addr = (uint64_t) &msg; + sqe->addr = (uintptr_t) &msg; sqe->len = 1; ret = io_uring_submit(&ring); @@ -136,7 +136,7 @@ static int do_sendmsg(void) memset(sqe, 0, sizeof(*sqe)); sqe->opcode = IORING_OP_SENDMSG; sqe->fd = sockfd; - sqe->addr = (uint64_t) &msg; + sqe->addr = (uintptr_t) &msg; sqe->len = 1; ret = io_uring_submit(&ring); From patchwork Mon Jul 8 19:57:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 11035769 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5C351395 for ; Mon, 8 Jul 2019 19:58:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A744A285E0 for ; Mon, 8 Jul 2019 19:58:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BDBF285EC; Mon, 8 Jul 2019 19:58:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41BFA285E0 for ; Mon, 8 Jul 2019 19:58:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731772AbfGHT6C (ORCPT ); Mon, 8 Jul 2019 15:58:02 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:33156 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727663AbfGHT6C (ORCPT ); Mon, 8 Jul 2019 15:58:02 -0400 Received: by mail-pl1-f195.google.com with SMTP id c14so8802376plo.0 for ; Mon, 08 Jul 2019 12:58:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WLDD912jzjrPwKAt7lEbrz9vTRGFlir5odRKcjtKCfE=; b=DhXqiLr1S+kFVoQ17mYyBm8eNUZfNxwtVghMgkBgN3fBUDPN8rfWRgGH+j0JW1z2+T nRdZ5XzhV9YXH5weq+R0etwAkahzLbkpScr5TuKLIAVt0vHeO+8JnEj7zqJwjYhXB0Zw 8PwKIKTNcbWekTTJI292NCcM9pxTkMfs6S/Wjpo0BNy9lvLw5eWchNSKmOvChzX31sOx jVWzH6RMzEhL58Y6fQaS5CtK0Houe6cnNR7GG6dvD6S5sxmCOKzmM5t6vqOVpP0rzWo3 dkDJ19ThU3/Uh8ndY3GtjWPtBEkpIx0xzBJIeBjaYW3QC6MH5MnnjS2LwhUy2tl0tAR3 Qvnw== X-Gm-Message-State: APjAAAUD8xtvXqlMl0bzp6GDL/hi6Ezynw/FX/YmBKqm/ymKpinRkNO6 7ig2Wz7z4P/SRXJw2opI/h3oBT3Y X-Google-Smtp-Source: APXvYqxiCpxFdJZmWdjmJZj0PI6jSE4SO3IZQ3flph7Kpc/9rvBdao7MUsudE9fulQBusIQrm57EPA== X-Received: by 2002:a17:902:1081:: with SMTP id c1mr27441475pla.200.1562615881916; Mon, 08 Jul 2019 12:58:01 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:202:4308:52a3:24b6:2c60]) by smtp.gmail.com with ESMTPSA id t8sm298043pji.24.2019.07.08.12.58.00 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 08 Jul 2019 12:58:01 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Bart Van Assche Subject: [PATCH liburing 3/4] Change __x86_64 into __x86_64__ Date: Mon, 8 Jul 2019 12:57:49 -0700 Message-Id: <20190708195750.223103-4-bvanassche@acm.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190708195750.223103-1-bvanassche@acm.org> References: <20190708195750.223103-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch improves consistency with the Linux kernel source code. Signed-off-by: Bart Van Assche --- src/barrier.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/barrier.h b/src/barrier.h index e1a407fccde2..eb8ee1ec9d34 100644 --- a/src/barrier.h +++ b/src/barrier.h @@ -31,7 +31,7 @@ after the acquire operation executes. This is implemented using #define READ_ONCE(var) (*((volatile typeof(var) *)(&(var)))) -#if defined(__x86_64) || defined(__i386__) +#if defined(__x86_64__) || defined(__i386__) /* From tools/arch/x86/include/asm/barrier.h */ #if defined(__i386__) /* @@ -64,14 +64,14 @@ do { \ ___p1; \ }) #endif /* defined(__x86_64__) */ -#else +#else /* defined(__x86_64__) || defined(__i386__) */ /* * Add arch appropriate definitions. Be safe and use full barriers for * archs we don't have support for. */ #define smp_rmb() __sync_synchronize() #define smp_wmb() __sync_synchronize() -#endif +#endif /* defined(__x86_64__) || defined(__i386__) */ /* From tools/include/asm/barrier.h */ @@ -92,4 +92,4 @@ do { \ }) #endif -#endif +#endif /* defined(LIBURING_BARRIER_H) */ From patchwork Mon Jul 8 19:57:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 11035771 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3EF891395 for ; Mon, 8 Jul 2019 19:58:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FE07285E0 for ; Mon, 8 Jul 2019 19:58:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24505285EC; Mon, 8 Jul 2019 19:58:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0BDB285E0 for ; Mon, 8 Jul 2019 19:58:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729941AbfGHT6E (ORCPT ); Mon, 8 Jul 2019 15:58:04 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:33159 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404764AbfGHT6E (ORCPT ); Mon, 8 Jul 2019 15:58:04 -0400 Received: by mail-pl1-f196.google.com with SMTP id c14so8802404plo.0 for ; Mon, 08 Jul 2019 12:58:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U9NfZwKpuw+69CvEMSkySDQ59exe3yo4iukAW/BQ6wc=; b=XvgiCSjAugFQsd7+7yHxRnSBudao10RmRokb75QQjflboi4BntNPZDKCsTdioczdkY eKnn4dOyXUIcLleRU3g0Ww+XQ9Ps2Ghils5ZjQBb9M4ugM/QV23tgWsjqTANG77q2lJ5 E7BRa3EWPR7DjEei8xW+g4hnVrOrKRSHLYrjU7ITijyDvDhy4Vw5uShH2bE/5LzX3EdF ODONX4iZupajy7BCZNQqp3KUEkHBrC14KPGuH1BNBseuOk95mcG7EkDkks0GY4l6DCz6 niFcYKhIWPAWWJb9TZZVDqCZNWqXWMNZHKQRo3pOVFwUg4gMKKT45IF2JIwii/HixsMn gGVQ== X-Gm-Message-State: APjAAAWDiBhH1E272cF4XSYhVIONCc6we7Sg+4G9S6aqLO/Xy9DtOOSJ san7LXzW/J3PtfEIqdZfaGE= X-Google-Smtp-Source: APXvYqwz02OHafJKHzGg2IXPiN4N3ViK9/qNEjKVgWjjmxEucipFjuZYXCJcj1RTiavXZfidbAmWGA== X-Received: by 2002:a17:902:934a:: with SMTP id g10mr27722272plp.18.1562615883305; Mon, 08 Jul 2019 12:58:03 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:202:4308:52a3:24b6:2c60]) by smtp.gmail.com with ESMTPSA id t8sm298043pji.24.2019.07.08.12.58.01 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 08 Jul 2019 12:58:02 -0700 (PDT) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Bart Van Assche , Roman Penyaev Subject: [PATCH liburing 4/4] Optimize i386 memory barriers Date: Mon, 8 Jul 2019 12:57:50 -0700 Message-Id: <20190708195750.223103-5-bvanassche@acm.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190708195750.223103-1-bvanassche@acm.org> References: <20190708195750.223103-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use identical memory barrier implementations on 32 and 64 bit Intel CPUs. In the past the Linux kernel supported 32 bit CPUs that violate the x86 ordering standard. Since io_uring is not supported by these older kernels, do not support these older CPUs in liburing. See also Linux kernel commit 5927145efd5d ("x86/cpu: Remove the CONFIG_X86_PPRO_FENCE=y quirk") # v4.16. Cc: Roman Penyaev Suggested-by: Roman Penyaev Signed-off-by: Bart Van Assche --- src/barrier.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/barrier.h b/src/barrier.h index eb8ee1ec9d34..e079cf609f26 100644 --- a/src/barrier.h +++ b/src/barrier.h @@ -32,25 +32,18 @@ after the acquire operation executes. This is implemented using #if defined(__x86_64__) || defined(__i386__) -/* From tools/arch/x86/include/asm/barrier.h */ -#if defined(__i386__) -/* - * Some non-Intel clones support out of order store. wmb() ceases to be a - * nop for these. - */ -#define mb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") -#define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") -#define wmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") -#elif defined(__x86_64__) +/* Adapted from arch/x86/include/asm/barrier.h */ #define mb() asm volatile("mfence" ::: "memory") #define rmb() asm volatile("lfence" ::: "memory") #define wmb() asm volatile("sfence" ::: "memory") #define smp_rmb() barrier() #define smp_wmb() barrier() +#if defined(__i386__) +#define smp_mb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory", "cc") +#else #define smp_mb() asm volatile("lock; addl $0,-132(%%rsp)" ::: "memory", "cc") #endif -#if defined(__x86_64__) #define smp_store_release(p, v) \ do { \ barrier(); \ @@ -63,7 +56,6 @@ do { \ barrier(); \ ___p1; \ }) -#endif /* defined(__x86_64__) */ #else /* defined(__x86_64__) || defined(__i386__) */ /* * Add arch appropriate definitions. Be safe and use full barriers for