Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1399473ybt; Thu, 18 Jun 2020 07:51:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAHRzhNvFM4Dy2pWfJVu9/hXdfiDYuU2zuQi1STb2dVsA2IosgIc+c3Wk0FCzbb6tuI53o X-Received: by 2002:a17:906:b89a:: with SMTP id hb26mr4384810ejb.137.1592491918036; Thu, 18 Jun 2020 07:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592491918; cv=none; d=google.com; s=arc-20160816; b=Y3zS1B+vXrkSHLyEz9E/hMPr/4J9JRVU1JpCQyQRX5m3/lXwBlk0qk3joCfB0ttihB LxHDjtJyJd8+ybqSMF8SJYFSjaNJyV+74r3a8LYXD1VxDud3oF+uybsFq21OF7AxzTXQ fbaTYFoP7vWS78UyTLFNPIF9Xw97NLIqXcuzu6jG1yKqlTXFqnIhAhygu8BSsC8P7O2O SU9+81EcihFF+baB7Us/eCwtqNizAOQSt4G4b+ia8nmp1iBDeuQLAHqFBWiOit7bkUye qKfKgbjGKNIWcrDiPgBzBP5y6/l2JCJwUpy0ac59pUT3otc0lYIeD0JlxLBVdYbS8EfM ZyWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=AASmmRMEdC0GW7ovajvdykj3OFtbJVGlqgTA8Q74SS4=; b=z/ZO1GZI6RPb3wkhT2bcJ3K5Ig1VQIhqUHsg21xGuALrHziYr8BewaIrpXSR/+zGxK dmdhhp5WQPo9ydYcIXmJUcmXh0RKkffaZqgWMlMT2IAS3VbFm1gIV8yL6L9x2GqOo/lt yNVxs/JhVH0CHXzRVzFL1P0lnwia1AXly6GvnD0yeUAipW8uROhWNIxkTNgYlB3ZvhWg MpiC4kSrZ4gLOlF5RRDJUDOqOMfr5SUi6fq74yBowQ22g0AblfIVvICFqaaEvth/C60k YbOTSdwjQW39lee0KvqyycnDsbblGr4ncEMPjaxpMaT5okme2Ei3SUMxYY2gw91xCjs7 l9TA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx27si1920460edb.32.2020.06.18.07.51.35; Thu, 18 Jun 2020 07:51:58 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730881AbgFROtt (ORCPT + 99 others); Thu, 18 Jun 2020 10:49:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726478AbgFROtr (ORCPT ); Thu, 18 Jun 2020 10:49:47 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C62FC06174E for ; Thu, 18 Jun 2020 07:49:47 -0700 (PDT) Received: from [5.158.153.53] (helo=g2noscherz.lab.linutronix.de.) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1jlvrA-0004Ip-DF; Thu, 18 Jun 2020 16:49:32 +0200 From: John Ogness To: Petr Mladek Cc: Peter Zijlstra , Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Andrea Parri , Thomas Gleixner , Paul McKenney , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/3] printk: replace ringbuffer Date: Thu, 18 Jun 2020 16:55:16 +0206 Message-Id: <20200618144919.9806-1-john.ogness@linutronix.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Here is a v3 for the first series to rework the printk subsystem. The v2 and history are here [0]. This first series only replaces the existing ringbuffer implementation. No locking is removed. No semantics/behavior of printk are changed. Reviews on the ringbuffer are still ongoing, but I was asked to post this new version since several changes from v2 have been already agreed upon. The series is based on v5.8-rc1. The list of changes since v2: printk.c ======== - console_unlock(): fix extended console printing [1] printk_ringbuffer ================= - data_push_tail(): fixed handling when another CPU already pushed the tail [2] - desc_push_tail(): added a full memory barrier before the descriptor tail push [3] - data_make_reusable()/data_alloc(): changed block ID reading/writing from READ_ONCE()/WRITE_ONCE() to regular assignments [4] - data_make_reusable(): removed unnecessary data tail re-check [5] - general: folded all smp_mb() and smp_wmb() calls into their neighboring cmpxchg_relaxed(), changing them to full cmpxchg() calls [6] - desc_read(): changed descriptor content reading from READ_ONCE() to memcpy() since it served no purpose for the legal data race - general: cleaned up memory barrier comments; in particular made sure that the reader and writer sides of the memory barrier pairs match in their descriptions - added a new section in the memory barrier documentation (near the top of printk_ringbuffer.c) that lists all 10 memory barrier pairs and briefly describes what they are ordering - _prb_read_valid(): changed the helper function to static - general: changed block size argument type from "unsigned long" to "unsigned int" since a record's *_buf_size fields are of type "unsigned int" - general: allow some lines to go beyond 80 characters John Ogness [0] https://lkml.kernel.org/r/20200501094010.17694-1-john.ogness@linutronix.de [1] https://lkml.kernel.org/r/87ftcd86d2.fsf@vostro.fn.ogness.net [2] https://lkml.kernel.org/r/87v9ktcs3q.fsf@vostro.fn.ogness.net [3] https://lkml.kernel.org/r/87bllpyzgr.fsf@vostro.fn.ogness.net [4] https://lkml.kernel.org/r/87tuzkuxtw.fsf@vostro.fn.ogness.net [5] https://lkml.kernel.org/r/87pna5mjtp.fsf@vostro.fn.ogness.net John Ogness (3): crash: add VMCOREINFO macro to define offset in a struct declared by typedef printk: add lockless ringbuffer printk: use the lockless ringbuffer include/linux/crash_core.h | 3 + include/linux/kmsg_dump.h | 2 - kernel/printk/Makefile | 1 + kernel/printk/printk.c | 944 ++++++++-------- kernel/printk/printk_ringbuffer.c | 1674 +++++++++++++++++++++++++++++ kernel/printk/printk_ringbuffer.h | 352 ++++++ 6 files changed, 2527 insertions(+), 449 deletions(-) create mode 100644 kernel/printk/printk_ringbuffer.c create mode 100644 kernel/printk/printk_ringbuffer.h -- 2.20.1