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=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 6D9C0C433C1 for ; Fri, 19 Mar 2021 16:19:02 +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 D3A1461963 for ; Fri, 19 Mar 2021 16:19:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3A1461963 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com 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:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=skkRtpsnaaTiKUaAEMJtByUwZFMWxFn57zyMU/wJpsk=; b=VnIG7D2jT1Bu++GU/y+iuHRvZ pACD9C6dKldzVpiBoE7JXdexjWXQaBJTZ7YyiGvrOMzur3kjYl6dXvUwIDkAdy+pNboPMjLwRXCQ+ Fa9gAA/mYxkEVdMWA0v6uCaotFhkqyY43LzDkDpyzPzlH4oel8/v1V69q/mR2joWUYMxp6yXA6PRs 6lSu1LQNeZqCWI547Jk25IyUmuIIr/ZIwb2EV8nQsBvGoAQe4Iay+kJIcrXi6oJs99wenvNVIdwOu g7JvWgGujhk8cI5Ur2RgDUbq9kDOPaVFnPT5YTMkYM9cj4lAJvDEbVKYTonHufsyUmQxnzcFF7jXV B5ODeIh+A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNHoZ-007g33-4V; Fri, 19 Mar 2021 16:17:31 +0000 Received: from mail-vs1-xe33.google.com ([2607:f8b0:4864:20::e33]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lNHoV-007g2i-16 for linux-arm-kernel@lists.infradead.org; Fri, 19 Mar 2021 16:17:29 +0000 Received: by mail-vs1-xe33.google.com with SMTP id h25so3778862vso.2 for ; Fri, 19 Mar 2021 09:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Rt1xbgAbnwLYYjFpykXaHRDqBSAXyYdKNm2t1F1L7JI=; b=ogcJzaM3vfh24d6Al8bx+0Ztgu6erlK61zGnd6i9OYYJSH5cyaY+E6owFsQf5SMksz 2SqY+8Zlx2zXuFQ2igs6wHd4jsY+rG8ubwzzCQfH0nBbdFjAAkQzeSP2QV+sfuDb7u2N 3kkhe4gjLmP06beUsI0bKk0xj3Inr9z17AQ2IX200PoZ+UOmmYCM57qCkEIMaK7ARkya O5yESSQScUScma+nL3OJwttJg9bJSxt/FXvEFByc24AYNDYICi0NCf4i7d9tnbEK6gZk yhExuLXPXld4TNYY8ZNxF7XNkTdx0D4+kePDp+I8lQReJeEyTkamYIT2PPfuas1xf5Ey g0Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Rt1xbgAbnwLYYjFpykXaHRDqBSAXyYdKNm2t1F1L7JI=; b=lwUXOl92VeHvmIl8bUc7f5auYxbkFSxgC05K9sSH5llb7t0PrgfxmKa32jm4wNHmFH 22wiZcp0KAw1FT5+FC1xKWhPDe6mXt5E/qFJgeK8GyK/5watmNp7m4zlFpb6qTYciWI1 mDCiPmCRzEzSP53Zdhu6IY/r0HWS3Mi9mSTPomRwfh0q+AgGIixuwC3p4QEFK+/DTpo+ pAw+k88NaONDbjsTgvRZ0AFJVV21Cj5OTsQ10W3k1PU8Bd+mTrlhL/8VMr5zbDG3964n rN8XzOF9ynoGKL8ThKxPXZTz+JMuYJwGpfoZuPneeVORKmoo9oPetwLvkNfmvjfLpYCo YCcQ== X-Gm-Message-State: AOAM531ql7FU2o9u80UVDdvrPPivH4ZCzfUKLudbJFfLCfED2aIiwxuF CTWZC3oW32Lr+W8LpNdz/TXZ3vmFH8E+4NIl8CowvA== X-Google-Smtp-Source: ABdhPJw/sKF7iBW/KvkyGt5OC+722c1f7HkWufJpz/iIWy7f6/foyV9HotQx8W5rT++ceDlCVYoayDD6dEG1LSfx1Ao= X-Received: by 2002:a67:b447:: with SMTP id c7mr3324630vsm.54.1616170645439; Fri, 19 Mar 2021 09:17:25 -0700 (PDT) MIME-Version: 1.0 References: <20210318171111.706303-1-samitolvanen@google.com> <20210318171111.706303-2-samitolvanen@google.com> <20210319135229.GJ2696@paulmck-ThinkPad-P72> In-Reply-To: <20210319135229.GJ2696@paulmck-ThinkPad-P72> From: Sami Tolvanen Date: Fri, 19 Mar 2021 09:17:14 -0700 Message-ID: Subject: Re: [PATCH v2 01/17] add support for Clang CFI To: "Paul E. McKenney" 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210319_161727_336446_50263677 X-CRM114-Status: GOOD ( 23.44 ) 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: , 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 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. Sami _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel