Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935839AbdIYPoK (ORCPT ); Mon, 25 Sep 2017 11:44:10 -0400 Received: from mail-qk0-f174.google.com ([209.85.220.174]:53637 "EHLO mail-qk0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933472AbdIYPoI (ORCPT ); Mon, 25 Sep 2017 11:44:08 -0400 X-Google-Smtp-Source: AOwi7QDodRo5KgmEVl8j8bU9fO8RCbKtO5+WZenZYhGruf675KIRFk+sNw8S8oE9+OEUfsPCe/aBKw== Date: Mon, 25 Sep 2017 08:44:04 -0700 From: Tejun Heo To: Mark Rutland Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Christoph Lameter , Peter Zijlstra , Pranith Kumar , linux-arch@vger.kernel.org Subject: Re: [PATCH] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts Message-ID: <20170925154404.GA560070@devbig577.frc2.facebook.com> References: <1506345872-30559-1-git-send-email-mark.rutland@arm.com> <20170925151826.GK828415@devbig577.frc2.facebook.com> <20170925153301.GA29775@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170925153301.GA29775@leverpostej> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1151 Lines: 32 Hello, On Mon, Sep 25, 2017 at 04:33:02PM +0100, Mark Rutland wrote: > Unfortunately, the generic this_cpu_read(), which is intended to be > irq-safe, is not: > > #define this_cpu_generic_read(pcp) \ > ({ \ > typeof(pcp) __ret; \ > preempt_disable_notrace(); \ > __ret = raw_cpu_generic_read(pcp); \ > preempt_enable_notrace(); \ > __ret; \ > }) I see. Yeah, that looks like the bug there. > I guess it'd be preferable to manipulate that in-place. > > > Adding READ_ONCE() doesn't generically guarantee that the reads won't > > be split - e.g. there are arch which simply can't load a 64bit value > > with a single instruction. > > In which case, it really sounds like this_cpu_generic_read() needs to > disable interrupts too... Can you please spin up a patch for this? Thanks. -- tejun