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=-0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 BD9A2C33C99 for ; Wed, 8 Jan 2020 00:34:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 90A012075A for ; Wed, 8 Jan 2020 00:34:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PmL2VCRA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727165AbgAHAeX (ORCPT ); Tue, 7 Jan 2020 19:34:23 -0500 Received: from mail-ot1-f53.google.com ([209.85.210.53]:33952 "EHLO mail-ot1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727139AbgAHAeX (ORCPT ); Tue, 7 Jan 2020 19:34:23 -0500 Received: by mail-ot1-f53.google.com with SMTP id a15so1935565otf.1 for ; Tue, 07 Jan 2020 16:34:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=niWhBRhKXmzjQvQ9xA9c9ow/qbkjjEi+sqGmzoce9JQ=; b=PmL2VCRAf1FOxeLsGkCXOz2ma0tzVgRna6HFAAXkNnx4q072/A23l37Lb38cY1skZ3 tGmETHuVzW+eici+axAuQu3nETBInRWGnLyh6XZz5iukb2yjXlt4EZPSQVctmvDAtTgT NCdLQ8qLVkjIiPCCUa/g5irbIW8+XZb9f0AhLVhB7Gw+w0SCgPpEASL1IV04hpH1o2fy gZRqMDSGB2zdsBZr6uBDFm5BH2cnyLMbYT8jprwpy/qtLnhfGp0gxAj6QXBzc6LBUZVa eEL5kis/W/fZ2tPqomacujf1SeAw97FOhaAfi/STf2js2n/2KwN8xbw9x5okAdC4v46E 0IpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=niWhBRhKXmzjQvQ9xA9c9ow/qbkjjEi+sqGmzoce9JQ=; b=pLVi0pQUyXNouv+Bvd2UY9CoakNtYgTIOChLtJPuN1pm8iKkvh9CBFdS8pPTQv2QrF t1VbNslmwSP0764mLkAVZYYmUX1+YQR5IUpYhZVfvMlkxaOK9mBhaJVtaOAuRZh235+O r2FvStEXlj4lfrylW+tW5TxqijPMLUYNmYaGpo+IyGXwfWcCuNgnTnDNo+J9bNrAoC4A o+vLMLwa5Yg5X05A+W1XtpIDMRzShKMAnwRG7PgaRQloxerxwmWHO2pdTEGAS2twJDcj Mi7pdzLuh7QNkdPuO7nPQEiXh43GRR+VW2HgERS4z+Qa5/K0aG56iozd3QlDeKts0h2R WuCA== X-Gm-Message-State: APjAAAV8gl+Py2NMKA4yZ+K1Xbt6X4eKckns75dcTn8c79Wh+NlFjF7E a57nPzGectluoEld2vFmQqTbeS4yP2z+dYAf8Fc= X-Google-Smtp-Source: APXvYqxAT620gIC2x/ih1hDhDGZDOCHhJVRxVhcGtLVe01Cxx/VypQjWm5lh+ky5xxfHYGSAMXXnPi4MHYYO8IiRGcY= X-Received: by 2002:a9d:53c4:: with SMTP id i4mr2385557oth.48.1578443662689; Tue, 07 Jan 2020 16:34:22 -0800 (PST) MIME-Version: 1.0 References: <000000000000ab3f800598cec624@google.com> <000000000000802598059b6c7989@google.com> In-Reply-To: From: Cong Wang Date: Tue, 7 Jan 2020 16:34:11 -0800 Message-ID: Subject: Re: WARNING: bad unlock balance in sch_direct_xmit To: Taehee Yoo Cc: syzbot , Linux Kernel Network Developers Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Jan 7, 2020 at 3:31 AM Taehee Yoo wrote: > After "ip link set team0 master team1", the "team1 -> team0" locking path > will be recorded in lockdep key of both team1 and team0. > Then, if "ip link set team1 master team0" is executed, "team0 -> team1" > locking path also will be recorded in lockdep key. At this moment, > lockdep will catch possible deadlock situation and it prints the above > warning message. But, both "team0 -> team1" and "team1 -> team0" > will not be existing concurrently. so the above message is actually wrong. > In order to avoid this message, a recorded locking path should be > removed. So, both lockdep_unregister_key() and lockdep_register_key() > are needed. > So, after you move the key down to each netdevice, they are now treated as different locks. Is this stacked device scenario the reason why you move it to per-netdevice? If so, I wonder why not just use nested locks? Like: netif_addr_nested_lock(upper, 0); netif_addr_nested_lock(lower, 1); netif_addr_nested_unlock(lower); netif_addr_nested_unlock(upper); For this case, they could still share a same key. Thanks for the details!