Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp395085rwb; Wed, 16 Nov 2022 02:08:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf7hFtIgPXaOKtwDITSsq9YTKExywGsat9lGvlGY55kOkbwksbpWH2alPzrrRN5n/J/sPiD4 X-Received: by 2002:a17:906:3d52:b0:7ae:44b2:cb7f with SMTP id q18-20020a1709063d5200b007ae44b2cb7fmr16646913ejf.437.1668593330749; Wed, 16 Nov 2022 02:08:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668593330; cv=none; d=google.com; s=arc-20160816; b=jvCOeFvcG20siAoT0hew2kCrlfpGMzvWm3H8DqVgprlk65uwRoBhgg0wd5Lq7qlhPq tlW00c3TCh7TEL774WH+UK3x9aXCpSG4698tQbCnY0QT9xdmTlKctXMbXq4Xq3Xjaz1p PzC1frnRxf2vpk18qWlpeMnJl8nkUv8YOqInnAp1YUpYFKNr88iSKOyT9vGuEYquU78Z vz7nBjCZ59AiSFpLuYOXKZG11w8ybVpFfcAxXK8hyoQLqhiuqJ5VjuAvoh4mruWYg421 3Re1E2jA9rkbvuJyNAc/bzYcyLQT4lBs2kRziVTE3bulgibq2QWFdMqEe3qtn4JuoxPi +Lbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=FD6M9QY8iW9aXpGMda/ftERrCCP2hqP8/1sR46SwkDs=; b=0ljXxaHpCke1Iur6GBeviVBRTuyhF3IdvdrugMZi0J/fWPEJlO97kFAqiqlV2Px8io IOMicbfwuX1B34r31VUesnw9Y//LZfXAKvdZqHZLj7DwKsNFsUUYAdCH7/6vimXiNoYf 3sXg+USYJcDMIW5sYHxjizS7b+3XPSegiPcwB5grMvWkWYesai+jG6WQyaJNXg+7wVFm W3FylI2/jY3DQuxt/YXypLNUTrPMaochS8IAepct7koUOCwg0Fd73UmEaBEdiop50tje iMS2UZmkG7vIYl2G/0eCipZCP99rY03AEddW7oUR4lDgbwjdFq8XjgTv6d+SM82J2gZi ieQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Pm+m88h8; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf37-20020a1709077f2500b007ae87dde2c7si15315873ejc.830.2022.11.16.02.08.29; Wed, 16 Nov 2022 02:08:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Pm+m88h8; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233046AbiKPI4n (ORCPT + 90 others); Wed, 16 Nov 2022 03:56:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230429AbiKPI4j (ORCPT ); Wed, 16 Nov 2022 03:56:39 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2AA51142 for ; Wed, 16 Nov 2022 00:56:38 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668588996; 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=FD6M9QY8iW9aXpGMda/ftERrCCP2hqP8/1sR46SwkDs=; b=Pm+m88h862VmziM9o4LFN8RIoKlfl03dSyIa5vjp5tPUrpfTiF6dB+sq6gsSdM1ftq+6f/ rGP87F7Hwu/7JvReKDnRtCSBUQq6FKYRNQ5lLsE65Zyv2PTmL2qKkY6rqLmARqBSWMLjtI tNSUo+mqFBWcMw4HUUOJjxPILpPOnHYvUKmx9OAD3UFYBcjHEOwlV2HS/1bDWBofHnMgKJ 26WonJw8CZwhWgpYJl0NP596cCGuhectIWrksiOS/c+aACZ67voTSUf+xbcN8C1mtTxmGi 0IK5rijsYleQKoMCPuB1e9s5GvIWsNYZuxLmcCwbnYoxTWjf7eOsBwQkK0j7yA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668588996; 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=FD6M9QY8iW9aXpGMda/ftERrCCP2hqP8/1sR46SwkDs=; b=m22c+CdGALHaAHSz4g430YNaNrE8SmdRINyPYAHMHQZF4ivHnWzRCRBqQOYRH14dpXzIgq sV5KHnBIvfocgqDw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: replay log: Re: [PATCH printk v4 38/39] printk: relieve console_lock of list synchronization duties In-Reply-To: <87y1sbjn77.fsf@jogness.linutronix.de> References: <20221114162932.141883-1-john.ogness@linutronix.de> <20221114162932.141883-39-john.ogness@linutronix.de> <87tu30maqf.fsf@jogness.linutronix.de> <87y1sbjn77.fsf@jogness.linutronix.de> Date: Wed, 16 Nov 2022 10:02:34 +0106 Message-ID: <87v8nfjn0d.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I forgot to re-lock the console... See below. On 2022-11-16, John Ogness wrote: > if (newcon->flags & (CON_PRINTBUFFER | CON_BOOT)) { > /* Get a consistent copy of @syslog_seq. */ > mutex_lock(&syslog_lock); > newcon->seq = syslog_seq; > mutex_unlock(&syslog_lock); > } else { > /* Begin with next message added to ringbuffer. */ > newcon->seq = prb_next_seq(prb); > > /* > * If any enabled boot consoles are due to be unregistered > * shortly, some may not be caught up and may be the same > * device as @newcon. Since it is not known which boot console > * is the same device, flush all consoles and, if necessary, > * start with the message of the enabled boot console that is > * the furthest behind. > */ > if (bootcon_registered && !keep_bootcon) { > bool handover; > > /* > * Hold the console_lock to guarantee safe access to > * console->seq. > */ > console_lock(); > > /* > * Flush all consoles and set the console to start at > * the next unprinted sequence number. > */ > if (!console_flush_all(true, &newcon->seq, &handover)) { > /* > * Flushing failed. Just choose the lowest > * sequence of the enabled boot consoles. > */ Sorry. Here we lost the console_lock. Another acquire is needed here. console_lock(); > newcon->seq = prb_next_seq(prb); > for_each_console(con) { > if ((con->flags & CON_BOOT) && > (con->flags & CON_ENABLED) && > con->seq < newcon->seq) { > newcon->seq = con->seq; > } > } > } > > console_unlock(); > } > } John Ogness