Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp858907pxk; Wed, 23 Sep 2020 19:22:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmqrBZZ6j6jeeu57a3X/LkAqTfobAKHX1UcgMz+Wzgp1BgdXpKx2QxlV/VD98Um23ZW8oM X-Received: by 2002:a17:906:e88:: with SMTP id p8mr2598275ejf.134.1600914120543; Wed, 23 Sep 2020 19:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600914120; cv=none; d=google.com; s=arc-20160816; b=RFjgBXp6NyKh2uanLSc/pBxZNA5MzF8ZgJUbKy0Iz/CdodVIgGZqC17xKSxJAhmUvW /IDCuEL1fMg4FSwfiNMDBcq5Ww+8h4OoEJwe/BQyuV0TlVcFm6wHbTA4nHhQvYjLLOnl 6fK0Tpir+4SjxQYxu1K+pWhBnnQRKMn9Q2xuwmMRU5RdfPko5NlYXBhMP99yT0eSv5tH a4xfZ/tm2du2Alg7g+YIpt8Ql8ZP0K6hnp3Xur2EJjsH40X8t9VdRLxKrpzoG19civhq zT3FfdVR1Vhyz07Adnjgk4vMFhd0vj+38ZZ4I6gGWJljunffyZcEv/yRZkDCjvFr/hmY D44w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gKCeOBoU5Gnn58Cm54AB14ZxrSPvXUCdl5LfOJCj1Fw=; b=kypoihz67gunkX9C7Y1RL3Nu5O7DGAM4CtS66ACmbH5I1xrRBOBjYKYRaSa8WiaakY 6jT454f1eit/IJlLxOk/WXqpFB4YL6oVK0kaYWSaAykaJPtR0e/zEe+NCg6MKkEn9YHg IJ/zsdupJ267ljamxNRGtwNmts7DlL/CdccLLqKApXPVoj+MdqZKkV5wpAxRHzP19wR7 KSZh4mN3uc+BkIOPHKD4BiKg8ihER8tKpWMx6t1bj8N0xyV+7OXy3mGZuWiKjDemR3yQ 1j5/drLRcy+H+j0ko97cR5o5HW8rnkZ8udGwDi3fF9z3hYVdvIvHAG5gGoi0QzQxXaqs mT2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M4XeG+2T; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p18si1193924edr.166.2020.09.23.19.21.36; Wed, 23 Sep 2020 19:22:00 -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=@gmail.com header.s=20161025 header.b=M4XeG+2T; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726513AbgIXCSA (ORCPT + 99 others); Wed, 23 Sep 2020 22:18:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726281AbgIXCR7 (ORCPT ); Wed, 23 Sep 2020 22:17:59 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31E5C0613CE for ; Wed, 23 Sep 2020 19:17:59 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id x22so892858pfo.12 for ; Wed, 23 Sep 2020 19:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=gKCeOBoU5Gnn58Cm54AB14ZxrSPvXUCdl5LfOJCj1Fw=; b=M4XeG+2TvxV35gsxacBXx/bgLRkKwqJ5p4BbhHpt00XNl6q/XPdYOI8FUvNMyMWmwb kM1Z6etjD2Hygn3+fudlwd1iFl0RiNM0HVh8v/p/HtiEOIrGpz8VyoZ9zkin+CSorNsr 7AIsfxjgzY+uOK0FGcRfd4TgQdLfvPoWeitcSE2HTA/067Aaa853H3645KmeU06LXLzg xGrrA8Jbv3g3wudpP10zUKSoZQHHVQTXOeb99ZahQMlX821YBfEg4edOHdUqyThb04/Q caXtWaEjxRDvVO7lsLiah0pw6elfadG6E7HxF8T6V1twqbnWWAsoUq/AYK3rS4RLtodO ME8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=gKCeOBoU5Gnn58Cm54AB14ZxrSPvXUCdl5LfOJCj1Fw=; b=f2+HmYnZeSGxs1GKXldwVvEwj8IQk3lIOcWAFfnd6Mq0rv+Gs+03hXgc7xjOnumkYc 5Ume36HoDJRk6LvzFvhqaSkImcOWP16pWAbmtL79kJ/a3Yts41DuuZigQP8YnGRuOlys zIg3o2lo2MUGfFoA7p9hICDBO0elrh91Smw+KJb47idrZrLLAuCSrtyIgoFcR2Se4feU L8ha445iKgkm4WAX7cOPcoWtEdIdB1tOvL0dBc6mtd7I1iP9GmQcrG4jnHAfdyHYVGEp fmVbuwHHTetQorJlNEVoMH3xNBWV41SnRcx4TzCc7fsxOL/6nZm2Brj8VSNL7FApxMrL y+9Q== X-Gm-Message-State: AOAM5323+lEybL6dJ2x/+r82hGOWpcsEdHP3zWOIR5URSzGiE1DupTgO 9ZRC/5hzv9cyc4L+zufw9Qo= X-Received: by 2002:a63:1a50:: with SMTP id a16mr2049744pgm.331.1600913879232; Wed, 23 Sep 2020 19:17:59 -0700 (PDT) Received: from localhost ([2409:10:2e40:5100:6e29:95ff:fe2d:8f34]) by smtp.gmail.com with ESMTPSA id e27sm874569pfj.62.2020.09.23.19.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2020 19:17:58 -0700 (PDT) Date: Thu, 24 Sep 2020 11:17:56 +0900 From: Sergey Senozhatsky To: Petr Mladek 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: <20200924021756.GD577@jagdpanzerIV.localdomain> References: <20200923135617.27149-1-pmladek@suse.com> <20200923135617.27149-3-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200923135617.27149-3-pmladek@suse.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. [..] > +/* 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) -ss