Received: by 10.223.164.202 with SMTP id h10csp539655wrb; Thu, 30 Nov 2017 14:51:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMZgfF1d9OVzjeI0OgdD49vn6WwgG9CuZOEza8rbEWoIF4sNxcvkfGxpqqMStSmgx2rZWN/i X-Received: by 10.84.169.1 with SMTP id g1mr4220555plb.134.1512082288239; Thu, 30 Nov 2017 14:51:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512082288; cv=none; d=google.com; s=arc-20160816; b=QKv5lXYn/NL7h+HH4lOuLZAPc8x0jWtmLAO7UXAV5p/CB3mRY26pAE/nOmq7WMHZ6g CYDVluigji/u0AXGdfak0fRF8Ly0gIlNgMFiDgCKZhLMcsjEUyDgIugDpzf2ltFE2z7d LBlizg4DVJQ5u6mS4NfY9KyRUKbtXyIcWQiii2ZbdjlXOyfPMqapFAm114TmxKtYVlbJ Ysa5dLNBmIMzsvQdoCXIiAknjqJlXU0mMnyMt8PwqMkj/ycnCsJic8Im8qEON1VJ5Q5P xYFMHwK6bxUEeklIAAcgVynVZqtxog4R+A7HAKtwH98ULcO9as5SKRUnsun3+zcc1flq IetA== 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=rvm85smP+SobW1uT+dkW5AZqZt1iVQwo2AHVpVo33bE=; b=E0tEQIBugbc3BDEOSlZ5r7/I06HkYc4P3pe06vcC82voQ5cARLZL7Vfcw9N3gdM4G2 pxZu8Sxee8jENACXjA84p8G0o3p+C3Wv8JvgZvWopelTs9AUg5yVf+J3EMYfZi7WadSG jEGn4WF8qFi2N4+uYs+lBXzAHP6HxZd13Ghs6X9HkTBN9Vy/vBK1Etnfly1eEnPYp4PQ qBraZ9h+0VLURYgy2fsO0VuplnspNH3mF5CkC9qHjVngso3dKxm2hKlpYZLVS7OW1KCw ddW76ESmg9lecqjURGKx3EJhJ1c83qt99289cD9LgQmUyFOtonj51OaJE8L4Th5pAf10 VFJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=WQh0Lk3d; 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 r191si3746069pgr.331.2017.11.30.14.51.14; Thu, 30 Nov 2017 14:51:28 -0800 (PST) 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=WQh0Lk3d; 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 S1751217AbdK3WuU (ORCPT + 99 others); Thu, 30 Nov 2017 17:50:20 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:44482 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750849AbdK3WuT (ORCPT ); Thu, 30 Nov 2017 17:50:19 -0500 Received: by mail-pg0-f65.google.com with SMTP id j9so3620326pgc.11 for ; Thu, 30 Nov 2017 14:50:18 -0800 (PST) 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=rvm85smP+SobW1uT+dkW5AZqZt1iVQwo2AHVpVo33bE=; b=WQh0Lk3dRVNZre4DepureVtGv3mJGNSTxpv4XoQLbgcy/4eEn7WW/nhNEmRAMEk2Iq FqGf8upPY80mEhb4F9vpqKiUZ7VwgVnON9ij75gbDpJcbitpSna6IO0q982yR2ZG/nPx Lqyx1fcLrAF9YxMISdi4BffhEwufFD8z1V0PboLir8/CN3nN/o6olXeBaZ8iViXUtReZ VBjF2Q0a+N3PAlDXa7kbd/tniyCVuF0+UFbRLd4t51xzKPB/Yaurz2UoVlF7nOrLsGaU pQge4dxfP1+fyILQMn+uS6eIKg621ugxT2NDklKoCCSjRX5HybYzvVbD9ZuJ5uZLhf+9 7ShQ== 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=rvm85smP+SobW1uT+dkW5AZqZt1iVQwo2AHVpVo33bE=; b=mNucZEHrfFt9gTd83yLer+GKLsSRCqs01HCHZwosC1+9519Jm1Qv1uqX/At+EXAV/r m3LKoBLDZM1gM4YbsrXjSq2rA2SSAwz0nNqo+wR8iFRtYqEiaqNEMhXONwVnPnUhwGvH oHDEGBZ24rhYQA0h36cHnvVZgJFcSkW7nXxE9g9ryTb4PxMMt1egop/OsatN3ciCxtUX 8aMUZorMDD/YNZvGbuDKCT0XtpQEZZJum8C3r3MltkmdWMt8SiJWa68/DfJJgiRuULuJ 5EkciJq2afoIi0UEVWjSFmlB7TQmUcyRe7f4tO9h4cWuli6aRQEZu8YcQz9onujXkAUe 98eA== X-Gm-Message-State: AJaThX6yQVP4Eyi5Ef6f7mM7IzvGQ9KqwpxwCB7kPordazCqWlgrc9Wr aTtir5Cdb18naNszKfm9ypnW0y9IryxkwA== X-Received: by 10.99.148.1 with SMTP id m1mr3802550pge.237.1512082218408; Thu, 30 Nov 2017 14:50:18 -0800 (PST) Received: from localhost (rap-us.hgst.com. [199.255.44.250]) by smtp.gmail.com with ESMTPSA id n2sm7863316pgv.69.2017.11.30.14.50.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 14:50:17 -0800 (PST) Date: Thu, 30 Nov 2017 14:50:17 -0800 (PST) X-Google-Original-Date: Thu, 30 Nov 2017 14:50:09 PST (-0800) Subject: Re: [patches] [PATCH 3/4] RISC-V: Flush I$ when making a dirty page executable In-Reply-To: CC: patches@groups.riscv.org, linux-kernel@vger.kernel.org, Andrew Waterman From: Palmer Dabbelt To: Olof Johansson 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 Thu, 30 Nov 2017 12:32:04 PST (-0800), Olof Johansson wrote: > Hi, > > On Mon, Nov 20, 2017 at 10:57 AM, Palmer Dabbelt wrote: >> From: Andrew Waterman >> >> The RISC-V ISA allows for instruction caches that are not coherent WRT >> stores, even on a single hart. As a result, we need to explicitly flush >> the instruction cache whenever marking a dirty page as executable in >> order to preserve the correct system behavior. >> >> Local instruction caches aren't that scary (our implementations actually >> flush the cache, but RISC-V is defined to allow higher-performance >> implementations to exist), but RISC-V defines no way to perform an >> instruction cache shootdown. When explicitly asked to do so we can >> shoot down remote instruction caches via an IPI, but this is a bit on >> the slow side. >> >> Instead of requiring an IPI to all harts whenever marking a page as >> executable, we simply flush the currently running harts. In order to >> maintain correct behavior, we additionally mark every other hart as >> needing a deferred instruction cache which will be taken before anything >> runs on it. >> >> Signed-off-by: Andrew Waterman >> Signed-off-by: Palmer Dabbelt >> --- >> arch/riscv/include/asm/cacheflush.h | 24 ++++++++++++--- >> arch/riscv/include/asm/mmu.h | 4 +++ >> arch/riscv/include/asm/mmu_context.h | 44 +++++++++++++++++++++++++++ >> arch/riscv/include/asm/pgtable.h | 58 ++++++++++++++++++++---------------- >> arch/riscv/include/asm/tlbflush.h | 2 ++ >> arch/riscv/kernel/smp.c | 48 +++++++++++++++++++++++++++++ >> arch/riscv/mm/Makefile | 2 ++ >> arch/riscv/mm/cacheflush.c | 23 ++++++++++++++ >> 8 files changed, 175 insertions(+), 30 deletions(-) >> create mode 100644 arch/riscv/mm/cacheflush.c > > [...] > >> diff --git a/arch/riscv/mm/Makefile b/arch/riscv/mm/Makefile >> index 81f7d9ce6d88..786b5fdec0fd 100644 >> --- a/arch/riscv/mm/Makefile >> +++ b/arch/riscv/mm/Makefile >> @@ -2,3 +2,5 @@ obj-y += init.o >> obj-y += fault.o >> obj-y += extable.o >> obj-y += ioremap.o >> +obj-y += dma.o >> +obj-y += cacheflush.o > > Looks like dma.c didn't make it into this patch (and didn't already > exist), so builds fail with: > > make[3]: *** No rule to make target 'arch/riscv/mm/dma.o', needed by > 'arch/riscv/mm/built-in.o'. Ah, thanks for catching that. I'll fix up the patch. From 1585524461727881974@xxx Thu Nov 30 20:32:37 +0000 2017 X-GM-THRID: 1584612605235196569 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread