Received: by 10.213.65.68 with SMTP id h4csp3541777imn; Tue, 3 Apr 2018 06:50:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx49lV1jCJADTa83+3PPzhU+lzFpNnRb1oR+y7UWAW4ik8LNNjFgIg872XMwHDp7cJ0gG5C/o X-Received: by 2002:a17:902:aa96:: with SMTP id d22-v6mr14162279plr.106.1522763414155; Tue, 03 Apr 2018 06:50:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522763414; cv=none; d=google.com; s=arc-20160816; b=CSX2L7qrS5A4AkoWunX5T1NrXfshJ+msm0QUXNEQiak5wfRluyGbGCTgHh3a9PWgux K2cmBk98vpIGkA35iTZv6aIGEo0quALb9bil8Dma/83B24NLKR2aqpEyd+FDAAR21sbL zHPRh/O5RdHbrI7o71Bt1oGcMbbWwBLnKlTrsCVJkW2C5A9NvOz+L2CrUWiXYbjFbPDr I9bGzN6QOlipNtQVHMerI8GFuR2KSJATY0hIb1kiKt0L/zrRdAtOaVmdrpzcxLnR42rQ XT1eJCB+u5dPI3vKdDr8s0OS1RWTK2yoAoR/HSbaHZdIzCd/kbKwGjbtHpWWJ2YHIHvU xNjQ== 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:arc-authentication-results; bh=YTNvlu8agR9MRuQACK9D7d25ZjamfNGhL8o3CuDEbRM=; b=WJUTMxbn/+1V9icSTGOFQYa/LToraVNK6X+hdkNrStXGZ+rhsPn6UTYg6gLLnhkmvV FzzV8HwIOo5W720qbK0LTte2Rl3nt6Kt0NBF2xtjb69Fl46AnNFv6vBZnBawFE51yler D1jXZAR9eAu28k1k33HAtZZTGn8k/VpcCQ4pZiLo7xDz5BOxyJyp3sEKY45/lFAad3rX uN2rrk/tXCCJDjLtWLJ+vP20Sj8c1a/bVyUEWzpJNydkmC4mSeqAJgaYnkDWr5oTtX/d lOM3CqtxnlGcXA6aOSAtZ9H8x6YvTH0s7OBpXIwOtSG/gfv1+ZuJ8uSl2rPWXq6cnvcy 2jWA== ARC-Authentication-Results: i=1; mx.google.com; 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 m5si403728pfh.27.2018.04.03.06.49.58; Tue, 03 Apr 2018 06:50: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; 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 S1750855AbeDCNsk (ORCPT + 99 others); Tue, 3 Apr 2018 09:48:40 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33050 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750726AbeDCNsj (ORCPT ); Tue, 3 Apr 2018 09:48:39 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B9DAC1529; Tue, 3 Apr 2018 06:48:38 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5E9423F24A; Tue, 3 Apr 2018 06:48:35 -0700 (PDT) Date: Tue, 3 Apr 2018 14:48:32 +0100 From: Mark Rutland To: Yury Norov Cc: Will Deacon , "Paul E. McKenney" , Chris Metcalf , Christopher Lameter , Russell King - ARM Linux , Steven Rostedt , Mathieu Desnoyers , Catalin Marinas , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] smp: introduce kick_active_cpus_sync() Message-ID: <20180403134832.2cdae64uwuot6ryz@lakrids.cambridge.arm.com> References: <20180325175004.28162-1-ynorov@caviumnetworks.com> <20180325175004.28162-3-ynorov@caviumnetworks.com> <20180327102116.GA2464@arm.com> <20180401111108.mudkiewzn33sifvk@yury-thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180401111108.mudkiewzn33sifvk@yury-thinkpad> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yury, On Sun, Apr 01, 2018 at 02:11:08PM +0300, Yury Norov wrote: > +/* > + * Flush I-cache if CPU is in extended quiescent state > + */ This comment is misleading. An ISB doesn't touch the I-cache; it forces a context synchronization event. > + .macro isb_if_eqs > +#ifndef CONFIG_TINY_RCU > + bl rcu_is_watching > + tst w0, #0xff > + b.ne 1f The TST+B.NE can be a CBNZ: bl rcu_is_watching cbnz x0, 1f isb 1: > + /* Pairs with aarch64_insn_patch_text for EQS CPUs. */ > + isb > +1: > +#endif > + .endm > + > el0_sync_invalid: > inv_entry 0, BAD_SYNC > ENDPROC(el0_sync_invalid) > @@ -840,8 +861,10 @@ el0_svc: > mov wsc_nr, #__NR_syscalls > el0_svc_naked: // compat entry point > stp x0, xscno, [sp, #S_ORIG_X0] // save the original x0 and syscall number > + isb_if_eqs > enable_dbg_and_irq > - ct_user_exit 1 > + ct_user_exit I don't think this is safe. here we issue the ISB *before* exiting a quiesecent state, so I think we can race with another CPU that calls kick_all_active_cpus_sync, e.g. CPU0 CPU1 ISB patch_some_text() kick_all_active_cpus_sync() ct_user_exit // not synchronized! use_of_patched_text() ... and therefore the ISB has no effect, which could be disasterous. I believe we need the ISB *after* we transition into a non-quiescent state, so that we can't possibly miss a context synchronization event. Thanks, Mark.