Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp326545pxk; Thu, 24 Sep 2020 06:40:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwhHIaC0jtfIAAH4Gn6zl2s29uheQETiQ+wAEQ17YT3818BdyRhH6GGa9gVKZEfaGIwgbW X-Received: by 2002:a17:906:d0c9:: with SMTP id bq9mr1103940ejb.352.1600954825552; Thu, 24 Sep 2020 06:40:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600954825; cv=none; d=google.com; s=arc-20160816; b=WZqnPhjiJ0C7tWUuMUud9ZGlM3p83s6wq+kNVtKy/wZ3PEHVhqpoEt/gcMaee3aWER ruPHiFOnMGJrBiz3nbJ1WcV7Jm3bA9YhiAh2CID3mn8CRgc8P8ZRnVtL4/dKi7c83Z2w K1TfKmG9PNibb7jfZzebI/W9A7uf8KzZ4DGy0BBdEP/IYt4bHm8skAYtwlU594WsyCNx wqIGPSG7leN72UhAZbhAnbTKjNf59Seyzm6cDK1G/1qWKHLqZxHpZYEh27fGVnfNEG4J 44aNsEk94bc6yG5hGKkO8UGj+rQo+ZXTNadU6Jk0+Ua0EycrCGB1zBG7HAx/o+/Vb0F3 9FUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=LWItYUbY3YNkAAw7wM9cL9xVXm/akhjF8HLSfu/R4BU=; b=tum+YKfIoZsa63pi8x45qDN+2CM31fsdvfXw+No69aOUTsycMTu+VENelVxiERDjTP 5VhblR+u06IJMp0astK23V4T9adfhfqLohaqRWQIfl2F6J/oDf4MYJ5I835+M6Td9Ih3 jo/PPXg05S/L/BjtzazP1P21ejc46o7jxJZ9uiAgsfzdfXoK490u3R0vth8EOlFVdjeX 3bN7wzvI0tr6yCwmzqe8m503pJk2FZ1HGOb5R5haFZIlMyYnRg80IEYQvx4f32C3+Ktr pJovpdMGaGuvgcJeUu7rQ+mf2/WxlbDcfR0RJc0SgKgl+A4a6vv5TNwWyWPGEenE5Ysr wK6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=X1pTtNBe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rh6si2069347ejb.709.2020.09.24.06.40.00; Thu, 24 Sep 2020 06:40:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=X1pTtNBe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727972AbgIXNix (ORCPT + 99 others); Thu, 24 Sep 2020 09:38:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:52416 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727888AbgIXNix (ORCPT ); Thu, 24 Sep 2020 09:38:53 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1600954731; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LWItYUbY3YNkAAw7wM9cL9xVXm/akhjF8HLSfu/R4BU=; b=X1pTtNBesdsh7D2hQaOwWIEOBqg8QTEnYvOAQ3smjrbRJUoKs7CfUtKSRqqc13qTMgWBV+ hFkTnwECJAZ2fJ2+xPq20xt5biHb/KeHGVIj1brHiAdPSyaUtl9Qs9y9cq/IC5zksYtHKL UIqlXzvXEYQndaOPPBqNcosdGoLKbfQ= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 51634AD07; Thu, 24 Sep 2020 13:38:51 +0000 (UTC) Date: Thu, 24 Sep 2020 15:38:50 +0200 From: Petr Mladek To: "Ahmed S. Darwish" Cc: Sergey Senozhatsky , Steven Rostedt , John Ogness , Linus Torvalds , Thomas Gleixner , Prarit Bhargava , Mark Salyzyn , Chunyan Zhang , Orson Zhai , Changki Kim , Sergey Senozhatsky , linux-kernel@vger.kernel.org Subject: Re: [RFC 2/2] printk: Add more information about the printk caller Message-ID: <20200924133850.GF29288@alley> References: <20200923135617.27149-1-pmladek@suse.com> <20200923135617.27149-3-pmladek@suse.com> <20200924042414.GA6039@lx-t490> <20200924125259.GC29288@alley> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200924125259.GC29288@alley> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2020-09-24 14:53:01, Petr Mladek wrote: > On Thu 2020-09-24 06:24:14, Ahmed S. Darwish wrote: > > On Wed, Sep 23, 2020 at 03:56:17PM +0200, Petr Mladek wrote: > > ... > > > > > > -static inline u32 printk_caller_id(void) > > > +static enum printk_caller_ctx get_printk_caller_ctx(void) > > > +{ > > > + if (in_nmi()) > > > + return printk_ctx_nmi; > > > + > > > + if (in_irq()) > > > + return printk_ctx_hardirq; > > > + > > > + if (in_softirq()) > > > + return printk_ctx_softirq; > > > + > > > + return printk_ctx_task; > > > +} > > > + > > > > in_softirq() here will be true for both softirq contexts *and* > > BH-disabled regions. Did you mean in_serving_softirq() instead? > > Good question! > > I am not sure if people would want to distinguish these two > situations. > > Otherwise, I think that is_softirq() more close to the meaning of > in_irq(). They both describe a context where a new interrupt has > to wait until the handling gets enabled again. Grrrr, I wonder why I thought that in_irq() covered also the situation when IRQ was disabled. It was likely my wish because disabled interrupts are problem for printk() because the console might cause a softlockup. in_irq() actually behaves like in_serving_softirq(). I am confused and puzzled now. I wonder what contexts are actually interesting for developers. It goes back to the ideas from Sergey about preemption disabled, ... /me feels shameful and is going to hide under a stone. Best Regards, Petr