Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp564290ima; Sat, 20 Oct 2018 13:23:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV61r+uU4Y2XiicUCV32CzvRrSkYXtKLbZGVtVlhQSGkOaEDKpXprj+y48vNVyTB+mpicYygR X-Received: by 2002:a63:455e:: with SMTP id u30-v6mr37450898pgk.30.1540066994430; Sat, 20 Oct 2018 13:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540066994; cv=none; d=google.com; s=arc-20160816; b=VbvKrkjtq36ecwGpS2J8OKRV4LnjbHIIby99pwsVrmaPPnXXVA/qch3vJmGkQtbxV1 oguHlY5Ycanml1fDlbiRET9ToaO0WSY7iFMgyDuYXMWHRUs4vaehWj33e9gJQjRf4sSI SYkcPwxhxXMSyUynWfJtpUQZFBj6j+snAHQGYXV4wehK09XwJb3cy5TDoaC0/u0mZ8Vq AD+gazMbL2td63/bmryobQr3WxuafL/4MgKrGT5EL67Mz7uxcZRhE8fj0dMFc+k1z6Aq ufmF1DfFxPRuDxhJ6qzDpf0MYWXmcoVy0Ql7n46JCM5XAtH3Z+eyRUqAjtteHfR6lgfV 6l1Q== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Vga9uxOk9UJJKweYvD9I2ZzcNh/2rFvmD7GFIxa2hTQ=; b=j/ysaQMSXFVfROCLoFAqC8J77sLbCXNLdSksWNgpHuoHFKTMLDTg/EZN7QPNAkm1M2 vBtBtRGxRyF1B3HjYBmz4mHaYoRr4rcMB0sBjX2wxMwqEo1Bffhx7D8PkQyDM9SELzaH Hg19aqq7rBgpV8MqyqX2vjMEVTqeuttRXEY94MVKpvu9ddSqnkN0HKfTgJO1jV0TiJnC QeQKaVzEbOB8+HUfkzksZWYiQGjn1waNr158DG42i/0Dp3kon/Pa4RYV1v77Q1dM4tSQ tA4x2NT4C1aBhaPTb3QicPsNmvGDi9hRm7bvo8ba0cWcjksaV+QxnUW1femOus0xeIfR 8W2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AuIKTQSo; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12-v6si27382770pls.35.2018.10.20.13.22.59; Sat, 20 Oct 2018 13:23:14 -0700 (PDT) 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=@amarulasolutions.com header.s=google header.b=AuIKTQSo; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726143AbeJUEeP (ORCPT + 99 others); Sun, 21 Oct 2018 00:34:15 -0400 Received: from mail-ed1-f44.google.com ([209.85.208.44]:46165 "EHLO mail-ed1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725746AbeJUEeP (ORCPT ); Sun, 21 Oct 2018 00:34:15 -0400 Received: by mail-ed1-f44.google.com with SMTP id v22-v6so1438683eds.13 for ; Sat, 20 Oct 2018 13:22:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Vga9uxOk9UJJKweYvD9I2ZzcNh/2rFvmD7GFIxa2hTQ=; b=AuIKTQSorYrwnPeEvktnS/fdS3vEhimASiob9Tb+QhmKmfTQe/QTsnJtT4lxucodv7 5U9GxeH/EIPM8EZBDdXkffa5NGysR8TUtgnybz7PhJMjkiQYlycW3GDfk8SwSAvBJD5A yhigKUGgEy5Uyra/tAf/U5JlY2Ae2i7YJRiis= 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:in-reply-to:user-agent; bh=Vga9uxOk9UJJKweYvD9I2ZzcNh/2rFvmD7GFIxa2hTQ=; b=fS0Udf92CEsoHQg08KGN9d8t6lu3cBclGq91cm9RKwMIdmmtvsjGcNTTVA9gKRyGFA Y810QnMT+Usz8sgRm/YyahgGELj4ChWjfZ33QKYGv0myfgvNMzSmGImtpqtlyu6JV59O p4GLgpus2XUG+VMj+jimfmhN+1u5eFubpTHgU+uCrX1uD33Y1O2EkdtXsXKv6wDoDU1S 8Gohg4Xf7X2W0+cKtd8d9+cWHMN0CyfOeJs16AA1eLg8M18NzYtrIIGZe/Czg/dQ8pnO AxZJZO1FpS7DnwVTN61/ChWGnMF1tOBMXfAgskqps9uuWEdZ5u90XbVYAGvMFLWMhyqR FY/Q== X-Gm-Message-State: ABuFfogmH7xYTSbPvb2ryyR73GNLnosdp3X2bhe+RmWFuAd45zrDT6Bc +lfnCAL0/I7ZscCNhU2pmv0Vfw== X-Received: by 2002:a50:f284:: with SMTP id f4-v6mr9356809edm.233.1540066956584; Sat, 20 Oct 2018 13:22:36 -0700 (PDT) Received: from andrea (15.152.230.94.awnet.cz. [94.230.152.15]) by smtp.gmail.com with ESMTPSA id x15-v6sm12276654edm.26.2018.10.20.13.22.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 20 Oct 2018 13:22:35 -0700 (PDT) Date: Sat, 20 Oct 2018 22:22:29 +0200 From: Andrea Parri To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, davidtgoldblatt@gmail.com, stern@rowland.harvard.edu, will.deacon@arm.com, peterz@infradead.org, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, akiyks@gmail.com, dlustig@nvidia.com Subject: Re: Interrupts, smp_load_acquire(), smp_store_release(), etc. Message-ID: <20181020202229.GA10526@andrea> References: <20181020161049.GA13756@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181020161049.GA13756@linux.ibm.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [...] > The second (informal) litmus test has a more interesting Linux-kernel > counterpart: > > void t1_interrupt(void) > { > r0 = READ_ONCE(y); > smp_store_release(&x, 1); > } > > void t1(void) > { > smp_store_release(&y, 1); > } > > void t2(void) > { > r1 = smp_load_acquire(&x); > r2 = smp_load_acquire(&y); > } > > On store-reordering architectures that implement smp_store_release() > as a memory-barrier instruction followed by a store, the interrupt could > arrive betweentimes in t1(), so that there would be no ordering between > t1_interrupt()'s store to x and t1()'s store to y. This could (again, > in paranoid theory) result in the outcome r0==0 && r1==0 && r2==1. FWIW, I'd rather call "paranoid" the act of excluding such outcome ;-) but I admit that I've only run this test in *my mind*: in an SC world, CPU1 CPU2 t1() t1_interrupt() r0 = READ_ONCE(y); // =0 t2() r1 = smp_load_acquire(&x); // =0 smp_store_release(&x, 1); smp_store_release(&y, 1); r2 = smp_load_acquire(&y); // =1 > So how paranoid should we be with respect to interrupt handlers for > smp_store_release(), smp_load_acquire(), and the various RMW atomic > operations that are sometimes implemented with separate memory-barrier > instructions? ;-) Good question! ;-) Andrea > > Thanx, Paul >