From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17AFBC433C1 for ; Fri, 19 Mar 2021 17:05:11 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A55176195E for ; Fri, 19 Mar 2021 17:05:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A55176195E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:Reply-To:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cNHvapXFo8yH6aGItXrFs6dquUYy2zeDMJFBLLNsYwo=; b=FONdG7x4I40AgzeulQkPhtBoe uPEcsv8YGfLb0Cvd2/NXtv3u5aax4CW7lTx/+OiZhUqfp36iJRk/ju1g6Tv+ag9zEHjYKOpAJ1nv+ zWWjb6APjI9chXqx5/I3DuL4nMfLHFD8Rf/REgqWAvzkPMkTCjLIO+5EN9DFRtRliukkCrPGxOTAy 9ozhKlW+qUNWh2/WZRNR2HvyCjDpmGxB75I5TQb1PsTOdvJN/mj19BxoX4fzsjBfBToQRtUnKYsZk wGyk/Ti0bffg6QeEX73swXMvb39SbicyrCyV/wrJGlVha8vbjS2DaeXRXcsPgg4406CEzHMls2aJR Iz3QxY6Yw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNIXO-007o1b-C8; Fri, 19 Mar 2021 17:03:50 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lNIXI-007o0W-Uj for linux-arm-kernel@lists.infradead.org; Fri, 19 Mar 2021 17:03:47 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 59D4A61959; Fri, 19 Mar 2021 17:03:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616173423; bh=fnbNfVXXSTD6OJ8WdQ6LVfKjqUArSJ75bhS89QA902k=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=B1GcSm/D1kNRA0qRKWzu/c3ZKpVm3TzqwxezJDa+PSERqt2ezZwTqJ0xg/uqfvb/A QC/GflPaOyJQBVdzr3zYPnsDs4Pozyl0h/stZmVQiOrVAIGZHZ9uOPrYZPAUjY1sQI 55M9NmgMJUikwyNi2jBgszYm0vpHXn7pI7PdXnx+ic7lPPI8VwNmzrXaGOtLMy/+2V /qnVKM8XZrhfihkUovSYDaVyEI1ZGJNLhviLxUFpgEWAEL7Mh+3Tygq0V/g55+xvwZ ByQzENQ8wRkvL83YCA0EOwh+yssAHg2V5QlRjn785+0aTg/sFOd7dX6GARRr2wMA8m b+IBDwwCHhg/Q== Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 017E035239E5; Fri, 19 Mar 2021 10:03:42 -0700 (PDT) Date: Fri, 19 Mar 2021 10:03:42 -0700 From: "Paul E. McKenney" To: Sami Tolvanen Cc: Peter Zijlstra , Kees Cook , Nathan Chancellor , Nick Desaulniers , Masahiro Yamada , Will Deacon , Jessica Yu , Arnd Bergmann , Tejun Heo , Christoph Hellwig , bpf , linux-hardening@vger.kernel.org, linux-arch , linux-arm-kernel , linux-kbuild , PCI , LKML Subject: Re: [PATCH v2 01/17] add support for Clang CFI Message-ID: <20210319170342.GM2696@paulmck-ThinkPad-P72> References: <20210318171111.706303-1-samitolvanen@google.com> <20210318171111.706303-2-samitolvanen@google.com> <20210319135229.GJ2696@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210319_170345_506667_BB0EB6AC X-CRM114-Status: GOOD ( 25.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: paulmck@kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Mar 19, 2021 at 09:17:14AM -0700, Sami Tolvanen wrote: > On Fri, Mar 19, 2021 at 6:52 AM Paul E. McKenney wrote: > > > > On Fri, Mar 19, 2021 at 01:26:59PM +0100, Peter Zijlstra wrote: > > > On Thu, Mar 18, 2021 at 04:48:43PM -0700, Sami Tolvanen wrote: > > > > On Thu, Mar 18, 2021 at 3:29 PM Peter Zijlstra wrote: > > > > > > > > > > On Thu, Mar 18, 2021 at 10:10:55AM -0700, Sami Tolvanen wrote: > > > > > > +static void update_shadow(struct module *mod, unsigned long base_addr, > > > > > > + update_shadow_fn fn) > > > > > > +{ > > > > > > + struct cfi_shadow *prev; > > > > > > + struct cfi_shadow *next; > > > > > > + unsigned long min_addr, max_addr; > > > > > > + > > > > > > + next = vmalloc(SHADOW_SIZE); > > > > > > + > > > > > > + mutex_lock(&shadow_update_lock); > > > > > > + prev = rcu_dereference_protected(cfi_shadow, > > > > > > + mutex_is_locked(&shadow_update_lock)); > > > > > > + > > > > > > + if (next) { > > > > > > + next->base = base_addr >> PAGE_SHIFT; > > > > > > + prepare_next_shadow(prev, next); > > > > > > + > > > > > > + min_addr = (unsigned long)mod->core_layout.base; > > > > > > + max_addr = min_addr + mod->core_layout.text_size; > > > > > > + fn(next, mod, min_addr & PAGE_MASK, max_addr & PAGE_MASK); > > > > > > + > > > > > > + set_memory_ro((unsigned long)next, SHADOW_PAGES); > > > > > > + } > > > > > > + > > > > > > + rcu_assign_pointer(cfi_shadow, next); > > > > > > + mutex_unlock(&shadow_update_lock); > > > > > > + synchronize_rcu_expedited(); > > > > > > > > > > expedited is BAD(tm), why is it required and why doesn't it have a > > > > > comment? > > > > > > > > Ah, this uses synchronize_rcu_expedited() because we have a case where > > > > synchronize_rcu() hangs here with a specific SoC family after the > > > > vendor's cpu_pm driver powers down CPU cores. > > > > > > Broken vendor drivers seem like an exceedingly poor reason for this. > > > > The vendor is supposed to make sure that RCU sees the CPU cores as either > > deep idle or offline before powering them down. My guess is that the > > CPU is powered down, but RCU (and probably much else in the system) > > thinks that the CPU is still up and running. So I bet that you are > > seeing other issues as well. > > > > I take it that the IPIs from synchronize_rcu_expedited() have the effect > > of momentarily powering up those CPUs? > > I suspect you're correct. I'll change this to use synchronize_rcu() in v3. You might also suggest to the vendor that they look for a missing rcu_idle_enter(), rcu_irq_exit(), or similar on the code path that the outgoing CPUs follow before getting powered down. That way, they won't be wasting power from irrelevant IPIs. You see, RCU will eventually send IPIs to non-responding CPUs for normal grace periods. Thanx, Paul _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel