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 6F150C2D0E4 for ; Thu, 19 Nov 2020 12:30:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F41B246E0 for ; Thu, 19 Nov 2020 12:30:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727151AbgKSM3x (ORCPT ); Thu, 19 Nov 2020 07:29:53 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8000 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725783AbgKSM3v (ORCPT ); Thu, 19 Nov 2020 07:29:51 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CcJrx1633zhd2d; Thu, 19 Nov 2020 20:29:21 +0800 (CST) Received: from [10.74.191.121] (10.74.191.121) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Thu, 19 Nov 2020 20:29:27 +0800 Subject: Re: [PATCH net-next] net: add in_softirq() debug checking in napi_consume_skb() To: Peter Zijlstra CC: Jakub Kicinski , , , , , , , , , , , , , , , , 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> <20201119114149.GI3121392@hirez.programming.kicks-ass.net> From: Yunsheng Lin Message-ID: <75dbd476-2e0b-f4e6-4cb0-fff6f659ac8e@huawei.com> Date: Thu, 19 Nov 2020 20:29:26 +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: <20201119114149.GI3121392@hirez.programming.kicks-ass.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 19:41, Peter Zijlstra wrote: > On Thu, Nov 19, 2020 at 05:19:44PM +0800, Yunsheng Lin wrote: >> 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? > > Very close, for more regular code they should be the same. Thanks for clarifying. So I assmue the lockdep_assert_in_softirq() interface we want to add is regular code, right? > . >