Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3965130imm; Mon, 6 Aug 2018 13:59:58 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdPjLNle90N0/xtDTNPSffURZVEU8iYx/5/ILfsfmDvt4RH79ChIveYaRUGUPNBKQvM1VV1 X-Received: by 2002:a63:3e4d:: with SMTP id l74-v6mr16234044pga.355.1533589198430; Mon, 06 Aug 2018 13:59:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533589198; cv=none; d=google.com; s=arc-20160816; b=u+Fv2o4ZpEVrrJvYqiXFCdS9aylK0n8+Db8LQAD0GG7SGeoWNSVlxik3BEiaxPhb98 +qR5so9fbszJJFETs2pepJHfBnDixD9/VJQGnSPliWD09n8+pXCbdzsIrgsg1eEliD2r 28xLi07h76UWIIUmmSfRvgaSnz0hgK/qsXyYNyMwPyzxQvrbs2bsf/806ucCmCt2fj0n mZbUc7ySgkzOXMwvjWCyRFeKfYglv/1H4xIq4Ykzl0V4PbrvV2fg/GkjfvCib5kph+/P teUOtlUu4VVlmYx7A5K/Z/j+Ki2iN2LbZPbUXT6+sb22T9NQ6C/jbmbY5Fa6Fo+GBgrm 91rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:from:cc:references:in-reply-to :message-id:date:subject:dkim-signature:arc-authentication-results; bh=4iCJEA3UP8hOOZRRqsKYiSOqErWauh/Xsk0738xT6do=; b=nnfsvNxdLt12XKddiwfwtFG+Q+K+Vds0IGBZ9sEqdzJS5SqU9Koc18chC2NyPvlA2r 3DEw9LnKjSdBV2iKaBAr7V2jt93MI5pzFqUmX/siWSpseZenhiGEmaC7Av34Ev3a3f7o 5LzmLPfoqlsWaPmz7UasJgBDH927hve0SuFa2S3b0t6lPBqJikAAJWcnsMVvOzEOWLFz KU4yh9Xg076LacQCzAUzclu41LzgEujJbvnqMhL7h2tzaGlM7wPekdeKm1DKIhgkK8Qk mtT7kv3pgHN8p/8Hi9WOoXcgjf4iLZBrlLVw3cmITySSTki9tm7J2chF9n8UX4P4gpz0 xKTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=hk5IWS5B; 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 o8-v6si13557577pgo.2.2018.08.06.13.59.43; Mon, 06 Aug 2018 13:59:58 -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=pass header.i=@sifive.com header.s=google header.b=hk5IWS5B; 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 S1732733AbeHFXJq (ORCPT + 99 others); Mon, 6 Aug 2018 19:09:46 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:40856 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728948AbeHFXJp (ORCPT ); Mon, 6 Aug 2018 19:09:45 -0400 Received: by mail-pl0-f65.google.com with SMTP id s17-v6so6137963plp.7 for ; Mon, 06 Aug 2018 13:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=subject:date:message-id:in-reply-to:references:cc:from:to; bh=4iCJEA3UP8hOOZRRqsKYiSOqErWauh/Xsk0738xT6do=; b=hk5IWS5BRt+nJy6ThCQaB8XicqmvReDnDJUu+itoxwaI1vauaCFjL7yN2ZVXKmJOZr udaVeYQqOpG92oyPH58rPoKSikvGRk9TloS7+HryDTVYrF65OqIO7fLWBupHFVv3zh8C H+Nr+HTb4M0GNznqr8REkqgysVHHcQKJzWdk8EKSoIo03oVwxtRAgSuLheDLjAvQXZ/i yLl2YYluSxtqlzR5/lNUZTDlesB4P06EqmXgwn7ZUBntt+eaagN4vHlVYtTCaeFVwKsQ sPTOB6uRdk2Vcgv5EBdVgGn3jVCgBYgDHDmIHrM4Hu0mArFybSTBD2JsgGi06qLzZdL+ O+Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :cc:from:to; bh=4iCJEA3UP8hOOZRRqsKYiSOqErWauh/Xsk0738xT6do=; b=WDE3dqMoXTvifmNxHqLN6T+Vd2GrYKq9sByVrEXE+fmqFxAepRqk0h1gstw1jdVz9G IqcxhFsC5Js6kvWnCcovNudvK+Sm5WdIhLKBks66x1KpC8VI95SlgAvKCx6wIqX601ER YG4T4XQRSz+u6mjGR5iMJ4QNZvxX0xrNxSKfdfUs5X9V+LR0KUWWmvU84u6Dfp09vrWF fGzS3vCbZEUrrXJfMgdBFbHl+jQXsPlm5Q5K3npKlb4CFyFZ481RbKN+VXXbO7co0Gcq AmhW/V7mHSfJHPqBNa5uqpik/AKOJNdJZhQ3wByu+d8cLeUs7jA6e9cut5nmCR126FuV VaZQ== X-Gm-Message-State: AOUpUlE5EBHIZsaBLHZEB8OAMNfIOhW85Szd+zEoABFT0r1xARS8SWJc NesZW6gpOrxV2lzQXnNCgLLAxw== X-Received: by 2002:a17:902:b944:: with SMTP id h4-v6mr14935937pls.157.1533589133590; Mon, 06 Aug 2018 13:58:53 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id p5-v6sm16399921pfn.57.2018.08.06.13.58.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Aug 2018 13:58:52 -0700 (PDT) Subject: [PATCH v2] RISC-V: Don't use a global include guard for uapi/asm/syscalls.h Date: Mon, 6 Aug 2018 13:42:58 -0700 Message-Id: <20180806204258.22280-2-palmer@sifive.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180806204258.22280-1-palmer@sifive.com> References: <20180804085438.GA15840@infradead.org> <20180806204258.22280-1-palmer@sifive.com> Cc: Palmer Dabbelt , aou@eecs.berkeley.edu, Arnd Bergmann , tklauser@distanz.ch, linux-kernel@vger.kernel.org, Marcus Comstedt From: Palmer Dabbelt To: linux-riscv@lists.infradead.org, Christoph Hellwig Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/riscv/include/asm/unistd.h | 5 +++++ arch/riscv/include/uapi/asm/syscalls.h | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/arch/riscv/include/asm/unistd.h b/arch/riscv/include/asm/unistd.h index 080fb28061de..508be1780323 100644 --- a/arch/riscv/include/asm/unistd.h +++ b/arch/riscv/include/asm/unistd.h @@ -11,6 +11,11 @@ * GNU General Public License for more details. */ +/* + * There is explicitly no include guard here because this file is expected to + * included multiple times. See uapi/asm/syscalls.h for more info. + */ + #define __ARCH_WANT_SYS_CLONE #include #include diff --git a/arch/riscv/include/uapi/asm/syscalls.h b/arch/riscv/include/uapi/asm/syscalls.h index 818655b0d535..690beb002d1d 100644 --- a/arch/riscv/include/uapi/asm/syscalls.h +++ b/arch/riscv/include/uapi/asm/syscalls.h @@ -1,10 +1,13 @@ -/* 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 +23,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) -- 2.16.4