Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp11594094rwr; Sat, 13 May 2023 06:27:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4agIuxQsyjDzUE/wKnGY7DowseAg1Yq9nWI0QAmt5XgOj9xiZgbHM3FPpk9HX1+3Sz1i44 X-Received: by 2002:a17:902:ec87:b0:1a9:9ace:3e74 with SMTP id x7-20020a170902ec8700b001a99ace3e74mr35777425plg.65.1683984425486; Sat, 13 May 2023 06:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683984425; cv=none; d=google.com; s=arc-20160816; b=YDReB2oOd8ebJOg8JLu15q77rfXFA83CBtXkEyWwepJLRm+wIgE3J+l7Ou3wSmI5sg mgzQ6PlZYffxh6uOMcnXylcxATr7SzCDdvZgc6jcpYR5rGRVlWtgw6Sw42ODtDgLkvwl +R86ho+LDex+7U/gwwO42xCKL3NOCiSAdj5laIGzrPD82otSoO2W+xPJiyAptMCVQjMd NcFldgNK3S1nat4M+0bXKcpXPcbMHbxKCgBTdSPfd/WBpwwgsuN5sS9TfpH4W5EUok2V zsh3CnzD/FEYZyxVDNk9pUculoSuEEZ5dGYc+ZrleHFKgOSYCqiVTjFKxJuffOIWqJ11 cJ8Q== 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:dkim-signature; bh=KScg4ydCaUpShKuw7MCg69AXYFIohUjFbKBvL+ntZ4c=; b=TrsAL6uAIvxCUdkQvlFT3YHjO/l3s9O/KsuPVNKDf5+VrCojrpR3BYxvE2iZ/CTVMx eUImdXH8PZIEfZjeVmTLsTcWdcJi1xp/KqGlK0/hQTEcdnkmTTBwnW8ABTmXWA7kTDo9 501n21uUKj+g/MC9S6T5A0PVMmgTmCnPtAtLwzRhIHgX62btAxDxITxfpbEQ2sfoAnOB RGKY5VbrXTofcwKwM5BoMGDHSQtadyfhZVOoJ8EYbG6sU7cCylnpgKms+0+ALS2iOeQe I09cs6QJf9qKaA5dk95uvQI075NlpEtmXPZLKefU7uy4WmQmQql4zEwGhMpYkADS4kGA i0zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=fru4WBJF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be6-20020a170902aa0600b001a1f3916f4bsi10530140plb.265.2023.05.13.06.26.51; Sat, 13 May 2023 06:27:05 -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=fru4WBJF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232082AbjEMNOZ (ORCPT + 99 others); Sat, 13 May 2023 09:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230149AbjEMNOY (ORCPT ); Sat, 13 May 2023 09:14:24 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 456363C39 for ; Sat, 13 May 2023 06:14:23 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3f41d087b24so56914355e9.1 for ; Sat, 13 May 2023 06:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683983661; x=1686575661; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=KScg4ydCaUpShKuw7MCg69AXYFIohUjFbKBvL+ntZ4c=; b=fru4WBJFozuJiW7li8qmMR6SqWTExWH9KYH9ot9EMkzBgywJGHGPAYTXhcVjfJ0wn/ 8iDLYVxJf0YME4AHr9WfrySF9zZyuNYVOKJczQiqZ/KnzzJTBvWUKzOzmzY3pbRhcyM2 5BJpoIeWehf1zOH8M26AjCMq1HpJe1cVuhmHvYXxDaNue4GIg4/RKjV53xMPd7P5BVKb 6RisXKsCRPnd98WlzEq1U6/FAmzagUxVvF8JKsOPX5ky++/5Psgoeotx4gLU7xCD0SCf beAhH7mHuFmr3asVygACGMJz9yIrp4g+H4btpTXqNh7mHr5ns2F/FcoaMyaWUhO6pFm+ yt5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683983661; x=1686575661; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KScg4ydCaUpShKuw7MCg69AXYFIohUjFbKBvL+ntZ4c=; b=YMcC0Z/rbyMFvY6XaIOF725ldXCAojASMu+aStv78loIavyPYgpaCXrfRvMvKHF/mg hQg31L60GXTJ7J6UNGpJq09cEfCnVL3FC4rMVg1NzMKNOqAHwictxkgOaNVeBsoPb5k6 wkZBggg+8f7nKr7JtfK3kM/DW6xS84aZ/DfmhtJWaWUN4rNOXAIWsKr6yPn6TS6NYM6N l6C54t35P5Jai4LBtYIRHdjDR9bA6I6tFDdXZn5IICxNVC0LK+rYNfN+hujxeh9AqKNz KDRoGq8IK3MokupNjajm3smi75Qo9mNBDXisOnh/i39cPYgPfLGWJCnlxsgljBc9WCB6 9U5w== X-Gm-Message-State: AC+VfDyrYGjrhoetxoNEYlvNfCQNeKNZoQN5VLN5EQ6JaS/CwoN2AFXl V9k36Nf4LzTMhFHz4tGrNT4= X-Received: by 2002:a7b:c4c3:0:b0:3f1:75ae:1cfe with SMTP id g3-20020a7bc4c3000000b003f175ae1cfemr19040929wmk.7.1683983661254; Sat, 13 May 2023 06:14:21 -0700 (PDT) Received: from localhost ([2a00:23c5:dc8c:8701:1663:9a35:5a7b:1d76]) by smtp.gmail.com with ESMTPSA id f8-20020a7bcd08000000b003f42894ebe2sm15878056wmj.23.2023.05.13.06.14.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 06:14:19 -0700 (PDT) Date: Sat, 13 May 2023 14:14:18 +0100 From: Lorenzo Stoakes To: Ryan Roberts Cc: Andrew Morton , "Matthew Wilcox (Oracle)" , "Kirill A. Shutemov" , SeongJae Park , linux-kernel@vger.kernel.org, linux-mm@kvack.org, damon@lists.linux.dev, Christoph Hellwig , Uladzislau Rezki Subject: Re: [RESEND PATCH v1 1/5] mm: vmalloc must set pte via arch code Message-ID: References: <20230511132113.80196-1-ryan.roberts@arm.com> <20230511132113.80196-2-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230511132113.80196-2-ryan.roberts@arm.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org You've not cc'd the vmalloc reviewers, including the author of 3e9a9e256b1e whose patch you purport to fix. Please remember to run get_maintainers.pl on all files you patch and cc them at least on relevant patches. Have added Christoph + Uladzislau as cc. You'll definitely want an ack from Christoph on this! On Thu, May 11, 2023 at 02:21:09PM +0100, Ryan Roberts wrote: > It is bad practice to directly set pte entries within a pte table. > Instead all modifications must go through arch-provided helpers such as > set_pte_at() to give the arch code visibility and allow it to validate > (and potentially modify) the operation. This does make sense, and I see for example in xtensa that an arch-specific instruction is issued under certain circumstances so I do suspect we should do this. As for validation, the function never indicates an error, so only in the sense that a WARN_ON() could _in theory_ trigger is it being validated. This might be quite a nitty point :) as set_pte_at() has no means of indicating an error. But maybe to be pedantic 'check' rather than 'validate'? > > Fixes: 3e9a9e256b1e ("mm: add a vmap_pfn function") Not sure if this is really 'fixing' anything, I mean ostensibly, but not sure if the tag is relevant here, that is more so for a bug being introduced, and unless an issue has arisen not sure if it's appropriate. But this might be a nit, again! > Signed-off-by: Ryan Roberts > --- > mm/vmalloc.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index 9683573f1225..d8d2fe797c55 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -2899,10 +2899,13 @@ struct vmap_pfn_data { > static int vmap_pfn_apply(pte_t *pte, unsigned long addr, void *private) > { > struct vmap_pfn_data *data = private; > + pte_t ptent; > > if (WARN_ON_ONCE(pfn_valid(data->pfns[data->idx]))) > return -EINVAL; > - *pte = pte_mkspecial(pfn_pte(data->pfns[data->idx++], data->prot)); > + > + ptent = pte_mkspecial(pfn_pte(data->pfns[data->idx++], data->prot)); > + set_pte_at(&init_mm, addr, pte, ptent); While we're refactoring, it'd be nice to stash data->pfns[data->idx] into a local pfn variable. > return 0; > } > > -- > 2.25.1 >