Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754337AbbGFKsg (ORCPT ); Mon, 6 Jul 2015 06:48:36 -0400 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:51095 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753695AbbGFKsf (ORCPT ); Mon, 6 Jul 2015 06:48:35 -0400 Date: Mon, 6 Jul 2015 11:48:12 +0100 From: Russell King - ARM Linux To: Robert Richter Cc: Marc Zygnier , Thomas Gleixner , Jason Cooper , Robert Richter , Tirumalesh Chalamarla , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 3/4] irqchip, gicv3: Implement Cavium ThunderX erratum 23154 Message-ID: <20150706104812.GD7557@n2100.arm.linux.org.uk> References: <1435673643-31676-1-git-send-email-rric@kernel.org> <1435673643-31676-4-git-send-email-rric@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1435673643-31676-4-git-send-email-rric@kernel.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1264 Lines: 32 On Tue, Jun 30, 2015 at 04:14:02PM +0200, Robert Richter wrote: > +static u64 gic_read_iar_cavium_thunderx(void) > { > u64 irqstat; > > + asm volatile("nop;nop;nop;nop;"); > + asm volatile("nop;nop;nop;nop;"); > asm volatile("mrs_s %0, " __stringify(ICC_IAR1_EL1) : "=r" (irqstat)); > + asm volatile("nop;nop;nop;nop;"); > + mb(); NAK. Please read the GCC manual for proper use of asm(). Even with "volatile" there, it doesn't stop GCC from inserting instructions between these. If you need an instruction sequence to be consecutive, then it _must_ be one single asm(). There should also be a comment explaining why that code is necessary here. Please think about the future when you've forgotten why those nops are there. The kernel is a long term project, and it's important that people understand why things are coded the way they are so that the kernel can be properly maintained into the future. -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/