From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33ECD18FDB0 for ; Wed, 5 Jun 2024 09:32:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717579945; cv=none; b=YqRg3BN/XUeeXi7oEGDxQk/58VSf5q5p7SCRPa0BZ25gE5p5ikzGpE7TiqsgvpaPxdprR6ONi4QeXSWJ3/9yOeSS+jn3Yvq3pOiicxwO/JJ/U8AZiLkxjTRiUe1CU4Bn+M3m8b+y2Prp5dKw3VoemV5uzYXG21njqeVrbkbI0/k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717579945; c=relaxed/simple; bh=A/gOzPUwckRQSfrNHNR843u/F/x3yV4eQiL9bWvwnB4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: In-Reply-To:Content-Type:Content-Disposition; b=tMPRPBb2ddVvCpOtXo8Z75YsyXzXVfC23zMEdyrt2X54qiN4O6fDIVZAUzs91BCCYlwcelEHR0itk2tBAWft7oMM7pZd2+GH0rryc8sGZuxjpa7YS/CtQL1AJ5XWaZ84LRbl2eWJKVdjuWMzuM5H1Bp9MmGdTlK+fidHZ4PBlNs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PZqa1nTm; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PZqa1nTm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717579943; 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=EIHWoHv/QvLBTsW9LF2D/X7toxaXXwp5mTAPZT4vSL4=; b=PZqa1nTmU2uapPVHxr4IromQM2gN/8Zpb1RyAq5sODJLJytvfbNNN46uOeBTnL1Lz2oJSS glpeMVpIK+Z+JntcY+dz9mkMmR+BCW5wu1Kqi7WWVx932Y44wN2O9lDhFDx48JWMVOL19s bCfzAqSNNGdwccB5oDAR31bPuBX0gQQ= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-529-neANozFfPJatYcMdy9dLUA-1; Wed, 05 Jun 2024 05:32:21 -0400 X-MC-Unique: neANozFfPJatYcMdy9dLUA-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6ab80cb23beso16345846d6.2 for ; Wed, 05 Jun 2024 02:32:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717579941; x=1718184741; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EIHWoHv/QvLBTsW9LF2D/X7toxaXXwp5mTAPZT4vSL4=; b=OZZdKlI8NSeaCPtrAgph3lnIFJPyHp5nYKyPy5JsUCwdPsbBoeDB0UQi6ZFPNId3iY jr0yWywUzwYgzUrhPbi8WHy+jgqJUqhvGbcXmhUNEv6JMDiWFed2iCXK0gXKlmRRWOHh xPwv0gYhF0JQKHaCGL9UfPtvBtOQsL8G3TolxvKBP4Q0GZ7OUO8TQV0DCZ4qg1j0iXTG 1LFXP3J6N8wb4lw160qZpQRZ8FjqJtdMQuVC1oKavk/qdYoju6/AriFpvzuA83gbd/ci MXoRfnYPCUwoWAg25GfolyZNniYFhTaXh0c6Cf6wQ6qjF/xyYV9suR9omkubGQCWbVlc MKqg== X-Forwarded-Encrypted: i=1; AJvYcCXWrAlw/UCQ4wfsyacMEW112vowk+XbwQSEQrE9HhUygplZkWkqo4KmEq8hP3ntFf2kDu9eCRVBzCSVaHnw5DKYNHYbzbCqr8cQMjxX X-Gm-Message-State: AOJu0Yw+wH1B20XAbIhAxWyp73AhzRO/1FF1o/tbPP7GwrhNjCsnOvNY 2a4kKcCPAZ5w+CIqD25TBELaNqDRTDXZAlrogG8nWMImV16G5+Dum16NUTsPhPAx4mVAm6mNbgn FQzqGRXagPkeblV8gapkgVtrVNBer284hnmkUs0qMcmEuIJdq1nEK0e+hx1CDtw== X-Received: by 2002:a05:6214:3a89:b0:6af:2676:1a67 with SMTP id 6a1803df08f44-6b02bf749b2mr20745066d6.28.1717579941388; Wed, 05 Jun 2024 02:32:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5ikW1FE7KKc1M+K4oFqEtBv+CXhwGrhdL4tT32ka2r1ldJIrtTLooEIM1RfE/m26z2wnCxA== X-Received: by 2002:a05:6214:3a89:b0:6af:2676:1a67 with SMTP id 6a1803df08f44-6b02bf749b2mr20744926d6.28.1717579941039; Wed, 05 Jun 2024 02:32:21 -0700 (PDT) Received: from jlelli-thinkpadt14gen4.remote.csb ([176.206.3.168]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6ae4b405e14sm46658136d6.80.2024.06.05.02.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 02:32:20 -0700 (PDT) Date: Wed, 5 Jun 2024 11:32:15 +0200 From: Juri Lelli To: John Ogness Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Jonathan Corbet , Greg Kroah-Hartman , Jiri Slaby , Sreenath Vijayan , Shimoyashiki Taichi , Tomas Mudrunka , linux-doc@vger.kernel.org, linux-serial@vger.kernel.org, linux-fsdevel@vger.kernel.org, "Paul E. McKenney" , Josh Poimboeuf , "Borislav Petkov (AMD)" , Xiongwei Song Subject: Re: [PATCH printk v2 00/18] add threaded printing + the rest Message-ID: References: <20240603232453.33992-1-john.ogness@linutronix.de> <875xunx13r.fsf@jogness.linutronix.de> Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <875xunx13r.fsf@jogness.linutronix.de> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On 05/06/24 10:15, John Ogness wrote: ... > Yes, that probably is a good candidate for emergency mode. > > However, your report is also identifying a real issue: > nbcon_cpu_emergency_flush() was implemented to be callable from > non-emergency contexts (in which case it should do nothing). However, in > order to check if it is an emergency context, migration needs to be > disabled. I see. > Perhaps the below change can be made for v2 of this series? Yes, this seems to cure it. Thanks for the super quick reply and patch! Best, Juri > diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c > index 4b9645e7ed70..eeaf8465f492 100644 > --- a/kernel/printk/nbcon.c > +++ b/kernel/printk/nbcon.c > @@ -1581,8 +1581,19 @@ void nbcon_cpu_emergency_exit(void) > */ > void nbcon_cpu_emergency_flush(void) > { > + bool is_emergency; > + > + /* > + * If the current context is not an emergency context, preemption > + * might be enabled. To be sure, disable preemption when checking > + * if this is an emergency context. > + */ > + preempt_disable(); > + is_emergency = (*nbcon_get_cpu_emergency_nesting() != 0); > + preempt_enable(); > + > /* The explicit flush is needed only in the emergency context. */ > - if (*(nbcon_get_cpu_emergency_nesting()) == 0) > + if (!is_emergency) > return; > > nbcon_atomic_flush_pending(); >