From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B38FBC52D7C for ; Fri, 9 Aug 2024 16:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pOevS25kl1+p5C9bnayjnL4IWCIfturozNfzs94vCz8=; b=JGItot10WKM3tMowxCntAUaO9O nnDFtbfeXRTW5bhrk+8ijEYoUMJYxaxPKYihMrfBbX2xkGO8x8RMg3BRnlMq2PddH7IRTSSw7GX69 7mdHxRK8bD+yLe812LOArOJFnJ6OrqH4hc9O7WpWFZ6AWp28kn64M3f8XMsYhxpo+nl29igMaprot LGlQdfLesukJL6k5r1EuvZqYb5fm5J7Q+VYwBML+UCvKEKiyYCrMiDKBYBEZTafHx2uoqblJHAdYh goVRFP2/S0naxsLIL6QlpP8hm1chsXsP5B1NhirrFgLU6v1cizEr8S1D6njfsFl1OquyOF/7wPJag dAPhBJqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1scSDP-0000000BqFf-2qlo; Fri, 09 Aug 2024 16:11:43 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1scSBA-0000000BpLk-1GNk for linux-arm-kernel@lists.infradead.org; Fri, 09 Aug 2024 16:09:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723219763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pOevS25kl1+p5C9bnayjnL4IWCIfturozNfzs94vCz8=; b=AIkLRe78Zxz80FdBVVF94Ok0iKX6PlppauloyrnCDhoRbT+1guSOkX9X42aP94brCJe12a NoqdEgbelGqZckfmJHl7mqnvKHmIQJjnd3miBCiJfR1Az3sUNGJUYHjyQuZRJrblqsWaBC 2AXDbRkHHI9NIA3Z6gxYJaHz4YaPMDQ= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-404-Zw-T__HONVuPJ8Ap6LJMrg-1; Fri, 09 Aug 2024 12:09:22 -0400 X-MC-Unique: Zw-T__HONVuPJ8Ap6LJMrg-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7a1d3c02fcfso7767185a.0 for ; Fri, 09 Aug 2024 09:09:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723219761; x=1723824561; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pOevS25kl1+p5C9bnayjnL4IWCIfturozNfzs94vCz8=; b=tdDPl3Yb+YbH5EMnQAxpgdCKn3O0Fdd9+DqWRCZ0SFQ5JhOBM5N6lj4wM3Nr03EI1W thDKyUdAPkrOxoTkaTUrHN+cTNQMsx86SJWTU87+AauWuPfbJ7XfHvO+PSQrQ0LIw5Go 12W89+vJgPPiwNu8VZzvgQdYbBvIoc34sgAhIsLSoE7era+ZlVVGYM3H6e6chEXhzm1s ao8kc6nUXTWKvaZpzRaIz5d4X3vblWZMMqAbRGxhYkbKHVKrJAFz1kqyI9gyzE4S29ut oiGH1khawWhj39S1dVzNB73eRPTXS9xzkFGud+bdBhUMbroUDalnBNiS+ouCwkUczLFj OAFg== X-Forwarded-Encrypted: i=1; AJvYcCX3jjOqSpZHmlCZcrkHfTUxKd8iT1SQoC/T293cc5Mv9gJBqCUM1/DDisPRe6a+gMzNBIsCw8nutYbDdsli8Bqe@lists.infradead.org X-Gm-Message-State: AOJu0YxBmb7encSRyEBfzFGpEBg+b2Rxa6uaIiOvLKnTD/4GKlxVOHry 0VvpQkz9yBmG1JWC2e6iH6sMr7jxe5JTKOUKH4JUH2qSUrc+1C1OXv2K8RSlAEw5Aa/c0SXCPnM plDpXsia1WD7jiTySady17n0JNg+v/H9YuVsXBiGTzkrFrFNZQOMzayDJrC6Ty+m1F2Q6UmMU X-Received: by 2002:a05:622a:1a8b:b0:44f:89e3:d119 with SMTP id d75a77b69052e-453126babcemr11885661cf.12.1723219761643; Fri, 09 Aug 2024 09:09:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHUujWoHeQHvUCs2OAJSjyQdbxlWd9FX1yi8fb3RZKwv0O5abV6g6G64GeuNGe2uyjoJD48A== X-Received: by 2002:a05:622a:1a8b:b0:44f:89e3:d119 with SMTP id d75a77b69052e-453126babcemr11885331cf.12.1723219761262; Fri, 09 Aug 2024 09:09:21 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-451c870016csm22526741cf.19.2024.08.09.09.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 09:09:20 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Sean Christopherson , Oscar Salvador , Jason Gunthorpe , Axel Rasmussen , linux-arm-kernel@lists.infradead.org, x86@kernel.org, peterx@redhat.com, Will Deacon , Gavin Shan , Paolo Bonzini , Zi Yan , Andrew Morton , Catalin Marinas , Ingo Molnar , Alistair Popple , Borislav Petkov , David Hildenbrand , Thomas Gleixner , kvm@vger.kernel.org, Dave Hansen , Alex Williamson , Yan Zhao Subject: [PATCH 03/19] mm: Mark special bits for huge pfn mappings when inject Date: Fri, 9 Aug 2024 12:08:53 -0400 Message-ID: <20240809160909.1023470-4-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240809160909.1023470-1-peterx@redhat.com> References: <20240809160909.1023470-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240809_090924_464670_9266B81B X-CRM114-Status: GOOD ( 11.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We need these special bits to be around to enable gup-fast on pfnmaps. Mark properly for !devmap case, reflecting that there's no page struct backing the entry. Signed-off-by: Peter Xu --- mm/huge_memory.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 39c401a62e87..e95b3a468aee 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1162,6 +1162,8 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, entry = pmd_mkhuge(pfn_t_pmd(pfn, prot)); if (pfn_t_devmap(pfn)) entry = pmd_mkdevmap(entry); + else + entry = pmd_mkspecial(entry); if (write) { entry = pmd_mkyoung(pmd_mkdirty(entry)); entry = maybe_pmd_mkwrite(entry, vma); @@ -1258,6 +1260,8 @@ static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, entry = pud_mkhuge(pfn_t_pud(pfn, prot)); if (pfn_t_devmap(pfn)) entry = pud_mkdevmap(entry); + else + entry = pud_mkspecial(entry); if (write) { entry = pud_mkyoung(pud_mkdirty(entry)); entry = maybe_pud_mkwrite(entry, vma); -- 2.45.0