From patchwork Wed Aug 9 16:46:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 13348170 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39FBBC04A94 for ; Wed, 9 Aug 2023 16:46:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B18D6B0071; Wed, 9 Aug 2023 12:46:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 861526B0074; Wed, 9 Aug 2023 12:46:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 728D48E0001; Wed, 9 Aug 2023 12:46:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 6052E6B0071 for ; Wed, 9 Aug 2023 12:46:40 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 1E318C08F2 for ; Wed, 9 Aug 2023 16:46:40 +0000 (UTC) X-FDA: 81105144960.27.8771BAE Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by imf04.hostedemail.com (Postfix) with ESMTP id 3BFBF40013 for ; Wed, 9 Aug 2023 16:46:36 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=ToePmrNn; spf=pass (imf04.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691599597; a=rsa-sha256; cv=none; b=dg6LtRX3YLLjM42jTFOWNlTIVHxoIzuDlmOsmcJrNBSljLZKQjM/lo9HfyFInkPznO7wY+ QeZhyZha49EekJwOW+SQWstlMyJfg++9BL4Gl6L+3ti1EXeuTdyi2zfkC7ANr6g1u3pAVp RypfPDDMi0pCG58khu9x3PsS4qAzwlU= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=ToePmrNn; spf=pass (imf04.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691599597; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=LCB6J9xjkovo4nsL5var8Yeba5WXNTY3HlVH4wMSnQo=; b=Brki4trppxN2MWyyh72fEWtqqOWjyztxZvwaixGMNEmBv4xrMcGmO70XoznZH2hfKQ4tQR ODzNVnKTd4j2v8CuIK8UnWoHezYfYaIQ0mZRL32j+GUKt1F0PYJVvQudJOLDq8VK4niJTF Hb+NAlEcBgLkxfbEvWEfSIUPIsm7/80= Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-3fe426b8583so61887115e9.2 for ; Wed, 09 Aug 2023 09:46:36 -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=l2G0X+YfVq4W6wbFkNVttnLyNB8O7tJ+oJc6NFM2kqJ/RMYw3euQPOwDboncmHLeX7 LY4652ddAuh1FjcE6uZpupEttHTSovWGRJ0v5SAbEzDjULq6FvtilcAs3cB3laRuINJ2 QI3GdXtjez+3ecn6KfQAAdWvrXabUj8zeZPW+/QKUV2OGW4mID3BArWmQ8XjkyD995lE oWosZswN6u1j/dwd1137L45ST7x8vQneaS7radKGE4RVaN0K5i4HIcwHHLIIqcTBjfxC q4r4ASPBDxpL3rOkTjkdrQSCfHGTjJ5Xtk/XjRaI3xwwP2evwx2c28xr956ZzFy2qvET axaA== X-Gm-Message-State: AOJu0YyQXiX3QftHSkLWlC6zSytMBYmRqdDNh64+vfgYWaaAfjTD2COB zrzxBGI1HOb5ovE89b00XDS9UmthAjRVF614k2E= X-Google-Smtp-Source: AGHT+IFBfy3CiF6uuHnwbQhdXVy+SfEPATMxJijXaIIO0WSpTUWJgGSbu4qQC+Iq/UGxZFGHXbgdmg== 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 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 3BFBF40013 X-Stat-Signature: 8s3jqtpj6h37ejdtaty59met5q9o33w1 X-Rspam-User: X-HE-Tag: 1691599596-670691 X-HE-Meta: U2FsdGVkX18ZrCZ3CoEFvOT/+TWQsitAkCbffJ2A7Xv4t30fyMRbMW+WLwmJO68Pr3WpVD8Iw9UlUprGaTo7ZBoAW5NVqx4ZCR7m+QlcNQ8HTu3BbRPQ5GWnnudMcjruR0ghj0pTIomIcrIv/jmk/5lVlf0ljFYxcGGldGMgKm2M7wv0eV2BttEz4yRxzmTwmhjFtasnjQAV9qEfJSyspIa8BrS3v+L3DVUowz8tvuvYuDlTaUjb0DbAKIKdlZamzTlUANbuJiNUcJSEJNF7/XIy7bcy2Hd/d6h/egvskQEwYY+qy71nz41+6A1B6QlSwZKLiqFt8VXR3WpN9S2hYSYZrJdRKKKoRMSEGQTNvb7KYXv7JgkVfAIHJqXwap2fDOYxM31/++Ndr01A5LnVeLhp/H/q2CJ4QDOhFswjLgIRwIxfoM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K9Fi9STsENxGJnZ91/qgdzt86WoffMnt4sJlNEpHpIiH/dTZQGFVLCC/Ewaw+aqdtDYQ5YjW0/rqSA1ThDEc5alpHzxd5Ix X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Christoph Hellwig Reviewed-by: Palmer Dabbelt Acked-by: Palmer Dabbelt --- 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);