Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp358201img; Thu, 28 Mar 2019 00:56:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzY2h6BKJiOXsADzBiUr0Hpr07kl0iXeKBH3ZKp6g6DqEhT4xWbIBU/wdsTPH2Is51529q8 X-Received: by 2002:a17:902:2a0b:: with SMTP id i11mr41352113plb.324.1553759812817; Thu, 28 Mar 2019 00:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553759812; cv=none; d=google.com; s=arc-20160816; b=uy35jJskxFNAUYykY+lHK/FC1xXe9/RFjBmGKWIn2Dzv431p/6BJkKKPSybfWjwg9o fQWN7n5CxhFe6WpQqD+/ggZZdyfXESCHHTN7vPxzXGlUvVuiglfxElj5UPKs3YPrj9Hl hAagFoyFbLBvRNt2YHGXizNdjLCWGYJTdY8CVr76TKY+zreoeVGxBYiwQ3pg9RaO5q60 MUuXx7bU1TZxFF8AF6fvxZ9SJ5zssm6SzTB2rZ3UFbUcJneE/IJr3H4MP+SUhYQWcX+Y iOFf4r4BjfdWFBtey79UZZrRBGamvSUiplymDSy4Kvd/3dmJng+jQlyDkVCF3y9cZVAz WDAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:subject:cc:to:from:date; bh=7DDiRbTCGuVhoCqRsJ2kiO0JIc+mlj/I127iayjK0Pc=; b=cXlNPjZRcdYJMS2wsTI7ODCfZjDoz0FqBizO/7g1jFL/ZZ6t2sDCdE+0jPyTzOX9Yc etb/+q+GkmHMkBkaPMee7qiYVp3AaqtATQcG9Hmy5mlrHq98MnTlKcG/L7S4HxlMVCtW xkNe50FeJzpQ2x1VnaJT7/KchUknUD8IJgnhyHd3cMPx6j5sZcIXbfFrCI4RLEfT830F gDZJ4JOQzO/9zVAsbEIx29sMzhg34ywy+xjOX6Xm3kzqOJDLM8Y/Nrr7xONCmjT+6P3M psCVsugDbfWCziUYLQY0fFJKD1MIMwb4ChokDyKWRj/LVsYwBRiZf7XSix4arIEmkWEE MkbQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si9804337plq.211.2019.03.28.00.56.37; Thu, 28 Mar 2019 00:56:52 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726587AbfC1Hzj (ORCPT + 99 others); Thu, 28 Mar 2019 03:55:39 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:42046 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725779AbfC1Hzi (ORCPT ); Thu, 28 Mar 2019 03:55:38 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2S7nxUr015146 for ; Thu, 28 Mar 2019 03:55:37 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rgrrwbpst-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 28 Mar 2019 03:55:37 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 28 Mar 2019 07:55:34 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 28 Mar 2019 07:55:30 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x2S7tT4428377104 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Mar 2019 07:55:29 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3364D4203F; Thu, 28 Mar 2019 07:55:29 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7391A42041; Thu, 28 Mar 2019 07:55:28 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.8.112]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 28 Mar 2019 07:55:28 +0000 (GMT) Date: Thu, 28 Mar 2019 09:55:26 +0200 From: Mike Rapoport To: Christoph Hellwig Cc: Anup Patel , Palmer Dabbelt , Anup Patel , "linux-kernel@vger.kernel.org" , Atish Patra , Albert Ou , Paul Walmsley , "linux-riscv@lists.infradead.org" Subject: Re: [PATCH v3 4/4] RISC-V: Allow booting kernel from any 4KB aligned address References: <20190325092234.5451-1-anup.patel@wdc.com> <20190325092234.5451-5-anup.patel@wdc.com> <20190325113935.GD27843@infradead.org> <20190325145919.GB14826@infradead.org> <20190327075441.GA29894@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190327075441.GA29894@infradead.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 19032807-0012-0000-0000-000003083ADB X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19032807-0013-0000-0000-0000213F6AC0 Message-Id: <20190328075526.GC14864@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-03-28_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903280059 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 27, 2019 at 12:54:41AM -0700, Christoph Hellwig wrote: > On Mon, Mar 25, 2019 at 09:46:59PM +0530, Anup Patel wrote: > > > Why do you even care about kernel mappings for non-existant ram. > > > > We care because there will always be some buggy kernel driver/code going > > out-of-bound and accessing non-existent RAM. If we by default map all > > possible kernel virtual address then behaviour of buggy accesses will be > > unpredictable. > > > > Further, I think we should also make .text and .rodata sections of kernel > > as read-only. This will protect kernel code and rodata. > > All of that is useful at the final_setup_vm() time - but none of it > matters during early setup_vm where life is complicated. > > Mike suggested on the previous iteration that you only do smaller > mappings when setting up the final mapping to avoid the ops churn, > and I fully agree with him. > > So I would suggest we avoid complicated the fiddly early boot changes > that just add complxity, and you instead redirect your efforts to > say implemented proper ro and non-executable sections using 4k mappings > in the final VM setup only. That should actuall lead to less code > and complexity, and provide more benefits. It might be worth keeping trampoline_pg_dir if we are to split setup_vm(). Then setup_vm() will only initialize the trampoline_pg_dir and final_setup_vm() will setup the swapper_pg_dir and switch to it. Otherwise final_setup_vm() would need to update live mappings which might be fragile. -- Sincerely yours, Mike.