Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1546962rdb; Mon, 2 Oct 2023 13:03:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEIV7u393Kx7Aw26n5cCVKehlvqIkyzZn1N1E73Csnb9WE990UAkzjL76fxFOCi9QbhviEx X-Received: by 2002:a05:6a00:23c2:b0:68f:dfea:9100 with SMTP id g2-20020a056a0023c200b0068fdfea9100mr16920433pfc.21.1696277005724; Mon, 02 Oct 2023 13:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696277005; cv=none; d=google.com; s=arc-20160816; b=BVFRh8Ym3tGKLyR9STn0w0ud8onl50j6OI8O9II1FD+V+OscYxwef3iWGxv9dKt5qt 7771ukSFJfzlCxQ2687FSlFuhF8V1p6ZX8nVFwy/pBMJqek4fDX1MUvmZmwSmjjzNwxY n+XZA8+Ih9EQhboEvWNd0Udv1nXOjsGzZ4KMfsV/38Rspx2JugvXYq/54Xk/9yA3DfoW 1jk8RQdJJVNcdNmd0PjAxKaKg4zWbunWCXaEuS0JPNr5lS6wcZ3i6AcfxqBRgGQ2xZYz lBjHYLpQBoY27XdMI3AR21ptjvj21Fbdne3bifd+9sCyRpVBg9LnZyqiUhJSCXtie5vg IvOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=vHgSr36Q7A9L8UpbajbttSpLu184BRVxsF6NNmhr0/A=; fh=3kxp3wC7fPgLQSq4riAlzTioqdNj99fHvbXUSFd+B9A=; b=JKSi7UkkRJvIsUGQeH8jV2f9BFOxGvYwkvFJuvxYMqgkneqrnhcOWVel6NQNw44RkF cPyARwMW2EDmolFk/u5aGxkZm6vixNJZqtS9Jmpv8WeXNLRxMCQbE0JVZdaUncSKP4tk 2D3bKE+H3+ADYkhSz9fDlPfxyGqO0erf17DpLiWYPjg6IsUV0QxgL4YP+gf/UAuJpFCV DQA4O/V97yOInr1YzPZ6k37fCrrGuBs5n1WOEeyfKByHisKpsBZL/QbGQbkFvz7KvKEP w7P72GVqCgSIaL+666IVe8SLUJ29QRoPvA/wCp7dQOnCtWnB7HTGq3eXBKqAQfzLIFdM EuaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=loLzo1Hz; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=R8SWSfAz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id cj24-20020a056a00299800b00692d2e3129bsi22164101pfb.239.2023.10.02.13.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 13:03:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=loLzo1Hz; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=R8SWSfAz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D03A4807C7F8; Mon, 2 Oct 2023 12:50:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238935AbjJBTum (ORCPT + 99 others); Mon, 2 Oct 2023 15:50:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjJBTul (ORCPT ); Mon, 2 Oct 2023 15:50:41 -0400 Received: from domac.alu.hr (domac.alu.unizg.hr [161.53.235.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2361791 for ; Mon, 2 Oct 2023 12:50:37 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by domac.alu.hr (Postfix) with ESMTP id C9DEF60171; Mon, 2 Oct 2023 21:50:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1696276235; bh=PdHjwL1WGxFjLAs5xkBLB9K3ip5pkE/ZhbqCR/dn5kg=; h=Date:Subject:To:References:From:In-Reply-To:From; b=loLzo1HzXfAn8PuT7klzHQF8anAu0c28BRNZuQDxApI/MUA5PVLRHt6JgkhdUGWao tX9jJnzPsd7xkXiVULItIJv81lkPJ11I8gO/+8lHgVxWbbnucUChXwgxx4owqNrWNB BTcXeb+hw0N9ckDnwvgq9p50NQRiPeEnpPbNGCycXLqzdBIxXHN2yi3JoKzvtRu8qb e8fwBC3wi4ydn8o5p0AZRy8hyELJuD3HuJt5j/ptDGr5ekoUUEKaWhijHSMBwI/jIr RPHBGm2TfPBaj4xQZWp1dQr5m38VF4iKY2+ggkn9vHkXut3z+9kOvYIn3vP8HavAPx Nki/8LZlglwfg== X-Virus-Scanned: Debian amavisd-new at domac.alu.hr Received: from domac.alu.hr ([127.0.0.1]) by localhost (domac.alu.hr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k2HKfI_psZjV; Mon, 2 Oct 2023 21:50:33 +0200 (CEST) Received: from [192.168.1.6] (78-1-184-91.adsl.net.t-com.hr [78.1.184.91]) by domac.alu.hr (Postfix) with ESMTPSA id 076666016E; Mon, 2 Oct 2023 21:50:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1696276233; bh=PdHjwL1WGxFjLAs5xkBLB9K3ip5pkE/ZhbqCR/dn5kg=; h=Date:Subject:To:References:From:In-Reply-To:From; b=R8SWSfAz/uhUwSx5/3Zsj+hab1aXv1VRXu8P0OOFZ6npR0BT5TRwvPYqbYTwF/bc6 3hcMW0umqDbmAm14ZHNLVojtBlnnQyutbIYEmfg8/l2o+XyOuWAz1rYUcHPZ5X7nGW KZZtCCfhyvPfpGmysKKSchfYOJwjWveUqhD0f1LQqnXBolG7nUGOfl5sHIwHDuR93p EomFMD1L12AMQckA/MnqV7GpGgWE4GDA5zn7J7qwNueVGHnVXG0crJxxezqgLd8+3x d6A6NUuXyLYGNt3WAUgqd64FrlJ95Ob8RtgUbuOyThzNrqwuNpnrajNHGkG9rXY59e WkrWAJ2UgknMg== Message-ID: <479379a1-110d-4543-89f0-cb584b74ce22@alu.unizg.hr> Date: Mon, 2 Oct 2023 21:50:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG: maple_tree: KCSAN: data-race in mas_topiary_replace / mtree_range_walk [EXPERIMENTAL PATCH] To: "Liam R. Howlett" , maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <9c1549f9-78c2-441b-8617-3ea3c080a5a4@alu.unizg.hr> <20230922135155.tqrelea66hcj5cog@revolver> <5d908c60-88fb-49c0-a150-bfb468eaa513@alu.unizg.hr> <20230928195926.ucp7it3c3c75erzk@revolver> <5a30110b-2457-4638-8779-baa33326f6a6@alu.unizg.hr> <20231002164310.bi62wfekacfxb3ve@revolver> Content-Language: en-US From: Mirsad Todorovac In-Reply-To: <20231002164310.bi62wfekacfxb3ve@revolver> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 02 Oct 2023 12:50:55 -0700 (PDT) On 10/2/23 18:43, Liam R. Howlett wrote: > * Mirsad Todorovac [231001 17:09]: > > ... > >> >> They say that one patch speaks more than a thousand words. >> >> I am just running this little patch that actually silences all of the KCSAN warnings. >> >> I cannot tell if these reported data races are the actual bugs, but it is possible that >> the Ubuntu 22.04 gcc is doing some funny stuff when optimising. In Prof. McKenney's >> book I've read about the load-tearing and store-tearing. AFAICS, memory barriers should >> prevent load/store reordering, but not the compiler optimisations. >> >> Please find two versions of the patch attached. >> >> While mas->index and pivots[offset] in maple_range_walk can change concurrently, >> I am not smart enough to see whether you expect that in your algorithm or is it a potential >> bug triggered by GCC optimisations and aggressive Ryzen 9 7950X parallelism. > > None of this is necessary, for sure. Thanks for your feedback. If KCSAN is giving false positives, there is quite a lot of them. I tend to believe on the safe side of the Prof. Paul McKenney, but it is your code. > I will have to look at this when I have more time to investigate. This > will likely not be soon, however. I see. I also have some tough stuff at my day job this month. :-P Have a nice day. Best regards, Mirsad > Thanks, > Liam