Received: by 2002:ac8:734e:0:b0:40f:fb00:664b with SMTP id q14csp1725258qtp; Wed, 9 Aug 2023 10:02:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGLmIb1K2NQtYMRt66SeP6XQvoJd9PNd3Q/M4+hZHnuseDJgzky7thYdc6VCSUSm4vcgiY X-Received: by 2002:a05:6402:10cd:b0:521:8777:b00d with SMTP id p13-20020a05640210cd00b005218777b00dmr2556420edu.15.1691600558643; Wed, 09 Aug 2023 10:02:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691600558; cv=none; d=google.com; s=arc-20160816; b=ASWTAuFgiSsUUkhS1HhRroaqzQj1VzTnF7m311+eF555tt3t6Vah6nR/ebnqZRJlwZ zxMEnIQ8hiFdvu+HSlXTEGWCM3GO0lTuB62ybnBqnb+Ek2b5vpw8V+fsunlvYLQ2L6iw QUwl2brKvUOQPtsAy5AMPXkx6yAwM8M/4pW4uEiwuCv192eExSp2KFq2kzcZu8z5easN ebWdFGN4xqaqsCh7vLOP1UFAEV8uEtxqc6QfLPMM9ZxNQAYWSxhALk5/20GtLYBc2f3/ lOYfwssMlCjEBnT4wFKbLMZrLHDaFZVZzT3e9n1kNVvMR8XSBsOwIxHmABQuIcFmXS9V Dgiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=LCB6J9xjkovo4nsL5var8Yeba5WXNTY3HlVH4wMSnQo=; fh=fK/KvvNEU+uRDhepm0sV8+BQY7zVeOUl2LNcr0uBTz4=; b=uNHq4JVB7iI6jKofLC+KQEl5iX3G8wWaMklJGVf5k58HfGlYwjuUnAmj8R7nZtRP6w 1cxPGvSG39Fb08W03Wa0AV9P3EMJMjoFwWEgZabsT9NNdpbXfGnWgZ75KkwVaMNVhMr0 q0JTkw9G1Oau7+oP0HKacTlb+x3hZVGH4iVgRxIZUW9Nfg7fc6vR6ky1Y22tvGpRqcvg 7hyB09miWSrvt+FlPX6PAuWbxf+V8LHbctABhkv2vtNf6rGWgN/MqH4I8GjmnIsjuQ/a zltEUSsa+QSGxUxeCEg42qQACm5FiiGz/C/fX8B5JgDUYTqkYpSQrOsw4xzWNRBRWmOI eCrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=ToePmrNn; 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 m14-20020aa7c2ce000000b0052345e75950si3073071edp.578.2023.08.09.10.02.12; Wed, 09 Aug 2023 10:02:38 -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=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=ToePmrNn; 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 S231210AbjHIQqj (ORCPT + 99 others); Wed, 9 Aug 2023 12:46:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231216AbjHIQqi (ORCPT ); Wed, 9 Aug 2023 12:46:38 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 507F61BFA for ; Wed, 9 Aug 2023 09:46:37 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe426b8583so61887105e9.2 for ; Wed, 09 Aug 2023 09:46:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1691599596; x=1692204396; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LCB6J9xjkovo4nsL5var8Yeba5WXNTY3HlVH4wMSnQo=; b=ToePmrNnppd/Is0E7PAd+j29Nv5DFUjvi18bOflnM9U2nXEfSB4OmJTuUoQ+iE5SVW fJUPqV1RGbk2gV9dolFc9ZA4vRjS7062kNecnkUCSYw5YOarLb2c591nRpZMWLUfzKhJ tXlk/4tkJZN6qDfR9O6NFRsVPP3bms2MF3nF1rtBgVW8vsoWqXEPT4ohPmfp1CizLkbC J8X+dsSG43psOtrhYnaPM0mpNlYW19TqZtbRr+o2Pam9vbKY+bNz1eh9hpmBAq6J73lH db/hm3ocMgPBYXxSYtKUcaw0SmXAz2f+gZZ2XCjSYvjHtM2UdmX2qXVdNpIvKLmq7sbY BqwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691599596; x=1692204396; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LCB6J9xjkovo4nsL5var8Yeba5WXNTY3HlVH4wMSnQo=; b=O4zHZ12Iy1tSOo0zMv0Vy+s47WAzxwROA53gxmpI1Kr3q+aCUnIgEbJrkWbSut8fIL vu7gUZ55yQOUa1GhcdezdL14ZTXgpORWacC8shEmbHOE2VCeC4IprqI1czTEqr0HR699 Lo4cQ4JiWxNP9IyCmXFp8+mP6v1tzHmMtgZkG2No/lhw6xvuqxR2BZF5adk11vkg0BfL Lix8lK2QMm8fIdRDLCJSTYZ3330LZs0i3WysIyvs8x4a2aN8tzXA6fICmASvomxjaDwS VdeYArGJCvachOfMszRJmz4OK+Zjk0NNe0FoBW18mND2poJFgNKSCdUAXSD4sQdvLveD 23xg== X-Gm-Message-State: AOJu0YxBjDVXbrd67zTEt5WXCFtE2qZ/ZS7Daxk9v3M/3ZvbRxd3WQZm X24As/TvP7qL6bY7w5bLEKAgnw== X-Received: by 2002:a1c:4c12:0:b0:3fb:a0fc:1ba1 with SMTP id z18-20020a1c4c12000000b003fba0fc1ba1mr2651739wmf.35.1691599595638; Wed, 09 Aug 2023 09:46:35 -0700 (PDT) Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id p19-20020a05600c205300b003fe17901fcdsm2453431wmg.32.2023.08.09.09.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Aug 2023 09:46:34 -0700 (PDT) From: Alexandre Ghiti To: Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Alexandre Ghiti , Dylan Jhong Subject: [PATCH -fixes] mm: Add a call to flush_cache_vmap() in vmap_pfn() Date: Wed, 9 Aug 2023 18:46:33 +0200 Message-Id: <20230809164633.1556126-1-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 flush_cache_vmap() must be called after new vmalloc mappings are installed in the page table in order to allow architectures to make sure the new mapping is visible. Fixes: 3e9a9e256b1e ("mm: add a vmap_pfn function") Reported-by: Dylan Jhong Closes: https://lore.kernel.org/linux-riscv/ZMytNY2J8iyjbPPy@atctrx.andestech.com/ Signed-off-by: Alexandre Ghiti --- mm/vmalloc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 93cf99aba335..228a4a5312f2 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2979,6 +2979,10 @@ void *vmap_pfn(unsigned long *pfns, unsigned int count, pgprot_t prot) free_vm_area(area); return NULL; } + + flush_cache_vmap((unsigned long)area->addr, + (unsigned long)area->addr + count * PAGE_SIZE); + return area->addr; } EXPORT_SYMBOL_GPL(vmap_pfn); -- 2.39.2