From patchwork Wed Jun 29 00:27:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ammar Faizi X-Patchwork-Id: 12899121 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42644C433EF for ; Wed, 29 Jun 2022 00:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229896AbiF2A2V (ORCPT ); Tue, 28 Jun 2022 20:28:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbiF2A2V (ORCPT ); Tue, 28 Jun 2022 20:28:21 -0400 Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8747921E1E for ; Tue, 28 Jun 2022 17:28:20 -0700 (PDT) Received: from integral2.. (unknown [180.245.197.13]) by gnuweeb.org (Postfix) with ESMTPSA id 383367FC83; Wed, 29 Jun 2022 00:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1656462500; bh=9EOHqqHpHFrcRI3qCFB5ehouMVS1GD7Rg5Ue47izIqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cNUES0/9C3ryep2qXQRP1ZZRfjfm6gdBKZDVy+KqY9KmuabqwQ8ACQq38+XCVGE8h tuKgKA/EoZ87LXKdhpuhG85rRUcy1lAJRMmeE3iTZiyHru2BGYTtCGNIwgLEkJie9U dCUdawaQEhWC8Zd/cn2PJQ1YgWexyjZPYXDloqxZISyLQaUz6Kz1vkvQSsdTXTN4Kr 1iLeC3CIxv3GhghvQdGkaiDQeKq8zdU/wECCcRFhLObrKBsiNKK3mrG7bho6wXsEUg Z5b1ChEr2CRkOpLGpgwGuhA5vflln13ALsaJ/neLm/GFzTCNgn+SFz02QITS0+gg4M v76/uvSvv2R7A== From: Ammar Faizi To: Jens Axboe Cc: Ammar Faizi , Alviro Iskandar Setiawan , Fernanda Ma'rouf , Pavel Begunkov , Hao Xu , io-uring Mailing List , GNU/Weeb Mailing List Subject: [PATCH liburing v1 2/9] setup: Handle `get_page_size()` failure (for aarch64 nolibc support) Date: Wed, 29 Jun 2022 07:27:46 +0700 Message-Id: <20220629002028.1232579-3-ammar.faizi@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220629002028.1232579-1-ammar.faizi@intel.com> References: <20220629002028.1232579-1-ammar.faizi@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org From: Ammar Faizi This is a preparation patch to add aarch64 nolibc support. aarch64 supports three values of page size: 4K, 16K, and 64K which are selected at kernel compilation time. Therefore, we can't hard code the page size for this arch. We will utilize open(), read() and close() syscall to find the page size from /proc/self/auxv. Since syscall may fail, we may also fail to get the page size here. Handle the failure. Signed-off-by: Ammar Faizi --- src/setup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/setup.c b/src/setup.c index d2adc7f..ca9d30d 100644 --- a/src/setup.c +++ b/src/setup.c @@ -336,6 +336,9 @@ ssize_t io_uring_mlock_size_params(unsigned entries, struct io_uring_params *p) } page_size = get_page_size(); + if (page_size < 0) + return page_size; + return rings_size(p, entries, cq_entries, page_size); }