From patchwork Fri Aug 26 12:55:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 9301251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 976ED601C0 for ; Fri, 26 Aug 2016 12:55:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 892572961F for ; Fri, 26 Aug 2016 12:55:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DEDB29622; Fri, 26 Aug 2016 12:55:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C9F72961F for ; Fri, 26 Aug 2016 12:55:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753528AbcHZMzt (ORCPT ); Fri, 26 Aug 2016 08:55:49 -0400 Received: from merlin.infradead.org ([205.233.59.134]:60668 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753510AbcHZMzs (ORCPT ); Fri, 26 Aug 2016 08:55:48 -0400 Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=twins.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.85_2 #1 (Red Hat Linux)) id 1bdGfc-00008p-Es; Fri, 26 Aug 2016 12:55:40 +0000 Received: by twins.programming.kicks-ass.net (Postfix, from userid 1000) id D507C12573B0D; Fri, 26 Aug 2016 14:55:39 +0200 (CEST) Date: Fri, 26 Aug 2016 14:55:39 +0200 From: Peter Zijlstra To: Fengguang Wu Cc: dalias@libc.org, kbuild-all@01.org, ysato@users.sourceforge.jp, "linux-sh@vger.kernel.org" Subject: Re: [kbuild-all] [peterz-queue:locking/rfc 3/5] arch/sh/include/asm/atomic-llsc.h:76:38: note: in expansion of macro 'ATOMIC_FETCH_OP' Message-ID: <20160826125539.GN10121@twins.programming.kicks-ass.net> References: <201608260635.iVmpFANy%fengguang.wu@intel.com> <20160826093423.GP10138@twins.programming.kicks-ass.net> <20160826114225.hloesk72zqvajrmj@wfg-t540p.sh.intel.com> <20160826123153.oxujbw5kjoz7mtno@wfg-t540p.sh.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160826123153.oxujbw5kjoz7mtno@wfg-t540p.sh.intel.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Aug 26, 2016 at 08:31:53PM +0800, Fengguang Wu wrote: > On Fri, Aug 26, 2016 at 07:42:25PM +0800, Fengguang Wu wrote: > It's this atomic_long_fetch_and() that triggered the error. > It builds fine if line 505 is commented out. > > 503 owner = atomic_long_read(&lock->owner); > 504 if (!(owner & MUTEX_FLAG_HANDOFF)) > 505 owner = atomic_long_fetch_and(MUTEX_FLAGS, > &lock->owner); > ~~~~~~~~~~~~~~~~~~~~~ > > Cheers, > Fengguang > > >./arch/sh/include/asm/atomic-llsc.h:56:2: error: can’t find a register in class ‘R0_REGS’ while reloading ‘asm’ > > __asm__ __volatile__ ( \ > > ^ > >./arch/sh/include/asm/atomic-llsc.h:76:38: note: in expansion of macro ‘ATOMIC_FETCH_OP’ > >#define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_FETCH_OP(op) > > ^~~~~~~~~~~~~~~ > >./arch/sh/include/asm/atomic-llsc.h:78:1: note: in expansion of macro ‘ATOMIC_OPS’ > >ATOMIC_OPS(and) > >^~~~~~~~~~ > >./arch/sh/include/asm/atomic-llsc.h:56:2: error: ‘asm’ operand has impossible constraints > > __asm__ __volatile__ ( \ Yes, that much was clear from the above. I just odn't know enough about SH asm to know how to go fix it. There's a note there that says movli.l/movco.l requires r0, and maybe it somehow tries to use 2 of those. But I cannot find the inline asm constraints documented for SH: https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/Machine-Constraints.html#Machine-Constraints Ahh.. https://github.com/gcc-mirror/gcc/blob/master/gcc/config/sh/constraints.md has them... would something like so fix things? Tested-by: Fengguang Wu --- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/sh/include/asm/atomic-llsc.h b/arch/sh/include/asm/atomic-llsc.h index caea2c45f6c2..1d159ce50f5a 100644 --- a/arch/sh/include/asm/atomic-llsc.h +++ b/arch/sh/include/asm/atomic-llsc.h @@ -60,7 +60,7 @@ static inline int atomic_fetch_##op(int i, atomic_t *v) \ " movco.l %0, @%3 \n" \ " bf 1b \n" \ " synco \n" \ - : "=&z" (temp), "=&z" (res) \ + : "=&z" (temp), "=&r" (res) \ : "r" (i), "r" (&v->counter) \ : "t"); \ \