Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3881212pxu; Wed, 9 Dec 2020 03:05:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxkJnQS4Q6B5iJLszPkUQdg/nzW6e35cQcyFtOmna0GtK1JjjXPh4lYN1QfPAbWjLpArVb X-Received: by 2002:a17:906:4756:: with SMTP id j22mr1627008ejs.353.1607511901805; Wed, 09 Dec 2020 03:05:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607511901; cv=none; d=google.com; s=arc-20160816; b=VkfSAQLT6u0MPy9KE5BC7XGurk4KmFWcOTY9k3OKmAW218sYKAxnSbJXuNhGZ36dq1 Eohv9QL9oCXOKMLwUsB1w6b11SXHI4GRN6JuhLYs6dIxuvSQKBJbf1SCb5EEo0y5iTHQ 9OwdWLJW18xEiOFOqaaJXozZpmPcyD59zltegH+0aeg4yQnmJuzGxU7Z+/wAGcark/CX efdh8H1zWfBTqKznrwjdarLAasZ+xdq3xuumZtz1yBcwcJlH+RwUdSKp8AaeHoZGw31P x9r8OYTU+auo3/wNUXuKfEsano8tO1CjedmRg8UODrgwmtKVMqA9MLyQtmAEpHdL7H+R rmYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jQNJqFn2pfwvahjCE/gxSS2ui3h3u7/sHMgAsutT6ik=; b=LF5etPHbHjC3naSoSqFT/Fhw054ereBWVYW4SjhfTB7qWq5GDd/wX05PiuT3Hw380g UmiHKAiXv7VEuiai6ylHTZViOycFcCgMlm8nWYDG9y5SA5pvrM/J2HAS5wtxOIEn99en 09q4VAIkIIigMiKeYeNGt/K8W1oQhtMY7i1/1B+hrbvIvMvENKdWK+YZVkbOFbEmtq72 FehL8IEZ89cXLY4dAJhv3AIEN4/mk8Gc8rceOtSYZROySIByXGlC916Xc1PuqXPZn/dW co3waVWZfkNAXhXIXld3OYwz6aGBlX2M1aTHnBmwsAcywAESOMIjNNO4Cb5gcdS/AEBh sdbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=qgHEcjaX; 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 m22si650888edr.514.2020.12.09.03.04.38; Wed, 09 Dec 2020 03:05:01 -0800 (PST) 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=@infradead.org header.s=casper.20170209 header.b=qgHEcjaX; 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 S1730344AbgLILBb (ORCPT + 99 others); Wed, 9 Dec 2020 06:01:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730217AbgLILBb (ORCPT ); Wed, 9 Dec 2020 06:01:31 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5237DC0613CF for ; Wed, 9 Dec 2020 03:00:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jQNJqFn2pfwvahjCE/gxSS2ui3h3u7/sHMgAsutT6ik=; b=qgHEcjaX3oqkvKY0oefuCQAeZ7 JVE3rbPaYilnmZpQM5sx1iaiPtQvXZCdyb4nyJpPPKdWSPoTMLYIvTwlWwktoIfnAB2Uka1kPluaA mlyRUPu+TOn1cESAXJa7itoWR/5pe2cRha05XegSfV6xiZpbAbEvTAULBhZJC5LXbOH5i/I1IHJCx Df4cTdO1Yqc1+JQDyvZlGHU2CkZicup+uqY/nLqRi0oitxr2R2GOXQPY9EdX76t+A4dRin6ybAKAE n977BTYtHjsxF/r9p08G9S7hAQvCVJTy7XJasojTxpdFmjVHfWvbD7bFaDUSZ3hji25JV4VbCxMlB vBxtmFiA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmxDA-00079i-69; Wed, 09 Dec 2020 11:00:45 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 208813011F0; Wed, 9 Dec 2020 12:00:43 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0AF69209B20EF; Wed, 9 Dec 2020 12:00:43 +0100 (CET) Date: Wed, 9 Dec 2020 12:00:42 +0100 From: Peter Zijlstra To: Sergey Senozhatsky Cc: Sergey Senozhatsky , John Ogness , Petr Mladek , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH next v2 2/3] printk: change @clear_seq to atomic64_t Message-ID: <20201209110042.GW3021@hirez.programming.kicks-ass.net> References: <20201201205341.3871-1-john.ogness@linutronix.de> <20201201205341.3871-3-john.ogness@linutronix.de> <875z5c9bhn.fsf@jogness.linutronix.de> <20201209081623.GI2414@hirez.programming.kicks-ass.net> <20201209092204.GD1667627@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 09, 2020 at 07:46:13PM +0900, Sergey Senozhatsky wrote: > On (20/12/09 18:22), Sergey Senozhatsky wrote: > > > > > > Please put on your eye cancer gear and inspect the atomic implementation > > > of PA-RISC, Sparc32, feh, I forgot who else. > > > > > > Those SMP capable architectures are gifted with just one XCHG like > > > atomic instruction :/ Anyway, as said in the other email, they also > > > don't have NMIs so it mostly works. > > PeterZ, thanks for the pointers! > > > > Hmm, wow. OK, I definitely want to look further. > > > > When some CONFIG_DEBUG_FOO_BAR code wants to pr_err from prb->atomic_op > > on those archs then we deadlock in printk once again? > > E.g. arch/sparc/lib/atomic32.c > > spinlock_t __atomic_hash[ATOMIC_HASH_SIZE]; > atomic_foo() > { > spin_lock_irqsave(ATOMIC_HASH(v), flags) > ... > spin_unlock_irqrestore(ATOMIC_HASH(v), flags); > } > > So another potential re-entry path is > > atomic_foo() > spin_lock_irqsave(ATOMIC_HASH(v), flags) > printk() > prb() > atomic_foo() > spin_lock_irqsave(ATOMIC_HASH(v), flags) > > which can deadlock, in theory, if both atomics HASH to the same > key (same spin_lock). Yep, but see the 'mostly' in the 'they mostly work'. Given the limitiations of these architectures there's really only so much you can do.