From patchwork Thu Oct 20 03:20:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 13012586 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CAB4AC43217 for ; Thu, 20 Oct 2022 03:24:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Q/E0ZY+WJzAN4kmH3WG6CKTtzh7VmSJIpPm/lx373Z4=; b=fDJLrcBKP2V21O TqA6eNPXSgt30uPzlDZFf0RlxlyR20E/suiuQnIz/Td8U31NNZy7pyCloUtTP60UteRvNyr27T2cf xYq8zF9Hmvia7JHgc2FFd47gJDGu32H1PAeB4Kd3+MwHZtpTcAevbcVZEajddKXLGTl/JGVYi0Mrj 96GjvcwLTtqlxQ2qvrjeBMRxclLf6Y9nk3wf336oyYeBep0Ee/TxlacXeN6W/QWtHvNx6Amtcfv0E 39zOkMidiyECZyDZOFjDCA+3rOi0puEXG5B7f+Kg/zFUtWv+Oupifd+WgWBaQTUglSXs5OqrFOCrL KDFHcW+4E+5ojf9qXu5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1olM8t-009wAQ-9u; Thu, 20 Oct 2022 03:22:47 +0000 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1olM8q-009w9q-1S for linux-arm-kernel@lists.infradead.org; Thu, 20 Oct 2022 03:22:45 +0000 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-134072c15c1so23109527fac.2 for ; Wed, 19 Oct 2022 20:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XZo2P0btegWzJjzezfawR0r1cS5ypDKFjzgQbfC4/vQ=; b=XB/FWk7GqUsa9t0mEGZQrGtNDBVz24LAJAge3DYogCxHXy9qgpHxwopFhZO2US4vQc aZTz1DPlSinA0LEC4Sa00ZTxeh/0HHs8U+W52L2C1c5y5e8GM07o5fBXhECIzVcZPBCa P9MAaSckHuZJS8aJ0mORgERwKUiFDe8ZwfAXJ2nV5F/IybzbIs7xmOkgM/UbjxcWBUZA si/EEMGGuLQU+sangBokqcTPuldoXiOGkVGx+iLkMw3op+Qf8JWLy426CMIi6B4bqVqX dVDFnn8vVv8AbfAm13EurfhSOdeecbOc5FExU66tymM7vBcUyHH3NYXwouxZ2gvOj81o 92Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=XZo2P0btegWzJjzezfawR0r1cS5ypDKFjzgQbfC4/vQ=; b=fGb8y8cY1bECw4dddlhotzR6sfyANOZauzhfYNQjp01DkFl+jGRlhCY12hca+847um cIVR6W+JaUREJ5o7r0RKvffUh33JGGmOIIC5O6LJr3kXTj4RcmUX0rJlDvicWgEg6vTu tByXPBAwarb68uOVqIlWf5qSmMYqiyca7VEglCpee+R9oD+1yFK+EEzIBp7ijkQQ9wKe NcMKHZtYjU0iX+doKHt+oY/IyUeZ9WYqTi5kxD1PN2QW0TnpjZxdElvS7171MmwW9sPT eoQuZbzJR13BUcwGqzNZF/7GTcYhC3BO/qbSLtLKtB+/qopprE3rx0Vt79yCKL8fnirw zNLA== X-Gm-Message-State: ACrzQf0yRbwhJSoV9v5+ldr/mQE1JLr5fuV23eGnpCRJGQ448LprZ3PR JSF+4WihLNcOWM5Z67p14m/e/XWL9Eg= X-Google-Smtp-Source: AMsMyM4AaB2l+THPi7j2p1SeZ7w0ABcLBVqTmvJey6coQB8VRdU/jFmzlPitgDAYh2l3ZasYT5WKAQ== X-Received: by 2002:a05:6870:41ca:b0:12b:9637:1cda with SMTP id z10-20020a05687041ca00b0012b96371cdamr7307113oac.114.1666236162649; Wed, 19 Oct 2022 20:22:42 -0700 (PDT) Received: from localhost ([12.97.180.36]) by smtp.gmail.com with ESMTPSA id a19-20020a056808129300b00354b619a375sm7596815oiw.0.2022.10.19.20.22.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 20:22:42 -0700 (PDT) From: Yury Norov To: "Russell King (Oracle)" , Catalin Marinas , Mark Rutland , Will Deacon , linux-arm-kernel@lists.infradead.org Cc: Yury Norov , Linux Kernel Mailing List , Alexey Klimov , Andy Shevchenko , Andy Whitcroft , Dennis Zhou , Geert Uytterhoeven , Guenter Roeck , Kees Cook , Linus Torvalds , Rasmus Villemoes Subject: [RFC PATCH 0/2] Switch ARM to generic find_bit() API Date: Wed, 19 Oct 2022 20:20:22 -0700 Message-Id: <20221020032024.1804535-1-yury.norov@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221019_202244_122415_7BF395D6 X-CRM114-Status: GOOD ( 17.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Russell, all, I'd like to respin a patch that switches ARM to generic find_bit() functions. Generic code works on par with arch or better, according to my testing [1], and with recent improvements merged in v6.1, it should be even faster. ARM already uses many generic find_bit() functions - those that it doesn't implement. So we are talking about migrating a subset of the API; most of find_bit() family has only generic implementation on ARM. The only concern about this migration is that ARM code supports byte-aligned bitmap addresses, while generic code is optimized for word-aligned bitmaps. In my practice, I've never seen unaligned bitmaps. But to check that on ARM, I added a run-time check for bitmap alignment. I gave it run on several architectures and found nothing. Can you please check that on your hardware and compare performance of generic vs arch code for you? If everything is OK, I suggest switching ARM to generic find_bit() completely. Thanks, Yury [1] https://lore.kernel.org/all/YuWk3titnOiQACzC@yury-laptop/ Yury Norov (2): bitmap: add sanity check function for find_bit() arm: drop arch implementation for find_bit() functions arch/arm/include/asm/bitops.h | 63 ----------- arch/arm/kernel/armksyms.c | 11 -- arch/arm/lib/Makefile | 2 +- arch/arm/lib/findbit.S | 193 ---------------------------------- include/linux/find.h | 35 ++++++ lib/Kconfig.debug | 7 ++ 6 files changed, 43 insertions(+), 268 deletions(-) delete mode 100644 arch/arm/lib/findbit.S