Received: by 10.223.176.5 with SMTP id f5csp1880120wra; Thu, 8 Feb 2018 05:07:52 -0800 (PST) X-Google-Smtp-Source: AH8x227b9EOdq3CjkjGYaSJFZH47HeyceWRqBAeK2UGUnHd2o5YqkrsPZ8qFhTyyJQoDRa+DNwXO X-Received: by 10.98.17.15 with SMTP id z15mr681417pfi.116.1518095271939; Thu, 08 Feb 2018 05:07:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518095271; cv=none; d=google.com; s=arc-20160816; b=HwkNcJgmdOpGN2+8lvHwRWaC+GUtnK3Ne6qJgarfQwx/QYPEKLoC2M7B7x6S8c6aFg V4L26oeIw5hY8Rv4R0NJTvl3MxOK0Ist5yZ2ZuTvoJ1FvLSg0buLcqnFJ2Jd58mc51cm 2o1C9mkJWr9JnUyh5zYf0d1wPHqdeEiUwcAZJfoNGB9cIcYYea0bhaLx+DEdKVYn1ORi 9U5QDJamLxlh6hiaHZP69S6o2s01hGXN0al5HUWFJmRyN7FZ/4zSzekjpl6lXwN9DRGl hTTroC/QHJRKnT0Wg8V9jVqFVHJUHSNVp3DdW5g7mR9C+2X99AP9NV8WruILyS7zksMq yh2w== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=Sqvfa+tvPGF+HOiq1wceqt5Rnz46n/eDymdV5RP4xBk=; b=QrJG25jiRMyq00JXFXMFdyq0UYYxHXPQGnVKGht4RiSVjhEEyfEy/7M19ua4C9B7aL 0MFlQ5xOe+kS1QnoWizieZOnBqqrg/gZIGchNuN5qM5BdLhdsb99mvlCSFuwLCekGjAI AoAgqogJ13hmp61nOLm/+BPj30M9qW5DK+Iiw48hFVhVmR1NI1VzNJnwMv/jDii6S6V7 p0mHW6pOU+f++FKqWD+FEyrB9BWRHBeU8EdpWlMaPXNZciG/cg0myENdO2sb4d6mmlUy xQDu51+A9JzLuhPjb4GURoMZzxpULPcLhxsdS+Eiaqmh6TExUpa7gdCZOBqVnKUSHnxw CFaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=jgjGVGPl; 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 h7si1118312pgs.562.2018.02.08.05.07.37; Thu, 08 Feb 2018 05:07:51 -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=jgjGVGPl; 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 S1751671AbeBHNGy (ORCPT + 99 others); Thu, 8 Feb 2018 08:06:54 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:49433 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750929AbeBHNGx (ORCPT ); Thu, 8 Feb 2018 08:06:53 -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-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To: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=Sqvfa+tvPGF+HOiq1wceqt5Rnz46n/eDymdV5RP4xBk=; b=jgjGVGPlzH4KMOr4PFmAIg3gWo UYThS9R9BN0HDYMqEhSO+hNNJXnuR0CiLT3MXnOuTdAiJjgmhHsApZj/YG0WjcIUEACSaiHkj9TOy pElTOuUiDI41qTnKy8utGVltng7ynlhDMJsFSioIF1YCVhtsnajo6GhkaAq0xdyYR1rsFjJXrxHXf CM/m0DNhwkXHbmgV4cjmewZ/xuGZrBRm1bGfyBHKalu15eDGHgehIECenNemlUWaUagc1+0C+xhry ClqmoFz2xTHuVoBaAU8iL8b95cmhFeFnEghSkPSqSpvjyR0WWrJ/bSfK27Q8vBKYnxVdiiQsmWgPt xov6N24A==; Received: from willy by bombadil.infradead.org with local (Exim 4.89 #1 (Red Hat Linux)) id 1ejlub-0004kb-Nq; Thu, 08 Feb 2018 13:06:49 +0000 Date: Thu, 8 Feb 2018 05:06:49 -0800 From: Matthew Wilcox To: Kai Heng Feng Cc: Michal Hocko , Laura Abbott , linux-mm@kvack.org, Linux Kernel Mailing List Subject: Re: Regression after commit 19809c2da28a ("mm, vmalloc: use __GFP_HIGHMEM implicitly") Message-ID: <20180208130649.GA15846@bombadil.infradead.org> References: <627DA40A-D0F6-41C1-BB5A-55830FBC9800@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <627DA40A-D0F6-41C1-BB5A-55830FBC9800@canonical.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 08, 2018 at 02:29:57PM +0800, Kai Heng Feng wrote: > A user with i386 instead of AMD64 machine reports [1] that commit 19809c2da28a ("mm, vmalloc: use __GFP_HIGHMEM implicitlyā€¯) causes a regression. > BUG_ON(PageHighMem(pg)) in drivers/media/common/saa7146/saa7146_core.c always gets triggered after that commit. Well, the BUG_ON is wrong. You can absolutely have pages which are both HighMem and under the 4GB boundary. Only the first 896MB (iirc) are LowMem, and the next 3GB of pages are available to vmalloc_32(). > Also there are other BUG_ON(PageHighMem()) in drivers/media, I think they will get hit by same regression in 32bit machine too. I fixed one of them. I think the other three are also bogus, but it's hard to say; the comments say "DMA to HighMem might not work", and they probably mean "above the 4GB boundary", but I really don't know. (since two drivers now have this code, maybe it should be part of the core MM API? Or maybe there's already something better they should be using?) diff --git a/drivers/media/common/saa7146/saa7146_core.c b/drivers/media/common/saa7146/saa7146_core.c index 9f7c5b0a6b45..329fd43228ff 100644 --- a/drivers/media/common/saa7146/saa7146_core.c +++ b/drivers/media/common/saa7146/saa7146_core.c @@ -160,7 +160,7 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages) pg = vmalloc_to_page(virt); if (NULL == pg) goto err; - BUG_ON(PageHighMem(pg)); + BUG_ON(page_to_pfn(pg) >= (1 << (32 - PAGE_SHIFT))); sg_set_page(&sglist[i], pg, PAGE_SIZE, 0); } return sglist; diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c index f412429cf5ba..b5ec74b9c867 100644 --- a/drivers/media/v4l2-core/videobuf-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf-dma-sg.c @@ -77,7 +77,7 @@ static struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt, pg = vmalloc_to_page(virt); if (NULL == pg) goto err; - BUG_ON(PageHighMem(pg)); + BUG_ON(page_to_pfn(pg) >= (1 << (32 - PAGE_SHIFT))); sg_set_page(&sglist[i], pg, PAGE_SIZE, 0); } return sglist;