Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp298489pxk; Thu, 24 Sep 2020 06:08:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAQe09jvNXi/iYEAKNs3KlX5RgCWoiw/RsIzg7QtYSMR4o6ZsJlYkG0f6C3JeusGxiQHHK X-Received: by 2002:a50:e807:: with SMTP id e7mr1007262edn.84.1600952930857; Thu, 24 Sep 2020 06:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600952930; cv=none; d=google.com; s=arc-20160816; b=B1YjWWOUOZEVkIFXYGJMvkzGUg0ENtEYeEZC8IfpJJMkyLbe74IRNxaIzh2JibHugb WiuekWzhgoPU90+G1puLD98mgBxg0UXtGUoWMgIj7GTbmJmWckNG7LWSE3xyZx861/6I hEr4mdlaSjM/3AStcJK9AjLRopTYo5ymezz73lYdCNH5V4YzroOoVsj622O7p26Ru2ag yKKiZQyr2br/ce7oG5AH70KJptzaeKhDNEZ5tYeodyTTWV0RXukn12y+k5VAT0R7M3j8 k+/YiyiTKPa7J1bLX09zpxpujYH3lR1ta7CcUkQyB4mXsJ6mcu/NT406I7CL9fSK2EGX 0MhA== 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=vWhiMTbLKygzkeBmeWC4lp5Kk4n1lEhbQG0ng2LQOwg=; b=dtLdvfaG+RY31Z8Uotw8ay9MunAEYEtH6iIwX7hfiN88/vHDEWJJVlKTMwpCfMa3R4 DP/+Zc61sOXkaognnWcogdOV4eiR4mry10duXjniZ8AOJSpEXh9dPto5WgWOEm1/kw71 pA8gDH93Z3yXuUBusN8cBNX6/SSKQMtO3CipBNwvq+/2e07mqUtPiRg6mOUg7Wbw+tz4 MxzYU/6zpe78+EXdqoAFcnQo9j/AuWay9SmGkSjnstLyz644x4ZMIqQ+HZaJHEe3w/Kx zFIwyf7Hy7pUXAeChWh9FUZ8rU0ACRvGM/krHfNM7JAGHriNb2/sqIZnAUOEBREkiGDR vC5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=JnQ+jMZI; 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 gl12si1867908ejb.337.2020.09.24.06.08.25; Thu, 24 Sep 2020 06:08:50 -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=JnQ+jMZI; 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 S1727890AbgIXNG1 (ORCPT + 99 others); Thu, 24 Sep 2020 09:06:27 -0400 Received: from mx2.suse.de ([195.135.220.15]:33544 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727704AbgIXNG1 (ORCPT ); Thu, 24 Sep 2020 09:06:27 -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=1600952786; 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=vWhiMTbLKygzkeBmeWC4lp5Kk4n1lEhbQG0ng2LQOwg=; b=JnQ+jMZI1Zc6Y4y3PEceyIqKyNVXM2TxZpCDIbLQRE/Po5zKgakoC4xUenVAufJ1yItiSA HAR4J/iP6F1eBhn/Mt6YLcJ8dDMUhYXORd6P+Vq3SsOpHbQQsWtn6IpYMJ/DuaS/Fko9Rv r7D1qzVRqbjoj8wfniprG6vHMKGUx84= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4AE7EAF2C; Thu, 24 Sep 2020 13:06:26 +0000 (UTC) Date: Thu, 24 Sep 2020 15:06:25 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: 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: <20200924130625.GD29288@alley> References: <20200923135617.27149-1-pmladek@suse.com> <20200923135617.27149-3-pmladek@suse.com> <20200924021756.GD577@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200924021756.GD577@jagdpanzerIV.localdomain> 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 11:17:56, Sergey Senozhatsky wrote: > On (20/09/23 15:56), Petr Mladek wrote: > [..] > > /* > > * To reduce unnecessarily reopening, first check if the descriptor > > - * state and caller ID are correct. > > + * state and caller infromation are correct. > > */ > > - d_state = desc_read(desc_ring, id, &desc, NULL, &cid); > > - if (d_state != desc_committed || cid != caller_id) > > + d_state = desc_read(desc_ring, id, &desc, NULL, &cal); > > + if (d_state != desc_committed || > > + cal.pid != caller->pid || > > + cal.cpu_ctx != caller->cpu_ctx) { > > You probably might want to factor out ctx check into a static > inline helper. Since you use this check in several places, and > we may check more context fields in the future. Makes sense. > [..] > > +/* Information about the process and context that adds the message */ > > +struct printk_caller { > > + pid_t pid; /* thread id */ > > + u32 cpu_ctx; /* processor id and interrupt context */ > > +}; > > A question. Suppose we have a task which does > > CPU0 > > pr_err(...); > > preempt_disable(); > pr_err(...); > preempt_enable(); > > pr_err(...); > > rcu_read_lock(); > pr_info(...); > rcu_read_unlock(); > > Should we distinguish those as 3 different contexts? > > - normal printk > - printk under disabled preemption (affects scheduling) > - printk under RCU read side lock (affects RCU grace periods) Good question. Well, these contexts could not get detected in PREEMPT_NONE or PREEMPT_VOLUNTARY. Also I wonder where it would stop. There are several RCU flavors. I would not distinguish them unless there is a real demand. Best Regards, Petr