Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp79604pxk; Wed, 23 Sep 2020 23:21:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdWhllvquVoyB9clP4XzA9mgWGAhLTByYP3+3DW/iYY1W1uoXdSiu0B1oN3n6FnxogrLxa X-Received: by 2002:a05:6402:615:: with SMTP id n21mr2807752edv.59.1600928512635; Wed, 23 Sep 2020 23:21:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600928512; cv=none; d=google.com; s=arc-20160816; b=VD/fkt1jvGdNt8+d+rZGteEBej8Tl5wBkYrT8JXfkAq3LiZfg11U/eXiF69MBr01eJ 74DnhEYsdAx+S+B5RGjmvRyECvwSp1G/O2ED1EzDPIeED//Ontm0NezHG7RauSLH9Rvu AlM5j9gSQbrtrQ9YyqOpnzyI0H9n//p37fz1Y64gLrJBLbGOHS4qtIPE5H4zy8y35VOF 9vH+ebHAX7ljijdcJiOf4yPIyTiB8xzUB4YsPx4/JIZ8gFERpxyOi9mKcPrMsMrB0VtN odoGeCDAcJdkWR9HW8xz4llbPL32h3etKBknRGMm3LJ78eM686WmblKHkxSHbl8gxbDz HjaQ== 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=LSmTDa7H3lB3GnBItYeJYiiAXiThAxj/99DEm1q+Yk8=; b=Mtf7hWU6mlkFwh0X0BbkUieJ9VUP3xzkChYz7AoHBqdoKO9TAnxEOcs2HrCMLwUhTw epaPEgraW1gSJyGkOa+HQWT6PrqHlJDEGG6nhzTDKqcabDnOX0ld+9L4yZos4FWfqcgk Zp4qOdAimoZUrtcSQIbQhQW5130pE+eYrYlu8Z8sQL+D9RIO3TNOyH/qU6CHarHaDPej w8t5tf/aXzEyVZgKYHzKVpTrGyOYUpMmrtPC6OFSjKPnb98N2dwF/IQ/xQb7bJP9guhO HqrlOPJ0zwelVdEsIodIyx035GCeVt5RY2RFdg8+zMRwjceVgvIaQlmwZXmXrNVWoLNu KlrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gfZSSnDR; 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 h3si1801047ejo.332.2020.09.23.23.21.28; Wed, 23 Sep 2020 23:21:52 -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=gfZSSnDR; 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 S1726943AbgIXGRu (ORCPT + 99 others); Thu, 24 Sep 2020 02:17:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726919AbgIXGRu (ORCPT ); Thu, 24 Sep 2020 02:17:50 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07DE4C0613CE for ; Wed, 23 Sep 2020 23:17:50 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id q12so1095951plr.12 for ; Wed, 23 Sep 2020 23:17:50 -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=LSmTDa7H3lB3GnBItYeJYiiAXiThAxj/99DEm1q+Yk8=; b=gfZSSnDRcnEXg37IhcG+YAqpFzM1noEwaduBnw6edWSmQKujhmDnmgfoI/0QloOdd/ ORVGyOmch0O52yOgYcUSdhSsICTe01x+1Ekxf8SWdG+aNmAkLo10qfX5cF1TrkTCtDTY ZjfbYEv+y6gTPU7aSJBC0z0p5AVzyFnb2hUJ2xuyhfBOwXsCtyeWp4g4FWhkU0aH5diQ DtADCZgHFZHXkfAh3TKyouuYf+njxRRrx/bI7x2f+bThAB+b0eNvqE+hbTLXacrz98NS RiTkehm3j6ciy3wvgsRsMtWr5r+SccJjwfn2UIr0hCEe9+PSOx70ogUjkcc3kcvBs4dQ Jy2g== 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=LSmTDa7H3lB3GnBItYeJYiiAXiThAxj/99DEm1q+Yk8=; b=FURgWQjYSj+oNhDfv4HfabYoIPRHDZAbeqcAyjjq3WvWHqmZuWkCDEFcC3OSUx/IpB +KjRwHZtutIE05cDul/OloVlysVaUcdUxK+aBXv3Vw8wCcbug5838MrOZa2FtuFm6yOl aifiOz3cm5/3EdFza78lDVJ1mSPnDKgvpnFFsycUu1r9OPgZvrnybvowFCHUwk0YSEL2 ksSVAwuVdfJOCx6tptKg+dbPdS/8yPYeXgiXKaUcQxIXLvrOW6NIVxS54crjYS767++N Axe6hwoezDZO+4CjsbrPGWNSIIRWsWPpGPiCDH5DRZIMWCIWaHG4NjxTPtzVfHV8U1Jz yjsQ== X-Gm-Message-State: AOAM531lQ2swh5CB8xby648BmbOqGxB/jhS6Gt5vUfjECzwSvhoJPLYM tUZ1alcDHQL4pXcvVZgOmFRGIa6gpi4= X-Received: by 2002:a17:902:6b05:b029:d2:8b5:14 with SMTP id o5-20020a1709026b05b02900d208b50014mr3148588plk.80.1600928269461; Wed, 23 Sep 2020 23:17:49 -0700 (PDT) Received: from localhost ([2409:10:2e40:5100:6e29:95ff:fe2d:8f34]) by smtp.gmail.com with ESMTPSA id e10sm1707161pgb.45.2020.09.23.23.17.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2020 23:17:48 -0700 (PDT) Date: Thu, 24 Sep 2020 15:17:46 +0900 From: Sergey Senozhatsky To: John Ogness Cc: Petr Mladek , Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH printk 3/5] printk: use buffer pool for sprint buffers Message-ID: <20200924061746.GF577@jagdpanzerIV.localdomain> References: <20200922153816.5883-1-john.ogness@linutronix.de> <20200922153816.5883-4-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200922153816.5883-4-john.ogness@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (20/09/22 17:44), John Ogness wrote: > +/* > + * The sprint buffers are used with interrupts disabled, so each CPU > + * only requires 2 buffers: for non-NMI and NMI contexts. Recursive > + * printk() calls are handled by the safe buffers. > + */ > +#define SPRINT_CTX_DEPTH 2 > + > +/* Static sprint buffers for early boot (only 1 CPU). */ > +static DECLARE_BITMAP(sprint_static_textbuf_map, SPRINT_CTX_DEPTH); > +static char sprint_static_textbuf[SPRINT_CTX_DEPTH * LOG_LINE_MAX]; > + > +/* Dynamically allocated sprint buffers. */ > +static unsigned int sprint_dynamic_textbuf_count; > +static unsigned long *sprint_dynamic_textbuf_map; > +static char *sprint_dynamic_textbuf; Just a question: Can dynamic_textbuf be a PER_CPU array of five textbuf[1024] buffers (for normal printk, nmi, hard irq, soft irq and one extra buffer for recursive printk calls)? So then we'd vprintk(...) { preempt_disable(); buf = this_cpu_ptr(... preempt_count_to_ctx()); ... preempt_enable(); } preempt_disable()/preempt_enable() is already in printk(). -ss