From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47502E74919 for ; Mon, 2 Oct 2023 19:50:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BFD1F6B0182; Mon, 2 Oct 2023 15:50:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BAD1F6B0183; Mon, 2 Oct 2023 15:50:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A75EF6B0185; Mon, 2 Oct 2023 15:50:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 938726B0182 for ; Mon, 2 Oct 2023 15:50:42 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 5B2AEA0419 for ; Mon, 2 Oct 2023 19:50:42 +0000 (UTC) X-FDA: 81301563924.18.AF926C6 Received: from domac.alu.hr (domac.alu.unizg.hr [161.53.235.3]) by imf03.hostedemail.com (Postfix) with ESMTP id 8120C2000E for ; Mon, 2 Oct 2023 19:50:38 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=alu.unizg.hr header.s=mail header.b=loLzo1Hz; dkim=pass header.d=alu.unizg.hr header.s=mail header.b=R8SWSfAz; dmarc=pass (policy=none) header.from=alu.unizg.hr; spf=pass (imf03.hostedemail.com: domain of mirsad.todorovac@alu.unizg.hr designates 161.53.235.3 as permitted sender) smtp.mailfrom=mirsad.todorovac@alu.unizg.hr ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696276240; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vHgSr36Q7A9L8UpbajbttSpLu184BRVxsF6NNmhr0/A=; b=ih2zV2ZTnAkK6zkqZFt0MMUKNiMFHB5sgpv7o2wK4PCLcAW3nyMX06bSARCZAUwcJiMk9U omX75LkG5FfIrVERI6Xnj7OTZzSYZVGGm7jZRVDaOnqX+u6E5AxBGoCfcb/YM7Y+Y/gA8U qZ6IwZtjendLzmkjbidt8qZEn3h8Afw= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=alu.unizg.hr header.s=mail header.b=loLzo1Hz; dkim=pass header.d=alu.unizg.hr header.s=mail header.b=R8SWSfAz; dmarc=pass (policy=none) header.from=alu.unizg.hr; spf=pass (imf03.hostedemail.com: domain of mirsad.todorovac@alu.unizg.hr designates 161.53.235.3 as permitted sender) smtp.mailfrom=mirsad.todorovac@alu.unizg.hr ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696276240; a=rsa-sha256; cv=none; b=ItlumnoxU8t5p/N6hud1EfVqCKcIXouphDj7H67VVcrtMcwbqwwghfhB9h7SuxMUWPUZA1 +mzllFqAA2nrezNswhPI760g29nrAxVs2cmAa84xCvB7UPLaacw9/ZP0EkVwtsVGZE3MP9 UCpyfdYW4hXl728eavjhSqfD6s+ln2w= 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-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 8120C2000E X-Stat-Signature: e3omyree91h1m3eko1xocpbf3h6711uo X-Rspam-User: X-HE-Tag: 1696276238-446667 X-HE-Meta: U2FsdGVkX1938NtZNXAHVOvkh6PKqngakzMv6v2WiVmKAmJCfD1RvZR0FWEhokscrvV9vzlcUGQj+cx2dBan5J2rx3/UrAE1KUvfE4WAz0pbLJeh8ayfxsYfU+rU9SX7hQdtqHRcT/IGX0mdZxShrHlg6Jkbc1J6IgaYtt8l62cCFfuO/Y4OExvM7nxgQVm1xVPxwCbMfVSc4x0cj0XGis12V3zgrx0Y5skyzYrxVm/hz5otW2VLQqBhMfxHTNJGK3r1Qxf6rdQOvU1QTW1fTUCBXg16K2pBf2tQziaIUzMTDkE9fogcPrvTYjbAODefrAjjcIGeIUunao2Afur7AVc9b/4KmYUOYfhP34E22T0RqrmMLjNoLGOV34db1lXjzqnvB5qzXAeWHxpAJ6ezdha138IIfY5cIa3SQUUVR5HHqRqzpIqrH+Juqy0ojActZhYt8bSjnQONNff8ScBcDokomHkAqt4ORfXIKsjW6L4N58kHmaQS8p2hpr9Z7TBKzrKbspDmmbBsyFjgwqqibKRLdnxDQcJsRCguWEEYaZE+VfLdg/hOB/W6P8X8KGuy4ZHuyVGMOZLAYi8GAkuWfAOVlIqjXcwuW4NGaYoHwST0I3r4NEz9qDVn2pA7IAQLyAd1V64H6AyDGCGo4/8ks2PFbacQaIl1tbA71+tlUM/FfsdFeS79pE96+aXysGQVpGdGTwReL1ThpnPx5sLYnVThKMWxzWTuHPThLM+ZiuO2hez/DvkNufUlcDFZkR+mwdQnlftos4yAIIEzbKn4pCj2DAYxx7dMdTS6eHoWdF8B9l61Z+EZuhpWnFx6kOYtNaVpTbt68nO8FsTXBfnIhRVaPWwoIU35gd0rsUiAmDQ8Fz7fhpKF5DaCIYPA8BWtmoUu1NvSXJD5CzBQhdMls0dGqba5OB41Heb/hu9eXeucevBptM9attZ2zLFo1CU/pcGba6Ig7x47sNVsNVh VBGIqV4e Msr/g5L52/CxjyyQMcobEgCqfSJ/zsjFUkBqaPhKvLsuXtp9oc9PVlLBWKNzf+29b1DGPnEhfqdsMn3nyxNWUL4Oka9YS1z93GEB4aTOq9N9FLykGxHwEXW3CYAbYVA2BGt3/va6QPn/vG/9DAYfTkOEzyMz8Asmj+DjPolpOrGI7QLWwLxJfWyQrJc3//ddVhYnVIe4s9n4iVYICWPAD+EbBqv/HaQPyiMv3QzYBLaoKK5XZxgwzXD/F/eFxyHo+DB7e X-Bogosity: Ham, tests=bogofilter, spamicity=0.099842, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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