Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp224033imu; Tue, 27 Nov 2018 11:24:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/W8S1qr6+Mc9RG3NY2gaceRDSa1rPmG2HkU+y1tMjWDWlU8tjYDlboGcas6xq7MkhRrJUFF X-Received: by 2002:a63:4f5e:: with SMTP id p30mr30339025pgl.71.1543346649021; Tue, 27 Nov 2018 11:24:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543346648; cv=none; d=google.com; s=arc-20160816; b=va3eSDG84g/Kbq7uBMUyizowQYeOd5xUoPmFP/yk4U2O6EezVlJj138BnaS5puoQ/5 RU64PO+8BD51HB0OMnZuwdAJEdOPYEct0JR8D9uKkxYj3OXbhUw+t/z3lg0Kt1OomUDS QQcJKf9AKkVhDnhwPiV4RedUuJIQ0ojTa2QWrnNRVUK9a9gk59ff/Ae4mhBjj2YW4W2E zKzsQvvYfx/q8Vxf8gkjb0AQcWgvE2sTdAVKnaz1HT8KYb4BVkLURfrugIgqXvOUyRRh 7aiIu1TxY4UOZj5/8G32wZwtTCy1A0YxFGMvrmnWkFM528PgFJbQXnCaq8W+C4TstLxD Dwgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+uVL2ZrmjWILmDoizKBAAZNDQbF6qn8AHLW+SNPL4Q4=; b=xCWC3Rr4LyAIiMmnzf10m+RBdPKnp6ZUYh4z/1TszEXdquOv7+4T2R/Yr9QAncNldH J3A8ThCUOj2PZ59p66yUB/PhT2fLmYqRzmK6EmuSBamPnQl67U/CiXVgH4pE9tiUaILz jtsTU8SY+jUy434SOV//KQXy005S4Iuuw57kPVSR94TwXok996h8fCS5fqcZt5talys6 K2V3j7v5PtVmbhDItFzERRcxc99K8LpffN0xXHt/Tj69qvUbfy164QDYp93yZGivouJk odNLIphsxFgnUC2UR2ERnPIMlKlxnPpNLqpAGIWpjqrXepKq8EqZEtG7py4o0s1lNN1I HhDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=dtnaBgYq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si4744725pgt.155.2018.11.27.11.23.53; Tue, 27 Nov 2018 11:24:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=dtnaBgYq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729242AbeK1CHG (ORCPT + 99 others); Tue, 27 Nov 2018 21:07:06 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:34726 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726381AbeK1CHG (ORCPT ); Tue, 27 Nov 2018 21:07:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+uVL2ZrmjWILmDoizKBAAZNDQbF6qn8AHLW+SNPL4Q4=; b=dtnaBgYq2MV7o0QR7lQi43RiN t6W4fvq7a+zdXVirIBh9xWhZzFTN3BLEbyYqgFNAA65fZRxbmXXHYlc8yHfQlyOD7dMfLYy13Q0Y8 NKP8TvPI+8g7yToj3k9JR1/2B5Z6DQzYOkBKrgTx1JeoPe15ZrEZ/dLZW0OnpdHmz8PnqMqXjmyii roVIXaiLMjwT3Xvm5yyJBidUOevCjPkI1BemXEpKX/jEa3BRSDrI7y7sIyEvDBttB+9opM1JtvvcY m6bf5NSDm5eD0n9W1nUA3vAv89o0doVmxRyCbm6SgMeUk0wddmULmalubVUizVDgfJHHT1f5Q9rnr o/0oym5QQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gReyq-0000AN-Cz; Tue, 27 Nov 2018 15:08:52 +0000 Date: Tue, 27 Nov 2018 07:08:52 -0800 From: Matthew Wilcox To: Mans Rullgard Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: fix insert_pfn() return value Message-ID: <20181127150852.GA10377@bombadil.infradead.org> References: <20181127144351.9137-1-mans@mansr.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181127144351.9137-1-mans@mansr.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 27, 2018 at 02:43:51PM +0000, Mans Rullgard wrote: > Commit 9b5a8e00d479 ("mm: convert insert_pfn() to vm_fault_t") accidentally > made insert_pfn() always return an error. Fix this. Umm. VM_FAULT_NOPAGE is not an error. It's saying "I inserted the PFN, there's no struct page for the core VM to do anything with". Which is the correct response from a device driver which has called insert_pfn(). Could you explain a bit more what led you to think there's a problem here? Also, rather rude of you not to cc the patch author when you claim to be fixing a bug in their patch. > Fixes: 9b5a8e00d479 ("mm: convert insert_pfn() to vm_fault_t") > Signed-off-by: Mans Rullgard > --- > mm/memory.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/mm/memory.c b/mm/memory.c > index 4ad2d293ddc2..15baf50e3908 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -1524,12 +1524,14 @@ static vm_fault_t insert_pfn(struct vm_area_struct *vma, unsigned long addr, > pfn_t pfn, pgprot_t prot, bool mkwrite) > { > struct mm_struct *mm = vma->vm_mm; > + int retval; > pte_t *pte, entry; > spinlock_t *ptl; > > pte = get_locked_pte(mm, addr, &ptl); > if (!pte) > return VM_FAULT_OOM; > + retval = VM_FAULT_NOPAGE; > if (!pte_none(*pte)) { > if (mkwrite) { > /* > @@ -1567,9 +1569,10 @@ static vm_fault_t insert_pfn(struct vm_area_struct *vma, unsigned long addr, > set_pte_at(mm, addr, pte, entry); > update_mmu_cache(vma, addr, pte); /* XXX: why not for insert_page? */ > > + retval = 0; > out_unlock: > pte_unmap_unlock(pte, ptl); > - return VM_FAULT_NOPAGE; > + return retval; > } > > /** > -- > 2.19.2 >