Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1030344rwe; Wed, 24 Aug 2022 13:32:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR6DlMOf77NyZ6zjdvB8i72agGet08G5sTRtWaMnDPTUgMt9AmczdqalwtPJNGgy1ae15+Js X-Received: by 2002:a17:903:2d1:b0:171:3773:b95 with SMTP id s17-20020a17090302d100b0017137730b95mr470042plk.173.1661373150740; Wed, 24 Aug 2022 13:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661373150; cv=none; d=google.com; s=arc-20160816; b=hXRzTGLFrXTbSiqvHWYfkqHAThrryhhp7E/TzfLh0q6w/2/Apzt8aAsnWM2plow0zL xwkSrsJ902A001j9cFGcUEVqkpYyPCqRSjZap47mBQ36nCqflk4cG+KAqRUdA9Vlqput q0t7QcYkmVRACf6d0IJroQTOZdNgtMPKU4unmS8gJIL8lYVIoGBQrtrF74oMMTjI+Ea2 reaX2iNorzMyX3PgO6y58/sRz1JCICYdSTOaYzbQpeHOR85Yw2/VyT+IsvLiwehlty6y E1PtZUPxtkpii5sizJHeTtdrfx3b6LhSaHT+0CTFHPGlZE5WH0RwwzYKqhfP/tHtrN4C fyow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=I/OhQ05sFa4+JbagejiMcd2839cYv/Wn8Ivi9z3/4j0=; b=bzhf8j1eoNcOhcF7oQCvSA9zqPZz3+5CzO98NaKD3vMVzKdmXK2LAAoJP25vqspjpH lbjXutF59QAE4WyXWe7b0vcyY4mUREtrjgCnJSxfBdNxJum5wvvth8do4XYeu/SOc9J3 W4Q8QQVlUpXoU2p4kXwLBvjB/mTaMOLVePrcKRYkQ5rcYGEW9oJDngjYHBMeVzOfOiUC AaXeaJESkp27GBGKNN0t3+cjuycesqqHrlo+lIQMjPRSsR2A84zdrRSJj68xJ6uY9uxw kYW8LFzuOpqledQt45bumBX9kyVzeE5wTw2ur1KU7Amute1gIdYbGXBOiT2xXjuF/R1D dAiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=F7kiYdCF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j190-20020a638bc7000000b0042adcc6792asi6135136pge.728.2022.08.24.13.31.24; Wed, 24 Aug 2022 13:32:30 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=F7kiYdCF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240076AbiHXUDv (ORCPT + 99 others); Wed, 24 Aug 2022 16:03:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233529AbiHXUDs (ORCPT ); Wed, 24 Aug 2022 16:03:48 -0400 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E73FE7C1F9 for ; Wed, 24 Aug 2022 13:03:47 -0700 (PDT) Received: by mail-qt1-x82b.google.com with SMTP id j17so13630235qtp.12 for ; Wed, 24 Aug 2022 13:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=I/OhQ05sFa4+JbagejiMcd2839cYv/Wn8Ivi9z3/4j0=; b=F7kiYdCFyT/ZhldrVONseUJBHjLD7mzVSGdd5XX79poudK3LGXfpYWvrgCXmfoAyTr dwgT+0VvkgBM5iNF0eIP3BWPYNYtj32Je4xKe/Gh5QJWBWaPMQT/CxNDDN7kZMBWPCQ4 DyuoG6hYvspPJ7TkBNHnO0QlbaMqtPjCEAEDB2FaAoHxwX+1y/dG+dRgzw1Y59p7bM9l scPThZAL9W10zGjFN6CbuJawuKQHsg2nT1oaQhzuKSfNYvwJJw2VL4mOtadHP1l92Y/F j7AD/a1NPTurHq+nXuLj/GiFRTC5EQb7rDZqJP+K0tcsISrL2uP4ssTGNx1OAJrNivNB 4Qcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=I/OhQ05sFa4+JbagejiMcd2839cYv/Wn8Ivi9z3/4j0=; b=hBo8aKRMvLKNlwg0Oq7v6lFnclmtmLPapDcftVX7oa8T/onnmZjvs4kpDY84v6blUS yVKS7BMhQHZIFs7bSKTQTMb8qv4UwRPgdlaYfDtvk+W1mAtEUtm6xR8F0ZE2+OXa0RIu 9CQnDipo4n9eP4Qoq/EkS++nOBWm61sNsyFN0dg+rko+CmsC/tZq9ndo/qYgwp/N7JgK 1XLxwdBr70kCwSLhpwfWiQcWNtl3+I8vvXDXi5Yyt9ZkSNnTEX+7rjMUq5DffhpRNmu2 oS05cV7yumwNgxlhwKAuJlMicT3Qop+NhPkFTVGF8/lDG0LpVGjj/hdE/ybzLtVdlgfg xyhg== X-Gm-Message-State: ACgBeo3UvPOWvZXHl24D+Mw2pEPRLDxJvScf/mJ1/BieWPghWpfQHmRL /jVj8dUixY3DXsTBE2iH7D6Wo32xBcM= X-Received: by 2002:ac8:5ad4:0:b0:344:5e40:7824 with SMTP id d20-20020ac85ad4000000b003445e407824mr877705qtd.482.1661371426996; Wed, 24 Aug 2022 13:03:46 -0700 (PDT) Received: from localhost ([2601:4c1:c100:2270:5a54:d9d9:c2a4:527e]) by smtp.gmail.com with ESMTPSA id d17-20020a05620a241100b006b46a78bc0fsm17001073qkn.118.2022.08.24.13.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 13:03:46 -0700 (PDT) Date: Wed, 24 Aug 2022 13:03:45 -0700 From: Yury Norov To: "Russell King (Oracle)" Cc: Andy Shevchenko , Linus Torvalds , Linux Kernel Mailing List , Guenter Roeck , Dennis Zhou , Catalin Marinas , Andy Shevchenko , Rasmus Villemoes , Alexey Klimov , Kees Cook , Andy Whitcroft Subject: Re: [PATCH v2 2/3] lib/find_bit: create find_first_zero_bit_le() Message-ID: References: <20220824012624.2826445-1-yury.norov@gmail.com> <20220824012624.2826445-3-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Wed, Aug 24, 2022 at 06:58:10PM +0100, Russell King (Oracle) wrote: > On Wed, Aug 24, 2022 at 06:37:45AM -0700, Yury Norov wrote: > > Because there is a codebase that relies on existing types, mostly in > > filesystem code. And those fs fixes would require 5 or 6 patches. > > Does that mean that are there filesystems that are passing pointers to > the find_bit functions which are _not_ aligned to an "unsigned long" ? Not necessarily. For example, I looked at ext2/4 code, and it looks like they need void *bitmap, because they pass opaque pointer ->b_data from struct buffer_head: struct buffer_head { ... char *b_data; /* pointer to data within the page */ ... } So, quite probably, the pointer is aligned when it points to a bitmap. But I have nothing to prove it, except standard anthropic principle "otherwise people would complain". In LE case, the find_bit_le() functions are aliased to find_bit(), which is aligned, and somehow it works. > If there are, we should _not_ convert 32-bit ARM to use word loads or > use the generic code; unaligned loads are expensive on older ARM CPUs, > at least not the code for older ARM CPUs. I wonder, if there's an arch that throws an exception in case of unaligned access. IIRC, ARM can do that, but this option is disabled in kernel. Right? I have a series that adds a runtime parameters checker for bitmaps. I'll add a test for alignment and see how it works (not very soon). Thanks, Yury