Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3524767pxu; Tue, 8 Dec 2020 14:34:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcyLhAGIt20CLeZqfc1NEo+gL3WholNIUc3807+CkVbGvUMvOBUVC1BYINFj7cP9WQeqOH X-Received: by 2002:a17:906:3704:: with SMTP id d4mr25285333ejc.338.1607466891600; Tue, 08 Dec 2020 14:34:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607466891; cv=none; d=google.com; s=arc-20160816; b=bIWZDEpiIVAMfJzK0OpMA5L7CbqthWBWb0sOETgyMmf4GRhTWIq1fkb7tcs/xapt2R yq67uQv+gAuG2omPEk/QI/xeP880kPn/hpVBED9nhSuoBND5YofzpnIzmy8In52nsDeN nfzndgIM8f3RZo1oKgA6tpzGTm+6EQBgFDuSEk8VXY4Be6H1FxxkhsVeDv4XsnwhlHzC EOCM6wgfZxWuow2mIDEiVGyKEpFWOq1X5i6w5sdXNiIetx9P00aSBKtPQxkscJUezVNu u78e6zxQIUDBTRurMsZtt2EHblfd2cr8CFRMCsEGQk1IMtnXqJ4xQcUkaA1vw7+7mgPD h2TA== 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=75XIg+ZJ7vXwfOxh4mfZVbFzoFN2Q4G9QbYqnFjSG9E=; b=fy+MXluaCqeOaP/5V4T8klJjJ5kEVe0kvsj9iqdLJvkTOUmo9IhxIGKb8VxPxtvUgm 06jTmj2oiWfDjsfwb9r+b0s2ZmddX/kSLjd+GS1ujdFHf5Do4bHfpJQs/2Vi62F302lq TH4Z3X1/uyGdk9iXw64s0U+cCHAkd7g0dtTZY7MTCZs04o6d1yiIfVWEzzHSOgOOWqqJ TILmy8+XP48hEvlgCW8KFSgIJb51FKj27JKncpTEFnBCgpjgB3a4qV3F8t02l7J0tNRi ZbLRIj6jVxKyxn0Nipx/686OmHT0IvMV2UnLtZd2uspDEZmPeSrY4SQztz6fmVp9oVt1 Eodg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=A1Nz0fwN; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=lxQ6PPi8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j24si8638903ejt.651.2020.12.08.14.34.27; Tue, 08 Dec 2020 14:34:51 -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=@linutronix.de header.s=2020 header.b=A1Nz0fwN; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=lxQ6PPi8; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730631AbgLHWbc (ORCPT + 99 others); Tue, 8 Dec 2020 17:31:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbgLHWbc (ORCPT ); Tue, 8 Dec 2020 17:31:32 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5A3CC0617A7 for ; Tue, 8 Dec 2020 14:30:46 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1607466645; 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=75XIg+ZJ7vXwfOxh4mfZVbFzoFN2Q4G9QbYqnFjSG9E=; b=A1Nz0fwN0RmE7nkQCeVtAdRK9Fp5J/cc0VItqE+6Y7ssc5nfSb29Z/8sL6eNiF2I9vmFKy 0dnrrhMqEcv/tQR4USLUQrGVKit9lqQ0Ig5IckSZ2j5JTPjJo1cQ2HLA6sfYwdeYY7tJ+S 3ggfNRJfP6/R6kiGBH5Mfzs/4+E55KzFoNRME0kzLGQ0vfwgDVbze+lJYpaKp/3h/6yC/o ZxwvGUyBtaWHLQxkvOy1q/TLSrRH6qCeKjclQEW231NMhGOLuxqxQFAcGKL1hlhhMGsDrV D9XUaHzrbeWSxy9B5oXPic1voW29EtSNLmsUcLzpfrFs2sVEWEyLTBGL+KOVqQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1607466645; 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=75XIg+ZJ7vXwfOxh4mfZVbFzoFN2Q4G9QbYqnFjSG9E=; b=lxQ6PPi8VY3UiDkGHT3VY5H8IEHbdv5lVgE58r7eJjHqq8tm8fP1GrwUG9ziPkfjV+v4sC +NNZZFN62//vMrBA== To: Sergey Senozhatsky , Petr Mladek Cc: Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Peter Zijlstra , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH next v2 2/3] printk: change @clear_seq to atomic64_t In-Reply-To: References: <20201201205341.3871-1-john.ogness@linutronix.de> <20201201205341.3871-3-john.ogness@linutronix.de> Date: Tue, 08 Dec 2020 23:36:44 +0106 Message-ID: <875z5c9bhn.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-12-09, Sergey Senozhatsky wrote: >> Sigh, atomic64_read() uses a spin lock in the generic implementation >> that is used on some architectures. > > Oh... So on those archs prb is not lockless in fact, it actually > takes the spin_lock each time we read the descriptor state? > > desc_read() > atomic_long_read(state_var) > atomic64_read() > raw_spin_lock_irqsave(lock, flags) > << NMI panic >> > > Am I missing something? For the state variable we chose atomic_long_t instead of atomic64_t for this reason. atomic_long_t operations are available atomically on all architectures. However, for clear_seq we need 64-bit (even on 32-bit machines). The seqcount_latch is an excellent solution here since clear_seq does not require lockless writers. John Ogness