Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp23197653rwd; Fri, 30 Jun 2023 20:31:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6bY4fA92Rp32tpZwn9Od7Et9DiFhz6yAbLYgOt/FoXcBLxdddOahPctm1Nx23Z0iWLuPZH X-Received: by 2002:a05:6808:1a99:b0:39f:393f:688c with SMTP id bm25-20020a0568081a9900b0039f393f688cmr4580264oib.22.1688182274968; Fri, 30 Jun 2023 20:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688182274; cv=none; d=google.com; s=arc-20160816; b=QwXtHvsztuuSWyw8dnAI0SuydUbKzQTU5nYtI4TndFW41Qi0rh0lAwP0ZQnOqXcajA 1WrGotza18geXcD/TSmDYN1GHyXNaq5MUQpRh6uJvbbzGWkdDnfxjEj4YvFPCeUgWzoA L8e2bOOUouAN8gD4NdgLXNn+JIp6qK7s+JN0fvSXh5WW3bMXHJ3eCDZ2sXADFeM3Oenb jVSADh1wYiYl7SXmmnqa3SUOWWpDjtoqA1E91vZysq9aZ61YrqQjdCtUIDSo9JlicufB mdmitfGXWKVYcT7A1ImE8Ec/RlhS9iT3jpjAlTNaVt7jECZNh8X2z7GRNeBLAIpnd+7r xSQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=UFqIqSRBSLc1Ges7V4RrWVh1QvEfZbr10hghH4pahl4=; fh=iqVWOJDmOuerey9ylnVnCTEWSTgbRzAFLlwmkreSj2k=; b=kkP1MT2it+nSM0sO25k6kxhfX5k8zF4zKoenqJEBn/js8oJ8FtRI9nZ6+/5/OR+Yc/ DLaZpysuSrErUdnsNYb8VcfuMFTnyTSmjmUWIgV1g4UsGSGGkAaMqi2jfydy3AEpboqB uz+gFgQwvOn7vC9woSRtDi+KJvGxg3vZmUcrsjMWLKQBI1aFk/DEshQDCE19eYCc91nr a83hbjRoV8JjiSb1ATPNAbFta44DJy0d3uSr32sjoaEfunDplBh69zByW3P4hOzRDVLS n7sx/HPGnk7OoBkbSTSOGNsGHMj+2ivmZo0Gx/bb4HlsKYp6I0bul2Q15ZXW5TF5wfd2 lYBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=joBIbtBi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j64-20020a638b43000000b00552198fe2afsi13715537pge.480.2023.06.30.20.31.00; Fri, 30 Jun 2023 20:31:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=joBIbtBi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229946AbjGAD3q (ORCPT + 99 others); Fri, 30 Jun 2023 23:29:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbjGAD2y (ORCPT ); Fri, 30 Jun 2023 23:28:54 -0400 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 996374689; Fri, 30 Jun 2023 19:49:43 -0700 (PDT) Received: by mail-qk1-x731.google.com with SMTP id af79cd13be357-7659dc74d91so251055385a.0; Fri, 30 Jun 2023 19:49:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688179782; x=1690771782; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=UFqIqSRBSLc1Ges7V4RrWVh1QvEfZbr10hghH4pahl4=; b=joBIbtBiHuJSgzRq5oUo3wvVDjYntBYzr1nu/HT0snBPFR9KqOX2u6IVdOVMcinCAi pufu6OGNMF6Zq6MnTzHrpEVO+ZqAknfkyy3O73Uify9Z5o3PJJqmdBsAy5t4SwSHpdrB jLrMVTz6SU0kfBNDkHpwUtOqLwRdQuSgLwhFec7wtrwIwLuvO+GF0u0ft6rJkE5mX7S6 RSGBczju7bXSwOXvjX9gt/hjRsOrks2Crkch0Vw4pgCTYHKFC1IZ93I549kMZWFvrfsU nuauTwH20djPpgXSYUcvHfMxUCtOMMseeDIDau6usnvH+G5gUw6GTAQryE6tSJNuz6P2 yF6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688179782; x=1690771782; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UFqIqSRBSLc1Ges7V4RrWVh1QvEfZbr10hghH4pahl4=; b=GRHP6qFvgLyDsyij2AmMtcIu8bjl5lNX1bo7M3A9r/6yCTdBV4wfiN/q9pPIxVnUO9 iUukA/gMDkIxrn+Kgb6DcPelsTwIKc+ejP3isR8Cr/A1EPQ4ilDQwj3FylGn3V7JR33O FVb78gx90ZLE8pVCXE0yHQ0KzPYfIPXAvozkyVqWk2wbccp7DPH80z6GPFI45E9pCLpo n3LriMjSYpTAbYVrI3Tvshmr+lcr1LEl+NrW9ODlT0FcLL/B3F3+gLrT5C77ZmTuOvvb uzTYzLbcSdO8uOSs5wEKrwBQQU9+wSOlIP9obgt/nqzkuLtUTsrNTyLWey17KbttJl7k kgSg== X-Gm-Message-State: AC+VfDw/eAoiO/6rKWpQVmcXU+EiciR6rEppW0qFDafN+eb6IiRYRfxF xhmR2GEU/5X5AOfN+7psWik= X-Received: by 2002:a05:620a:4249:b0:75b:23a1:3606 with SMTP id w9-20020a05620a424900b0075b23a13606mr5310663qko.23.1688179782577; Fri, 30 Jun 2023 19:49:42 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id k6-20020aa78206000000b0064aea45b040sm10510104pfi.168.2023.06.30.19.49.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 19:49:41 -0700 (PDT) Sender: Guenter Roeck Date: Fri, 30 Jun 2023 19:49:40 -0700 From: Guenter Roeck To: Linus Torvalds Cc: Chris Zankel , Max Filippov , Naresh Kamboju , Greg Kroah-Hartman , stable@vger.kernel.org, patches@lists.linux.dev, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, shuah@kernel.org, patches@kernelci.org, lkft-triage@lists.linaro.org, pavel@denx.de, jonathanh@nvidia.com, f.fainelli@gmail.com, sudipm.mukherjee@gmail.com, srw@sladewatkins.net, rwarsow@gmx.de, conor@kernel.org, linux-parisc , sparclinux@vger.kernel.org, Stephen Rothwell , Helge Deller , Jason Wang Subject: Re: [PATCH 6.4 00/28] 6.4.1-rc1 review Message-ID: References: <20230629184151.888604958@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 30, 2023 at 06:24:49PM -0700, Linus Torvalds wrote: > On Fri, 30 Jun 2023 at 15:51, Guenter Roeck wrote: > > > > There is one more, unfortunately. > > > > Building xtensa:de212:kc705-nommu:nommu_kc705_defconfig ... failed > > Heh. I didn't even realize that anybody would ever do > lock_mm_and_find_vma() code on a nommu platform. > > With nommu, handle_mm_fault() will just BUG(), so it's kind of > pointless to do any of this at all, and I didn't expect anybody to > have this page faulting path that just causes that BUG() for any > faults. > > But it turns out xtensa has a notion of protection faults even for > NOMMU configs: > > config PFAULT > bool "Handle protection faults" if EXPERT && !MMU > default y > help > Handle protection faults. MMU configurations must enable it. > noMMU configurations may disable it if used memory map never > generates protection faults or faults are always fatal. > > If unsure, say Y. > > which is why it violated my expectations so badly. > > I'm not sure if that protection fault handling really ever gets quite > this far (it certainly should *not* make it to the BUG() in > handle_mm_fault()), but I think the attached patch is likely the right > thing to do. > > Can you check if it fixes that xtensa case? It looks > ObviouslyCorrect(tm) to me, but considering that I clearly missed this > case existing AT ALL, it might be best to double-check. > > Linus Yes, the patch below fixes the problem. Building xtensa:de212:kc705-nommu:nommu_kc705_defconfig ... running ......... passed Thanks, Guenter > include/linux/mm.h | 5 +++-- > mm/nommu.c | 11 +++++++++++ > 2 files changed, 14 insertions(+), 2 deletions(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 39aa409e84d5..4f2c33c273eb 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -2323,6 +2323,9 @@ void pagecache_isize_extended(struct inode *inode, loff_t from, loff_t to); > void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); > int generic_error_remove_page(struct address_space *mapping, struct page *page); > > +struct vm_area_struct *lock_mm_and_find_vma(struct mm_struct *mm, > + unsigned long address, struct pt_regs *regs); > + > #ifdef CONFIG_MMU > extern vm_fault_t handle_mm_fault(struct vm_area_struct *vma, > unsigned long address, unsigned int flags, > @@ -2334,8 +2337,6 @@ void unmap_mapping_pages(struct address_space *mapping, > pgoff_t start, pgoff_t nr, bool even_cows); > void unmap_mapping_range(struct address_space *mapping, > loff_t const holebegin, loff_t const holelen, int even_cows); > -struct vm_area_struct *lock_mm_and_find_vma(struct mm_struct *mm, > - unsigned long address, struct pt_regs *regs); > #else > static inline vm_fault_t handle_mm_fault(struct vm_area_struct *vma, > unsigned long address, unsigned int flags, > diff --git a/mm/nommu.c b/mm/nommu.c > index 37d0b03143f1..fdc392735ec6 100644 > --- a/mm/nommu.c > +++ b/mm/nommu.c > @@ -630,6 +630,17 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr) > } > EXPORT_SYMBOL(find_vma); > > +/* > + * At least xtensa ends up having protection faults even with no > + * MMU.. No stack expansion, at least. > + */ > +struct vm_area_struct *lock_mm_and_find_vma(struct mm_struct *mm, > + unsigned long addr, struct pt_regs *regs) > +{ > + mmap_read_lock(mm); > + return vma_lookup(mm, addr); > +} > + > /* > * expand a stack to a given address > * - not supported under NOMMU conditions