Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1922624pxa; Sun, 23 Aug 2020 22:50:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxb1+fsEpW0ZlHqneFnYX0pB+4rqs0tIFvUZrbIZJu4BXCCc5NIwvkFoc9nXr33eOzQckl7 X-Received: by 2002:a17:907:20c8:: with SMTP id qq8mr4240732ejb.253.1598248239769; Sun, 23 Aug 2020 22:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598248239; cv=none; d=google.com; s=arc-20160816; b=GoSxWAjGpjojt6NUoQYbk2CInJp/XuWP8WQVw3LT2sZ0vpZizcDbEYyH+vDO17Usd9 ht+r/FcN7UOeaQng9r9iYDdUQy0KYrHL7WoA0CGc0ec+b8zdIlRSgGTVW1vryg8DpWZT TTAKYANF8bzow9TU+qV2IZdHD1g0LfqB/6Qelb+nufwraTtJ4DojgWvvzaVefzf8o+V6 05GVSXBEXFTtQiRv+uU+k+neR3imu1E5RB0mNpnS0myT5RKQg55X76Vlm84lF79kFRKk vGPPffr/cwwTePKNX0C3Q2PvSCbxm10jVY5890vQgqqeyMvil8D4npALXCgjF+N/Ky5U BubQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=VTbspYLWEm5A7CDSAhaKSzWJDq2Y3rS2DPVET/55CrM=; b=gloQMmttMJAHKZL3vyrFzUV3IxHkqwh2CORSNgZ/9fxhuX7b3FOSxJthWtNMkTjydy ve81zTiWTZQIQ5C1GOwkTQKXNu4xcuw04WQjfcon0S071CklvVBkNPynwCge3VNU3yvS acre2yAIbj67pask3gP1GLXrOAetEKHY8Ptg52aDH2pdpLyJ0Nh4vDZQUI8uOpcvPs/h /vGpWIpHew7Y3kUuu5MDep2TSIhsgcUDzQfatOwHRtGupNItcka3blW88WWEMTGD6OPf aEMEnZDxXBX8fhZ2kGecgi3+pyLcges8hxv+nvCk15kLQUu1Zqs5ARbvkgWTs6eQhme4 FnVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HyXGABs5; 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 p21si7108900eds.193.2020.08.23.22.50.16; Sun, 23 Aug 2020 22:50:39 -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=HyXGABs5; 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 S1727981AbgHXFhF (ORCPT + 99 others); Mon, 24 Aug 2020 01:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726024AbgHXFhE (ORCPT ); Mon, 24 Aug 2020 01:37:04 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB4CCC061573 for ; Sun, 23 Aug 2020 22:37:03 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id n3so2709355pjq.1 for ; Sun, 23 Aug 2020 22:37:03 -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=VTbspYLWEm5A7CDSAhaKSzWJDq2Y3rS2DPVET/55CrM=; b=HyXGABs59Hi6a04xgBiFgN7Enkzv/x4dXM+VkqV0/fHObKOMiSv4CGAu3/RzSo9epx xaUYunnERG7+/+1luuipmrsiwfiKDJ+YBliXZK3o7ASoIKH67qxm7wSodxTq2h3lFsst XrBJIuRe/k2Cu01rI6AR0bjBeTvYcEB1gp9qib5BAVIxMtMGl1M0VLyNxKQjRQBN+ur3 BQAcr/K0lqq1VPZZLa+XJcs6Cc9i37sqvx7h/j/jlSBPcNA/BpwbkvI/qDTrYIY9bWjA Hvf91+p5sJKsOhdismkS1AZk2dYJ8uAy8+5w7eEJuGn3ypWAItNTRQzoLYzOBh0l96r6 iacA== 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=VTbspYLWEm5A7CDSAhaKSzWJDq2Y3rS2DPVET/55CrM=; b=IhFlstXcEvU+SJQ53hwmh2o7vOi/KdQDI3yX//eiC9yCNoWdncAXQBEFh1lniAVleV sBR+t4yaqip7x/GCoCsExrGZV1KYMcB1RpufITiwsD7leu3Sref/snXHctIOcc6bFPmN quc0hG6FPLcoUhlpVtZt/14lOkv60ngC++EVwMhpVM3XSISkLNwApCqnWJP5O8rXACNr lw+MHGXyBvozCPzmQ1CB2M1lbtuBOB4usF+4eBO87NEZdZd/etpprNi5tX/1Gpyqwbxs UVLSM9oKwOAgSMix5H0d97PtLOfZFUGN74OQPcTKxMLMd5JJhvZz5eIR53gOhh91Nk88 tkGg== X-Gm-Message-State: AOAM533cg8IrwPr3iFXMaTULO4zydIG8fSqbR9C//QOxl1Twb0WoPIfF 9WZZJoNX5ndyVrRF4aRRolk= X-Received: by 2002:a17:902:9a90:: with SMTP id w16mr2647842plp.181.1598247423252; Sun, 23 Aug 2020 22:37:03 -0700 (PDT) Received: from localhost ([2409:10:2e40:5100:6e29:95ff:fe2d:8f34]) by smtp.gmail.com with ESMTPSA id x15sm10240444pfr.208.2020.08.23.22.37.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Aug 2020 22:37:02 -0700 (PDT) Date: Mon, 24 Aug 2020 14:37:00 +0900 From: Sergey Senozhatsky To: John Ogness Cc: Linus Torvalds , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Greg Kroah-Hartman , Thomas Gleixner , Sergey Senozhatsky , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 1/5] printk: implement pr_cont_t Message-ID: <20200824053700.GB567@jagdpanzerIV.localdomain> References: <20200819232632.13418-1-john.ogness@linutronix.de> <20200819232632.13418-2-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200819232632.13418-2-john.ogness@linutronix.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (20/08/20 01:32), John Ogness wrote: > +#define CONT_LINE_MAX LOG_LINE_MAX > +#define CONT_BUF_COUNT 10 > +static char cont_buf[CONT_BUF_COUNT][CONT_LINE_MAX]; > +static DECLARE_BITMAP(cont_buf_map, CONT_BUF_COUNT); > + > +static int get_cont_buf(void) > +{ > + int bit; > + > + do { > + bit = find_first_zero_bit(cont_buf_map, CONT_BUF_COUNT); > + if (bit == CONT_BUF_COUNT) > + break; > + } while (test_and_set_bit(bit, cont_buf_map)); > + > + return bit; > +} > +static void put_cont_buf(int index) > +{ > + if (WARN_ON(index >= CONT_BUF_COUNT)) > + return; > + if (WARN_ON(!test_bit(index, cont_buf_map))) > + return; Doesn't WARN_ON() do pr_cont() print outs as well? I'm a bit worried by the path that re-enters pr_cont() from "broken" pr_cont() path. Just ideas, to keep the discussion alive: Overall, I wonder if pr_cont buffers should hold more info, e.g. owner context. If the same context does "normal" printk() while still owning the unfinished cont buffer then we should flush cont buffer. I may be in minority here, I don't see a very strong reason to keep the global order of the messages - e.g. if pid 234 does printk on CPU1 then we probably don't need to flush pid's 8889 cont buffer (which runs on CPU42, for instance), but keeping the order of the messages within the context is somehow much more important. That is, if pid 8889 starts pr_cont buffer and then triggers a pr_warn() or pr_alert() or any other printk() then I think we need to flush the cont buffer. Just 5 cents. -ss