Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp424360imm; Fri, 10 Aug 2018 13:57:22 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxBXcNk/MKrFUgdpIOhl9rxKhFEf6ZytUeU/geiGDWGCAJYosvyzIFrgOCvUQuTNYO9YaYt X-Received: by 2002:a17:902:7c89:: with SMTP id y9-v6mr7474305pll.187.1533934642770; Fri, 10 Aug 2018 13:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533934642; cv=none; d=google.com; s=arc-20160816; b=GvjG3qRwsNyUekFjKAqZ2xfrbVVx1k/PhJyBtP2hxys0BPGT47vpoufhrwF2m+0Ija EWFWdJAqzVDnXCKqZjeJMhRlp6DinPTWRfIJvVSCL4h3ET3bXd8MyM2TkwfWBND7y4sY bWZ4eEnLd4IarAadxvjQf21Ri695cohNvlCfmGD/RU8qk+HlC1Ff9HaHoPUe6S/5mOTS GeREuAVujJj5ZS+iChfUeZVURKRDvYCyz/jZ211hcTS6gjSjYB+ahJMekuhXPZaobr0N 1yie18jFutDiYPdcwQuf8wr5D8YH/MosagLjOEtphMarV+1qjuuwDmPqzsALXLieabzu s+IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature :arc-authentication-results; bh=G9MojgZC6ijm66FAlFZ72T69ONJr0B/PGlGa0EMOD6I=; b=NnFgY/pxwhdIQTtatehpRwJigqc9Bg6vn129RkThBcTUmRalYnSKc6rUhTXjZTx0cy cpCTviMqTq6yeBFUcwAFJWRNjWqIo3lTD/N6H9fTBxxsFPhphknD7pnuWGHrPcziNTLz sPyAeU1o5XJb8nUsfSspISFmaqrmb0WJzl9Ao2vsnmUtfNIW+bO/3DF39mII44dV8yVO 166CuoA0camwX39KIrtQqFP4bp5UjtFRiaUG+KWmV60k8HpO75fAkNa+kIhyDBtukBkp 4h23k7fiXkSk9uztUa+ZWTjT8qYpvocLpBvcACG0q2MvpyOsy/ZnSLB1AvfhfmYszA/v wRQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=SMTZgaTz; 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 k22-v6si8586009pll.118.2018.08.10.13.57.07; Fri, 10 Aug 2018 13:57:22 -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=SMTZgaTz; 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 S1727273AbeHJX0q (ORCPT + 99 others); Fri, 10 Aug 2018 19:26:46 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42010 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727024AbeHJX0q (ORCPT ); Fri, 10 Aug 2018 19:26:46 -0400 Received: by mail-pf1-f194.google.com with SMTP id l9-v6so5044939pff.9 for ; Fri, 10 Aug 2018 13:55:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=G9MojgZC6ijm66FAlFZ72T69ONJr0B/PGlGa0EMOD6I=; b=SMTZgaTz3SqbLS348cpG1JJNgnv/PspT9HvIUed0vGRdOpQaGkWK2NQ0igjmUGEGo9 jCglVF/aNbOEaEjtfjD8vytqtu1R/GEddupmVXxHgNslK+Vgn/55GWQD+63EsNbjYCVP zgtJuLywILxX2KE0NOJuvNHLa/CCDvQ2QkftuUfN9MeBP8XR8NbqgpWABwcVGBjVihPx mOqiHMniLPknJ7lTb9Nzqy8SADx+f/9dFBOkAjJkcWO7BFdyCWziqQ7T+ZdWxB2JQsOr HbuJbm2MRxBKIcAD6nivXgXQRpqjorp80ZYDzgmL+VgBxaDcvZ+hnb2T9/SxK8yXeBnn njAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=G9MojgZC6ijm66FAlFZ72T69ONJr0B/PGlGa0EMOD6I=; b=LSWO8Zapl50OESpbVmKQWW+HdOnvUr/7dQRDGjw+f4padYkUFMG4fZ1aZy8KsF6aKY wgcEt6sQUxdLl7FPnunq61+KHf8gm4A1mEDWDguyTjcWLW7Ijc+QugXp7PwXXKSbM8oN E4D7HvODqBFm3rD3F2KSRqSwBG0YOpAKhSXiwTpi2/xz8itLeUS66CdnzXrdTGOpkBkx nG3XEmXiyjkGcTHQxpnT8YS7Q4NCFLDuUfWdAlHTmikz+Uu2BhPR7O8LIygR7VDoiua2 naQxRKkn6U29ZkYjDqhby/ovWSmA4hlP//3WUeyaIi3pU9I7BJ3Uc4j0h1G+P2hj6xCi Q45A== X-Gm-Message-State: AOUpUlH7Jx9WT2Iedy+WP1HH20FFhsekkBhIMFHcDTBFctk/J3CLreys xKyM09Ymyx+LwpUtKAS1aFq/CA== X-Received: by 2002:a62:3703:: with SMTP id e3-v6mr8586708pfa.117.1533934516804; Fri, 10 Aug 2018 13:55:16 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id b195-v6sm20758294pfb.2.2018.08.10.13.55.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 13:55:15 -0700 (PDT) Date: Fri, 10 Aug 2018 13:55:15 -0700 (PDT) X-Google-Original-Date: Fri, 10 Aug 2018 13:54:18 PDT (-0700) Subject: Re: [PATCH v3 1/2] RISC-V: Define sys_riscv_flush_icache when SMP=n In-Reply-To: <20180810184715.GA11259@roeck-us.net> CC: Christoph Hellwig , aou@eecs.berkeley.edu, Andrew Waterman , Arnd Bergmann , linux-kernel@vger.kernel.org, linux@dominikbrodowski.net, dan.carpenter@oracle.com, tklauser@distanz.ch, linux-riscv@lists.infradead.org From: Palmer Dabbelt To: linux@roeck-us.net Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 10 Aug 2018 11:47:15 PDT (-0700), linux@roeck-us.net wrote: > On Fri, Aug 10, 2018 at 11:27:37AM -0700, Palmer Dabbelt wrote: >> On Fri, 10 Aug 2018 01:38:04 PDT (-0700), Christoph Hellwig wrote: >> >On Thu, Aug 09, 2018 at 03:19:51PM -0700, Palmer Dabbelt wrote: >> >>This would be necessary to make non-SMP builds work, but there is >> >>another error in the implementation of our syscall linkage that actually >> >>just causes sys_riscv_flush_icache to never build. I've build tested >> >>this on allnoconfig and allnoconfig+SMP=y, as well as defconfig like >> >>normal. >> > >> >Would't it make sense to use COND_SYSCALL to stub out the syscall >> >for !SMP builds? >> >> I'm not sure. We can implement the syscall fine in !SMP, it's just that the >> vDSO is expected to always eat these calls because in non-SMP mode you can >> do a global fence.i by just doing a local fence.i (there's only one hart). >> >> The original rationale behind not having the syscall in non-SMP mode was to >> limit the user ABI, but on looking again that seems like it's just a bit of >> extra complexity that doesn't help anything. It's already been demonstrated > > Doesn't this mean that some userspace code will only run if the kernel was > compiled for SMP ? I always thought that was unacceptable. Well, the officially sanctioned way to obtain this functionality is via a vDSO call. On non-SMP systems it will never make the system call. As a result we thought we'd keep it out of the ABI, but after looking again it seems yucky to do so. Here's the vDSO entry, for reference: ENTRY(__vdso_flush_icache) .cfi_startproc #ifdef CONFIG_SMP li a7, __NR_riscv_flush_icache ecall #else fence.i li a0, 0 #endif ret .cfi_endproc ENDPROC(__vdso_flush_icache) Note that glibc has a fallback to make the system call if it can't find the vDSO entry, but then doesn't have a secondary fallback to emit a local fence.i if the system call doesn't exist. It seems easier to fix the kernel to always provide the syscall and just call it a bug.