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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 6B8EFC2D0E4 for ; Thu, 19 Nov 2020 09:20:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E91E221F1 for ; Thu, 19 Nov 2020 09:20:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726730AbgKSJT5 (ORCPT ); Thu, 19 Nov 2020 04:19:57 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8116 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725915AbgKSJT4 (ORCPT ); Thu, 19 Nov 2020 04:19:56 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CcDdx2ycZzLlfP; Thu, 19 Nov 2020 17:19:33 +0800 (CST) Received: from [10.74.191.121] (10.74.191.121) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Thu, 19 Nov 2020 17:19:44 +0800 Subject: Re: [PATCH net-next] net: add in_softirq() debug checking in napi_consume_skb() To: Jakub Kicinski , Peter Zijlstra CC: , , , , , , , , , , , , , , , References: <1603971288-4786-1-git-send-email-linyunsheng@huawei.com> <20201031153824.7ae83b90@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> <5b04ad33-1611-8d7b-8fec-4269c01ecab3@huawei.com> <20201102114110.4a20d461@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> <5bd6de52-b8e0-db6f-3362-862ae7b2c728@huawei.com> <20201118074348.3bbd1468@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> <20201118155757.GY3121392@hirez.programming.kicks-ass.net> <20201118082658.2aa41190@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> From: Yunsheng Lin Message-ID: Date: Thu, 19 Nov 2020 17:19:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20201118082658.2aa41190@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.74.191.121] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/11/19 0:26, Jakub Kicinski wrote: > On Wed, 18 Nov 2020 16:57:57 +0100 Peter Zijlstra wrote: >> On Wed, Nov 18, 2020 at 07:43:48AM -0800, Jakub Kicinski wrote: >> >>> TBH the last sentence I wrote isn't clear even to me at this point ;D >>> >>> Maybe using just the macros from preempt.h - like this? >>> >>> #define lockdep_assert_in_softirq() \ >>> do { \ >>> WARN_ON_ONCE(__lockdep_enabled && \ >>> (!in_softirq() || in_irq() || in_nmi()) \ >>> } while (0) One thing I am not so sure about is the different irq context indicator in preempt.h and lockdep.h, for example lockdep_assert_in_irq() uses this_cpu_read(hardirq_context) in lockdep.h, and in_irq() uses current_thread_info()->preempt_count in preempt.h, if they are the same thing? >>> >>> We know what we're doing so in_softirq() should be fine (famous last >>> words). >> >> So that's not actually using any lockdep state. But if that's what you >> need, I don't have any real complaints. > > Great, thanks! > > The motivation was to piggy back on lockdep rather than adding a > one-off Kconfig knob for a check in the fast path in networking. > . >