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 X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D922C282D8 for ; Wed, 30 Jan 2019 10:15:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D28820989 for ; Wed, 30 Jan 2019 10:15:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="g4jaFTcG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729498AbfA3KPn (ORCPT ); Wed, 30 Jan 2019 05:15:43 -0500 Received: from merlin.infradead.org ([205.233.59.134]:46844 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726476AbfA3KPn (ORCPT ); Wed, 30 Jan 2019 05:15:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=DEf9Fg7WwtHJCyiAMXbhgjjJCJkrj2iHIYxmzR3frnA=; b=g4jaFTcG3+XHAybLF8L7oFWiG SBwgasyg0CvJACUAMIdLM3mB3fOhKms/b8z1v99UKbTyRQgMriZfZo/RMowJZ2p8Ut8EApjkUFd2x l3ltqTgTUZg66myv+op6GpuotmWvx/5q4dSktyqziUOvAzlVG6Fb6heGQKcmLPWrLO/O5/M+OiDjq RhNb6EY2u9Wg9fpmEQSazBbYEqYLuThNYJmYKtS2WrfDXFXXg/UuHZ7+Qytau9RRH5y7j5Q7g3+p8 eXhHbXxy7RL4//i7grdru15ujN3v0ulL1UPOC7IaiOoHEYymvnCgelfbmRdnvQP6/JvuE7rtjQTu6 yJ4zFxD3A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gomu3-0007wb-OK; Wed, 30 Jan 2019 10:15:31 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 845892029D923; Wed, 30 Jan 2019 11:15:30 +0100 (CET) Date: Wed, 30 Jan 2019 11:15:30 +0100 From: Peter Zijlstra To: Alexei Starovoitov Cc: davem@davemloft.net, daniel@iogearbox.net, edumazet@google.com, jannh@google.com, netdev@vger.kernel.org, kernel-team@fb.com, Waiman Long Subject: Re: [PATCH bpf-next 2/4] bpf: fix lockdep false positive in stackmap Message-ID: <20190130101530.GE2278@hirez.programming.kicks-ass.net> References: <20190130040458.2544340-1-ast@kernel.org> <20190130040458.2544340-3-ast@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190130040458.2544340-3-ast@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Jan 29, 2019 at 08:04:56PM -0800, Alexei Starovoitov wrote: > Lockdep warns about false positive: This is not a false positive, and you probably also need to use down_read_non_owner() to match this up_read_non_owner(). {up,down}_read() and {up,down}_read_non_owner() are not only different in the lockdep annotation; there is also optimistic spin stuff that relies on 'owner' tracking. > [ 11.211460] ------------[ cut here ]------------ > [ 11.211936] DEBUG_LOCKS_WARN_ON(depth <= 0) > [ 11.211985] WARNING: CPU: 0 PID: 141 at ../kernel/locking/lockdep.c:3592 lock_release+0x1ad/0x280 > [ 11.213134] Modules linked in: > [ 11.213413] CPU: 0 PID: 141 Comm: systemd-journal Not tainted 5.0.0-rc3-00018-g2fa53f892422-dirty #476 > [ 11.214191] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014 > [ 11.214954] RIP: 0010:lock_release+0x1ad/0x280 > [ 11.217036] RSP: 0018:ffff88813ba03f50 EFLAGS: 00010086 > [ 11.217516] RAX: 000000000000001f RBX: ffff8881378d8000 RCX: 0000000000000000 > [ 11.218179] RDX: ffffffff810d3e9e RSI: 0000000000000001 RDI: ffffffff810d3eb3 > [ 11.218851] RBP: ffff8881393e2b08 R08: 0000000000000002 R09: 0000000000000000 > [ 11.219504] R10: 0000000000000000 R11: ffff88813ba03d9d R12: ffffffff8118dfa2 > [ 11.220162] R13: 0000000000000086 R14: 0000000000000000 R15: 0000000000000000 > [ 11.220717] FS: 00007f3c8cf35780(0000) GS:ffff88813ba00000(0000) knlGS:0000000000000000 > [ 11.221348] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 11.221822] CR2: 00007f5825d92080 CR3: 00000001378c8005 CR4: 00000000003606f0 > [ 11.222381] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > [ 11.222951] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > [ 11.223508] Call Trace: > [ 11.223705] > [ 11.223874] ? __local_bh_enable+0x7a/0x80 > [ 11.224199] up_read+0x1c/0xa0 > [ 11.224446] do_up_read+0x12/0x20 > [ 11.224713] irq_work_run_list+0x43/0x70 > [ 11.225030] irq_work_run+0x26/0x50 > [ 11.225310] smp_irq_work_interrupt+0x57/0x1f0 > [ 11.225662] irq_work_interrupt+0xf/0x20 > > since rw_semaphore is released in a different task vs task that locked the sema. > It is expected behavior. > Silence the warning by using up_read_non_owner(). > > Fixes: bae77c5eb5b2 ("bpf: enable stackmap with build_id in nmi context") > Acked-by: Martin KaFai Lau > Signed-off-by: Alexei Starovoitov > --- > kernel/bpf/stackmap.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c > index d43b14535827..4b79e7c251e5 100644 > --- a/kernel/bpf/stackmap.c > +++ b/kernel/bpf/stackmap.c > @@ -44,7 +44,7 @@ static void do_up_read(struct irq_work *entry) > struct stack_map_irq_work *work; > > work = container_of(entry, struct stack_map_irq_work, irq_work); > - up_read(work->sem); > + up_read_non_owner(work->sem); > work->sem = NULL; > } > > -- > 2.20.0 >