Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2346298imm; Thu, 11 Oct 2018 08:52:15 -0700 (PDT) X-Google-Smtp-Source: ACcGV61yjj3nroG5rdCp9T5xglXy+xtUebDapO7Nbtbbeukz22A6lASQq+vEafCTDpXD1E7UQV8P X-Received: by 2002:a17:902:27a8:: with SMTP id d37-v6mr2104868plb.318.1539273135213; Thu, 11 Oct 2018 08:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539273135; cv=none; d=google.com; s=arc-20160816; b=rTCf2mi6Ru550FMh7k89XuKr0MTmRYd4V6pyH/OQmcxiZbN8hgfIjnpge2mmP9f4IU inWT90UIKT9AWAzwRM7P4wuWmmZBfcas4EQSJ3g79lllnxT5IK0hcqSFsDpgbtAZvtPP b4ntfoZeHRvY5AonRX/9OqVOxU9taoAY+b9A9ImLds38BvhOI0AjSfpj/V8GAgfuX1xq yNY1p2LjQr8H5TZYnKyZBn8ge107SjLYHoJObtYjI/9Rqz9ieH/B6bsr5TzEt+4rpcTj VoGZLjf94odCSOf68l5I05ao+FL8Vbv8kT2u6XzIHNXoBPUZB1gYO8F/Ds2QA2wKXcJF pdkw== 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=MGsDKF+/ulhMEcc0MF1/+3/OYew2cgsVbA1+fXKq7Uk=; b=nMIYsH4uIAwTOydy03EGHwSDHAeghjrW3i5YG2UlJfQwAcdQq12VxhLSs53qfcRxJQ q3FfO0oCwEB9NluuWHGppCg6OTtLNZtGo5/uKWgZmAzY+XAoDazCM8WllMwbZyq3vJ8D 9ddQU3LSXuNCw1PARTwvzcF2gMP/jVhZvWrPSM6j8+mgWcmoKOuvoEqs+De78TWGmVtx stlS568PZDG5XvreWl2UX8m2IiSOTrqFhXFHLYe1h6qSNRzZtAgdhzShAQnOphBHYBPm hNl4tjxgFGVxnSesCngKeBNsC3Je07bt67ym4/dgBuBMHeTZkuKiE69jf8GFlJrkq8L+ Ee1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=sQXZq2TL; 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 33-v6si25421808pgv.588.2018.10.11.08.52.00; Thu, 11 Oct 2018 08:52:15 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=sQXZq2TL; 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 S1731886AbeJKXS3 (ORCPT + 99 others); Thu, 11 Oct 2018 19:18:29 -0400 Received: from merlin.infradead.org ([205.233.59.134]:52700 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727375AbeJKXS3 (ORCPT ); Thu, 11 Oct 2018 19:18:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MGsDKF+/ulhMEcc0MF1/+3/OYew2cgsVbA1+fXKq7Uk=; b=sQXZq2TLM15Mj3+nfOOuvq7C4 f7Bo3OF2/0ZvvneAd3sVVLv9OWP7qrGsbidZS0ovYqhwtlzBnn+jVD9MeAsuFfW4ymstjLwxgA4xF OglLkKHIboG3pLJx80ROdwFAicJAAMcOU1tqSjr5O0LWB0aAhjJsGajIKqPl6dRUj7cUP4CwlSJU/ VGHjRp1ffVJsHIM3MryNNb4yfWHNG32Z5T4rbnwWy2yFExl63CqwAtFZw5h6liGjbJxei+8F/rV3B 8dndlOsUff2+tVMu50ALWXylYBth8RvdsIXe9Thy6A5VNYhgw0DCnZi09QxKaWuY7SZ55b3P79jN6 EkvwxBJOg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAdER-00052K-OR; Thu, 11 Oct 2018 15:50:35 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7F6C420298568; Thu, 11 Oct 2018 17:50:34 +0200 (CEST) Date: Thu, 11 Oct 2018 17:50:34 +0200 From: Peter Zijlstra To: Eric Dumazet Cc: Ingo Molnar , Thomas Gleixner , LKML , "H. Peter Anvin" , Eric Dumazet , Borislav Petkov Subject: Re: [PATCH 2/2] x86/percpu: Fix this_cpu_read() Message-ID: <20181011155034.GC9867@hirez.programming.kicks-ass.net> References: <20181011103825.023036082@infradead.org> <20181011104019.748208519@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 11, 2018 at 08:24:49AM -0700, Eric Dumazet wrote: > On Thu, Oct 11, 2018 at 8:02 AM Eric Dumazet wrote: > > > > On Thu, Oct 11, 2018 at 3:45 AM Peter Zijlstra wrote: > > > > > > Eric reported that a sequence count loop using this_cpu_read() got > > > optimized out. This is wrong, this_cpu_read() must imply READ_ONCE() > > > because the interface is IRQ-safe, therefore an interrupt can have > > > changed the per-cpu value. > > > > > > Fixes: 59eaef78bfea ("x86/tsc: Remodel cyc2ns to use seqcount_latch()") > > > Reported-by: Eric Dumazet > > > Signed-off-by: Peter Zijlstra (Intel) > > > > > > Acked-by: Eric Dumazet > > Actually the Fixes: tag seems funky. > > Bug was not added by 59eaef78bfea > > Your patch probably needs to be backported to older versions of linux, > just to be safe, since > we might have other places where authors relied on this_cpu_read() > semantic (different than this_cpu_read_stable()) Right; it goes back a long long way... is: 7c3576d261ce ("[PATCH] i386: Convert PDA into the percpu section") early enough? That introduces percpu_from_op(), but arguably the pda_from_op() it replaces was buggy already.