Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp200758ybf; Thu, 27 Feb 2020 19:13:39 -0800 (PST) X-Google-Smtp-Source: APXvYqziww7/gs0wS8n6EXAbH8wUn1wBNwXMTyb1knJO7+bMiXxm/J3HvhSOe//IbKVhYYmT1F2D X-Received: by 2002:a9d:4c81:: with SMTP id m1mr1668395otf.5.1582859619210; Thu, 27 Feb 2020 19:13:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582859619; cv=none; d=google.com; s=arc-20160816; b=qgzknoYNqYv4MtZnhPG9VOjpWxAyNTuQWT22AVmVzsqCknyBnJeRGBICpw6GSWSZlF iebedI4Wd7ZlvHv5SZDJuACyL26vFT3q68iT/v2c8Tg/sau6bmg2OjtyD4QaARV73JkG 08ZidJ2m+fd6NQA99CO9jBz2jdB/S+Gsy4/fxcbauZW1ft7AQwWFDvYWqqwupELxNrE3 HZBMKKBrCOFhFEZn8QFPmSncBx4+VOdpVJfOWdSxeynRLT007cX4lptEGlkOZQXO0ntg DJeBAPIsJvODTnLsMl150caxfu5r5iRjoi6sxi0zXGIfkNwOrtkJh7axEPz27G3b3y3X GZ3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rbZrsVVuXpExOD+0yCysQl+fKQbRkZWqFru2LyAoZPY=; b=gyy32gieyLqzAC2/CNsvtRTWSPrOw8Z9QQ92Y3WqJ+VLfvMnXFwPxH59Bt62eKf0dO qMgxNJNOrsKkstK7NszNrNZvcbH3WXQ8klNFCV2CA89r2qIbp8cDtoeVPlOmSpiEGqK9 jxnRKn2fucVPQuE7X6DGP6t7A85HXihobTdsSvDbFgjXtd4porsWQAYu9/XT1hQuxJjS EIgCixiajld/50xvLEEwhxzY8Efj1kv7FYhNJ9Ho6tZcUq0F2dCwJ5Q21gt8HZxzHOH1 uVlAI/FLSPAiMKA/WkrRPqb5oTR1KAN61v0KeSG6HuXrJoLX7dtli3vLiLcnyf4l6Uuu 3DXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hSFyjzXo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id j22si908231oib.137.2020.02.27.19.13.27; Thu, 27 Feb 2020 19:13:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hSFyjzXo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1730645AbgB1DNM (ORCPT + 99 others); Thu, 27 Feb 2020 22:13:12 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:38858 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730586AbgB1DNM (ORCPT ); Thu, 27 Feb 2020 22:13:12 -0500 Received: by mail-pg1-f195.google.com with SMTP id d6so745842pgn.5 for ; Thu, 27 Feb 2020 19:13:09 -0800 (PST) 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:content-transfer-encoding:in-reply-to :user-agent; bh=rbZrsVVuXpExOD+0yCysQl+fKQbRkZWqFru2LyAoZPY=; b=hSFyjzXo02HWa1guRWKUeAN0VKp29votagDhE+nMAmp40Q8ZkcPXeyOAsh1ZQCM7Ub UGRS/RYZNljlDKVvh7DG9VqSYiJEsE1esYp1DjrG69BMsMmrCqDshMPLC/NG/mQz0whs SrYob3uG+0IdqympVcMBADbdLtv40r1wUgbvjts2O61sTi2REGtRsFjrSa6eWnGW6E8R B3kviW057ERO+PwCG8JxVxq5viQTqxy+Y2/7JLQ5tkXwZuEzKRQfawuCfBaYCW1exUeh xMB4+Yoz5gISKcrEWwoPIXLRtO4CAKLIPREp79xsLsQeGe5ziPevKyZhxoB7GGkkfTbC Z3Rw== 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:content-transfer-encoding :in-reply-to:user-agent; bh=rbZrsVVuXpExOD+0yCysQl+fKQbRkZWqFru2LyAoZPY=; b=IGUPoUCxOqj84rEtEvZghn3TMFUocvvisZ6iYbys3t5QQfgnySIc5EhxwLJqHeiA8g zVOUEZaBppEqWyBRgnQ55OZYIOvksRWURlXKV89oNudzhdFGq7tPi8tvNPUTngTPlzgz ldU79wAQhmTti9bKPFgBwaulYXDuYdqqxxmW3mPw5XdmxXWGAtFmFa03+fzfXxtdilnc DRvH5NbC8zI/e43lTgJ4lgOqMqmtxQTcIOSvlFhA12ITxghAM8SyPgXM2ALtJRtxFxTx PjZV3f3eljvb0dogo9zr0cgXCuKwgC/ZLTevJu9j31StHpHuro+m9ChBb5+CVI0NZaQN tZjQ== X-Gm-Message-State: APjAAAUr1qKplaW7JAedH9jmGAcid5ti0+zODB6bbFgRgC1F5PJzR40G 79CXIeWs2uwWQ1Gz2LfqxJU= X-Received: by 2002:a63:114a:: with SMTP id 10mr2386967pgr.185.1582859588967; Thu, 27 Feb 2020 19:13:08 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:5bbb:c872:f2b1:f53b]) by smtp.gmail.com with ESMTPSA id h22sm7983405pgn.57.2020.02.27.19.13.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 19:13:08 -0800 (PST) Date: Fri, 28 Feb 2020 12:13:06 +0900 From: Sergey Senozhatsky To: Lech Perczak , Petr Mladek , Steven Rostedt Cc: Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" , Theodore Ts'o , Arnd Bergmann , Krzysztof =?utf-8?Q?Drobi=C5=84ski?= , Pawel Lenkow , John Ogness , Sergey Senozhatsky Subject: Re: Regression in v4.19.106 breaking waking up of readers of /proc/kmsg and /dev/kmsg Message-ID: <20200228031306.GO122464@google.com> References: <20200227123633.GB962932@kroah.com> <42d3ce5c-5ffe-8e17-32a3-5127a6c7c7d8@camlintechnologies.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Cc-ing Petr, Steven, John https://lore.kernel.org/lkml/e9358218-98c9-2866-8f40-5955d093dc1b@camlintechnologies.com On (20/02/27 14:08), Lech Perczak wrote: > W dniu 27.02.2020 o?13:39, Lech Perczak pisze: > > W dniu 27.02.2020 o?13:36, Greg Kroah-Hartman pisze: > >> On Thu, Feb 27, 2020 at 11:09:49AM +0000, Lech Perczak wrote: > >>> Hello, > >>> > >>> After upgrading kernel on our boards from v4.19.105 to v4.19.106 we found out that syslog fails to read the messages after ones read initially after opening /proc/kmsg just after booting. > >>> I also found out, that output of 'dmesg --follow' also doesn't react on new printks appearing for whatever reason - to read new messages, reopening /proc/kmsg or /dev/kmsg was needed. > >>> I bisected this down to commit 15341b1dd409749fa5625e4b632013b6ba81609b ("char/random: silence a lockdep splat with printk()"), and reverting it on top of v4.19.106 restored correct behaviour. > >> That is really really odd. > > Very odd it is indeed. > >>> My test scenario for bisecting was: > >>> 1. run 'dmesg --follow' as root > >>> 2. run 'echo t > /proc/sysrq-trigger' > >>> 3. If trace appears in dmesg output -> good, otherwise, bad. If trace doesn't appear in output of 'dmesg --follow', re-running it will show the trace. > >>> > >>> I ran my tests on Debian 10.3 with configuration based directly on one from 4.19.0-8-amd64 (4.19.98-1) in Qemu. > >>> I could reproduce the same issue on several boards with x86 and ARMv7 CPUs alike, with 100% reproducibility. > >>> > >>> I haven't yet digged into why exactly this commit breaks notifications for readers of /proc/kmsg and /dev/kmsg, but as reverting it fixed the issue, I'm pretty sure this is the one. It is possible that the same happened in 5.4 line, bu I hadn't had a chance to test this as well yet. > >> I can revert this, but it feels like there is something else going wrong > >> here. Can you try the 5.4 tree to see if that too has your same > >> problem? > > Yes, I'll check it in a short while. > I checked v5.4.22 just now and didn't observe the issue. Maybe this commit wasn't destined for 4.19.y due to intricacies of locking inside printk() :-) > > From my side, there is no need to rush with the revert, as I can do this locally and drop the revert with next rebase-to-upstream, which we do very often. > OTOH, the issue is likely to affect a lot of users, especially ones using distros tracking this branch like Debian 10 mentioned earlier, > once they pick it up the change, as the kernel log content recorded by syslog will be affected, and 'dmesg --follow' behaviour will be quite surprising. This is very-very odd... Hmm. Just out of curiosity, what happens if you comment out that printk() entirely? printk_deferred() should not affect the PRINTK_PENDING_WAKEUP path. Either we never queue wakeup irq_work(), e.g. because waitqueue_active() never lets us to do so or because `(curr_log_seq != log_next_seq)' is always zero: void wake_up_klogd(void) { preempt_disable(); if (waitqueue_active(&log_wait)) { this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP); irq_work_queue(this_cpu_ptr(&wake_up_klogd_work)); } preempt_enable(); } int vprintk_emit() { ... pending_output = (curr_log_seq != log_next_seq); ... if (pending_output) wake_up_klogd() } Or we do wakeup, but then either `syslog_seq != log_next_seq' or `user->seq != log_next_seq' fail. Lech, any chance you can trace what's happening in the system? -ss