Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3615069rwb; Sat, 3 Dec 2022 07:43:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf53CJ463rlYPkNxw9ZcSrRa/W/oSsqw2Ik4aBHlIC8HWbm3u+Z+zP60dC+XjQKuYniDraGC X-Received: by 2002:a05:6402:1015:b0:461:5f19:61da with SMTP id c21-20020a056402101500b004615f1961damr67407387edu.34.1670082225468; Sat, 03 Dec 2022 07:43:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670082225; cv=none; d=google.com; s=arc-20160816; b=KED4bKAshdbN2S/QpJBvbOvKd0oLUimtPX4F7lJhzXb9aWp4HzarM/LB8VH9W4LPVP OvqsiSl28yqoIiDwJgqjnJ4m7qQBATBLD/vZ690Eb1KB6UY7aGFCgzSb6++F4YSKIHpc 6t78dkGf9OhSMKGsIYFboaX06aKx8GZmMdXNjPE1KtcVObqMUOpUJKMaJKkzi1ORrCGn wa+VLQlMIqLEYOE6qXjtV55mo9U8xMnHgK5p0OAeg+k3ufHruv4r1VdbrHQfOHHK0vU4 1VuxCI4q7TKbU62DivF3Uy5+024Lt7Tc6clttLxqYZqoQ/PpMO8M/mcJeq6zitQtIqro Jgfg== 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 :dkim-signature; bh=8+/C65NBDY0v0RW89Yk+KvRuOiE5ckvyFprjWMjz5YY=; b=M/txC1H4HG+Mb7TczVbetkzNJ9uV4sZtqvH43f6wWPI5EFJlFJxzZZuQmk2rIEAuRc KbSUalqvsnNs23V4ZmdEIfyLr73H3cy8MPDBM0P4+XI4C5zNM5WxOj8TpxSP5ZoQSupr CN+6atzJu+YW42qsLlZaoRuDQneOS2/N2dBd8bl+mqBq2Uz7YAX7KPlRR85i6AYSnUWO MF6cQqmqtl3UDpcOp5fqOw8XdnbrhX9TY4eZL4ZEouws19CCvArf8htuTMvdLLRdqKfP W+YouHFRzqy5TidjEcaug6GXwisN3LmlYYWCg7XskzkPwqaxW9G/Ykv36Q3yNN0okFA1 +pNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=CW1cjt68; dkim=pass header.i=@codewreck.org header.s=2 header.b=unUT9ds9; 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=NONE dis=NONE) header.from=codewreck.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cy1-20020a0564021c8100b0045731196587si8080218edb.64.2022.12.03.07.43.24; Sat, 03 Dec 2022 07:43:45 -0800 (PST) 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=@codewreck.org header.s=2 header.b=CW1cjt68; dkim=pass header.i=@codewreck.org header.s=2 header.b=unUT9ds9; 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=NONE dis=NONE) header.from=codewreck.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229781AbiLCPhN (ORCPT + 83 others); Sat, 3 Dec 2022 10:37:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbiLCPhL (ORCPT ); Sat, 3 Dec 2022 10:37:11 -0500 Received: from nautica.notk.org (ipv6.notk.org [IPv6:2001:41d0:1:7a93::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9490F1F9CF; Sat, 3 Dec 2022 07:37:08 -0800 (PST) Received: by nautica.notk.org (Postfix, from userid 108) id 25FCEC01E; Sat, 3 Dec 2022 16:37:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1670081836; bh=8+/C65NBDY0v0RW89Yk+KvRuOiE5ckvyFprjWMjz5YY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CW1cjt68c+e+aLbFm/Hd+zg5T723ITNKM4oL9pXH7tX/3qJy8/xBn7qsoseb3vUDz 8vmAipTmn1kUqid6cLwGoeMRWWJZKpNx2v2j5auUttm6EmEkdkCCx3St2+6znHjPXI Yvu5CW2sZN1CvsLtrM+XGocyMiiHMDW5ABbyz5dI00XMxBGmVo3/AEvpHtmdz1wbcI yFy9clMPgVdFHJhYV4YoJ830ZLIe0Wiat3a1mKxxrsaijutklJ2Bc3opxH4NSw+F+w 0V6l7K5Vo7KX6pz2qZntjYKtRJdYnT0zeLBDHaZKTUwJNdGny2PfCuxFQOjx5TWB+J 0idfhT4O1u4Lw== X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from odin.codewreck.org (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id 2E939C009; Sat, 3 Dec 2022 16:37:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1670081834; bh=8+/C65NBDY0v0RW89Yk+KvRuOiE5ckvyFprjWMjz5YY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=unUT9ds9jwb7N2eFG2l0ezPdfPT81KpA2/D1yP7SF/l5CMRgazxYY1QeentuSRybK SF5eh9B/w19EvVvhhfSNJtX4uE6BriBMdHqwjKZ9ehVhbBNrobwmaQ8staVrder6Ir 13SGtmObM2ALaBCcPtWP9eK6kQFjEpcelWiEUTQbvvG9PINb2KLmvwOedOjHGMqQ4j w5C0ltVpOO5yH60WwwtSTq+x7R+ZssmBrnqYm/2f9Yb8yQJd7QMTZSwUkk4mOSsjRe t3sKZm5ISTokpMT4ttdsDNKUytQK2SeQnh7wLBvJQCtnS8lKC3MbHV+0/ilbBIRMuO GNpo4kKouoS6A== Received: from localhost (odin.codewreck.org [local]) by odin.codewreck.org (OpenSMTPD) with ESMTPA id 2ef2e6a7; Sat, 3 Dec 2022 15:36:58 +0000 (UTC) Date: Sun, 4 Dec 2022 00:36:43 +0900 From: Dominique Martinet To: Naresh Kamboju Cc: Marco Elver , rcu , open list , kunit-dev@googlegroups.com, lkft-triage@lists.linaro.org, kasan-dev , "Paul E. McKenney" , Netdev , Anders Roxell Subject: Re: arm64: allmodconfig: BUG: KCSAN: data-race in p9_client_cb / p9_client_rpc Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (reply out of order) Naresh Kamboju wrote on Thu, Dec 01, 2022 at 01:13:25PM +0530: > > (You might need to build with at least CONFIG_DEBUG_INFO_REDUCED (or not > > reduced), but that is on by default for aarch64) > > Thanks for the suggestions. > The Kconfig is enabled now. > CONFIG_DEBUG_INFO_REDUCED=y It looks enabled in your the config file you linked at, I don't understand this remark? Did you produce the trace the other day without it and rebuild the kernel with it? In this case you also have CONFIG_DEBUG_INFO_SPLIT set, so the vmlinux file does not contain enough informations to retrieve line numbers or types, and in particular addr2line cannot be used on the files you provided. I've never used split debug infos before, but digging old threads I'm not too hopeful unless that changed: https://lkml.iu.edu/hypermail/linux/kernel/1711.1/03393.html https://sourceware.org/bugzilla/show_bug.cgi?id=22434 (...a test build later, it's still mostly useless... normal build $ ./scripts/faddr2line vmlinux __schedule+0x314 __schedule+0x314/0x6c0: perf_fetch_caller_regs at include/linux/perf_event.h:1286 (inlined by) __perf_sw_event_sched at include/linux/perf_event.h:1307 (inlined by) perf_event_task_sched_out at include/linux/perf_event.h:1347 (inlined by) prepare_task_switch at kernel/sched/core.c:5053 (inlined by) context_switch at kernel/sched/core.c:5195 (inlined by) __schedule at kernel/sched/core.c:6561 split dwarf build $ ./scripts/faddr2line vmlinux __schedule+0x314 aarch64-linux-gnu-addr2line: DWARF error: could not find abbrev number 860923 __schedule+0x314/0x780: aarch64-linux-gnu-addr2line: DWARF error: could not find abbrev number 860923 __schedule at core.c:? I'd tend to agree build time/space savings aren't worth the developer time. ) Anyway, address sanitizer used to have a kasan_symbolize.py script but it looks like it got removed as no longer maintained, and I'm not sure what's a good tool to just run these logs through nowadays, might want to ask other test projects folks what they use... > > If you still have the vmlinux binary from that build (or if you can > > rebuild with the same options), running this text through addr2line > > should not take you too long. > > Please find build artifacts in this link, > - config > - vmlinux > - System.map > https://people.linaro.org/~anders.roxell/next-20221130-allmodconfig-arm64-tuxmake-build/ So from the disassembly... - p9_client_cb+0x84 is right before the wake_up and after the wmb(), so I assume we're on writing req->status line 441: --- p9_client_cb(...) { ... smp_wmb(); req->status = status; wake_up(&req->wq); --- report is about a write from 2 to 3, this makes sense we're going from REQ_STATUS_SENT (2) to REQ_STATUS_RCVD (3). - p9_client_rpc+0x1d0 isn't as simple to pin down as I'm having a hard time making sense of the kcsan instrumentations... The report is talking about a READ of 4 bytes at the same address, so I'd expect to see an ccess to req->status (and we're likely spot on wait_event_killable which checks req->status), but this doesn't seem to match up with the assembly: here's the excerpt from disass around 0x1d0 = 464 (why doesn't gdb provide hex offsets..) --- 0xffff80000a46e9b8 <+440>: cmn w28, #0x200 0xffff80000a46e9bc <+444>: ccmn w28, #0xe, #0x4, ne // ne = any 0xffff80000a46e9c0 <+448>: b.eq 0xffff80000a46ecfc // b.none 0xffff80000a46e9c4 <+452>: mov x0, x25 0xffff80000a46e9c8 <+456>: bl 0xffff800008543640 <__tsan_write4> 0xffff80000a46e9cc <+460>: mov w0, #0x2 // #2 0xffff80000a46e9d0 <+464>: str w0, [x21, #88] 0xffff80000a46e9d4 <+468>: b 0xffff80000a46ecfc 0xffff80000a46e9d8 <+472>: mov w27, #0x1 // #1 0xffff80000a46e9dc <+476>: mov x0, x23 0xffff80000a46e9e0 <+480>: mov w1, #0x2bc // #700 0xffff80000a46e9e4 <+484>: bl 0xffff800008192d80 <__might_sleep> --- +464 is a write to x21 (client 'c', from looking at how it is passed into x0 for other function calls) at offset 88 (status field according to dwarf infos from a rebuild with your config/same sources) So, err, I'm a bit lost on this side. But I can't really find a problem with what KCSAN complains about -- we are indeed accessing status from two threads without any locks. Instead of a lock, we're using a barrier so that: - recv thread/cb: writes to req stuff || write to req status - p9_client_rpc: reads req status || reads other fields from req Which has been working well enough (at least, without the barrier things blow up quite fast). So can I'll just consider this a false positive, but if someone knows how much one can read into this that'd be appreciated. Thanks, -- Dominique