Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2042629imm; Thu, 9 Aug 2018 06:27:41 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxeFME5EIQy2RFoi8xNlGL92XpOoT8Ky4DUMAuR/h69XArnb/6pAZjTR7mvGrTKexlt1do/ X-Received: by 2002:a63:fc44:: with SMTP id r4-v6mr2198449pgk.169.1533821260962; Thu, 09 Aug 2018 06:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533821260; cv=none; d=google.com; s=arc-20160816; b=sCQGkY+4dL3UwpCI132U3DQfAN7VNMacrEcXjTPfoPWB9a3njKT8S8FLtFyZ4BtH5z 1sWXvsdJ6vOOABMcG5kIVsyDt/GiR1QzsR2lQQOqcOCteWDkbQL0mjFIPagcAyHfYPR2 i/zchEP6veoaFgJkWsgQQnItuRpFYxQYWObmzIprGY8NNA1RLhZMUiWoisQhsX65Hq3e MzxLPCn2gHKYs9W7XHWildFrVr9Z+3nzUy3HHKtfb9ZpK4+FlvfECLpNiLx/bm1uaefc TcCRmedeewaAkmyjsB2nmLTdAGJTbZB+kz7Spj1+DZgtL+XEyJgpBL4B/8L1V08QCSR2 VsiA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=/zX9LLbulyf4tILJ9npe5ESwtXih8ZBeMBP1v/2P9A0=; b=Bog3nVRFSBkOBnArvx8rTqwO60BX9nRG41XvzISsUzN9a8UTWhIVdB/3tK4Le6OGqN 0rNqJrEV1vVa6fYlgmbEgoFVQC9/oOdyXy06lTU4VYpnitnjMn/cYJ+5UFPmx+4BwIt7 AXdSjMfhNTiqSPvSqp5/PJrhqz6jAN+biKDd+2VWi+FaZn94233iLsrf2LlR4yQr3uz+ ug32BbZOzTor8ffdlA41sH+V2FFUkPnTLx9YlI7bKhynvMe0rmvyDRRiRnp7yJWM8Bjx nM/ZhSjvw1ftKaSxzmBkR6fRzMs9sQq6p3Q0V1je9OU/hSq/AQDrNOjSBYOS5lFP1t2e t4SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=oxO31moF; 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 o23-v6si6351932pgm.170.2018.08.09.06.27.26; Thu, 09 Aug 2018 06:27:40 -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=@gmail.com header.s=20161025 header.b=oxO31moF; 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 S1732223AbeHIPvJ (ORCPT + 99 others); Thu, 9 Aug 2018 11:51:09 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:39619 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730419AbeHIPvJ (ORCPT ); Thu, 9 Aug 2018 11:51:09 -0400 Received: by mail-pl0-f68.google.com with SMTP id w14-v6so2562818plp.6 for ; Thu, 09 Aug 2018 06:26:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=/zX9LLbulyf4tILJ9npe5ESwtXih8ZBeMBP1v/2P9A0=; b=oxO31moFX0vGVtDUp4Rgk9/tEuDN0Vo8iSDyyd1SlpZITqw8dWpUAAfAyY6/H872ou tDDcTj/sTmC1vy+zX7g9ej9Shz5yQdczR74pmTFfxoP6HQsy+JVWiMjYNj6uuBiIRKuo dFJV7N1qwaT8ZBwZxqQXp2P245HD6kSzBh0gsyn2/QIY4h927tvf0CBVhu8vCQDTSJg+ qq8y3+FpLHl9C0C2T6GKiM3bN5h33w9O43ZIogW4WtvqKVDzrFMjWbhOdQswEf41qgWh gxmh+zp2GpWQ8m2sjTA5SVwKN+ECWtUhaoTdb10ygG7FI0uKoxeQpeH/5lJv8dpSGkVJ FExg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=/zX9LLbulyf4tILJ9npe5ESwtXih8ZBeMBP1v/2P9A0=; b=rCwkYKvbvqGUjLMdQVq+ZDPOs65w4QtLDf5hXH5zauEh7wskTuIaViziVwqTbdyycm 6KJ6IYnb7cCbo7tgRkrkqD6grVJ8puKRPWQm7UL9B1NWHypmh0Vsef0SmDnpJawDoMQG jT0ZcvYalSpF5YZa7mX5Uwbn3DR1drfCvzP9GDScMJ4zhSH5Tk3ZPPXFLKIXelEPqnt6 Homv5gjQSUXCM4WwovjBA9ODmJQL7KGcO5w1g+ASDXqyzjTkGERI1ObUyLlfa7Su2Oj2 tyTeia0ktbzcKlsjVmsDHnr6T9sw/c8XYL0iVKsnIWuSVUiKYJnwuWQGSebs8qjHFJcV p06w== X-Gm-Message-State: AOUpUlE5TPogmkg97qxsIlA7dv3gF1qdCvQEtgQ0GXhjC+DtksEVxf2L HIFpNtZ1Ae/+zn7/vx+2Oos= X-Received: by 2002:a17:902:654b:: with SMTP id d11-v6mr2099915pln.8.1533821174587; Thu, 09 Aug 2018 06:26:14 -0700 (PDT) Received: from localhost (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id x184-v6sm9779054pfd.169.2018.08.09.06.26.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 06:26:13 -0700 (PDT) Date: Thu, 9 Aug 2018 06:26:12 -0700 From: Guenter Roeck To: Palmer Dabbelt Cc: linux-riscv@lists.infradead.org, aou@eecs.berkeley.edu, linux-kernel@vger.kernel.org, Marcus Comstedt Subject: Re: [PATCH] RISC-V: Don't use a global include guard for uapi/asm/syscalls.h Message-ID: <20180809132612.GA31058@roeck-us.net> References: <20180803195344.22271-1-palmer@sifive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180803195344.22271-1-palmer@sifive.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 03, 2018 at 12:53:44PM -0700, Palmer Dabbelt wrote: > This file is expected to be included multiple times in the same file in > order to allow the __SYSCALL macro to generate system call tables. With > a global include guard we end up missing __NR_riscv_flush_icache in the > syscall table, which results in icache flushes that escape the vDSO call > to not actually do anything. > > The fix is to move to per-#define include guards, which allows the > system call tables to actually be populated. Thanks to Macrus Comstedt > for finding and fixing the bug! > > I also went ahead and fixed the SPDX header to use a //-style comment, > which I've been told is the canonical way to do it. > > Cc: Marcus Comstedt > Signed-off-by: Palmer Dabbelt Fails to build riscv:allnoconfig. CC arch/riscv/kernel/syscall_table.o ./arch/riscv/include/uapi/asm/syscalls.h:29:36: error: ‘sys_riscv_flush_icache’ undeclared here (not in a function); did you mean ‘__NR_riscv_flush_icache’? Guenter > --- > arch/riscv/include/uapi/asm/syscalls.h | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/arch/riscv/include/uapi/asm/syscalls.h b/arch/riscv/include/uapi/asm/syscalls.h > index 818655b0d535..882a6aa09a33 100644 > --- a/arch/riscv/include/uapi/asm/syscalls.h > +++ b/arch/riscv/include/uapi/asm/syscalls.h > @@ -1,10 +1,11 @@ > -/* SPDX-License-Identifier: GPL-2.0 */ > +// SPDX-License-Identifier: GPL-2.0 > /* > - * Copyright (C) 2017 SiFive > + * Copyright (C) 2017-2018 SiFive > */ > > -#ifndef _ASM__UAPI__SYSCALLS_H > -#define _ASM__UAPI__SYSCALLS_H > +/* There is explicitly no include guard here because this file is expected to > + * be included multiple times in order to define the syscall macros via > + * __SYSCALL. */ > > /* > * Allows the instruction cache to be flushed from userspace. Despite RISC-V > @@ -20,7 +21,7 @@ > * caller. We don't currently do anything with the address range, that's just > * in there for forwards compatibility. > */ > +#ifndef __NR_riscv_flush_icache > #define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15) > -__SYSCALL(__NR_riscv_flush_icache, sys_riscv_flush_icache) > - > #endif > +__SYSCALL(__NR_riscv_flush_icache, sys_riscv_flush_icache)