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 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05697C4360C for ; Fri, 27 Sep 2019 12:33:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA486207FF for ; Fri, 27 Sep 2019 12:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569587587; bh=k59e7iwhEetiDfExX0rhAQBUKqwevSIHgYPVLXA9sZc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=SNxhFF38wqAOyBP/L4Ul7wy5kZt3eQA1dOF4V1jg3+rDYAv86J666VjjgBTBPv5kz vKmgLKmpr0uQb21v0l8QWQ3/VeHSOFtpVJkX+EqBaocPCuV3j/gVNWzZIYK/MEotPg toL8ZtG8osFcUfPvJyaNXzK+7XiPfTvUCoZtT8uU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727189AbfI0MdH (ORCPT ); Fri, 27 Sep 2019 08:33:07 -0400 Received: from mx2.suse.de ([195.135.220.15]:48736 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726087AbfI0MdG (ORCPT ); Fri, 27 Sep 2019 08:33:06 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6D43BB13E; Fri, 27 Sep 2019 12:33:01 +0000 (UTC) Date: Fri, 27 Sep 2019 14:33:00 +0200 From: Michal Hocko To: John Hubbard Cc: "Kirill A. Shutemov" , Yu Zhao , Peter Zijlstra , Andrew Morton , "Kirill A . Shutemov" , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Vlastimil Babka , Hugh Dickins , =?iso-8859-1?B?Suly9G1l?= Glisse , Andrea Arcangeli , "Aneesh Kumar K . V" , David Rientjes , Matthew Wilcox , Lance Roy , Ralph Campbell , Jason Gunthorpe , Dave Airlie , Thomas Hellstrom , Souptick Joarder , Mel Gorman , Jan Kara , Mike Kravetz , Huang Ying , Aaron Lu , Omar Sandoval , Thomas Gleixner , Vineeth Remanan Pillai , Daniel Jordan , Mike Rapoport , Joel Fernandes , Mark Rutland , Alexander Duyck , Pavel Tatashin , David Hildenbrand , Juergen Gross , Anthony Yznaga , Johannes Weiner , "Darrick J . Wong" , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 3/4] mm: don't expose non-hugetlb page to fast gup prematurely Message-ID: <20190927123056.GE26848@dhcp22.suse.cz> References: <20190914070518.112954-1-yuzhao@google.com> <20190924232459.214097-1-yuzhao@google.com> <20190924232459.214097-3-yuzhao@google.com> <20190925082530.GD4536@hirez.programming.kicks-ass.net> <20190925222654.GA180125@google.com> <20190926102036.od2wamdx2s7uznvq@box> <9465df76-0229-1b44-5646-5cced1bc1718@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9465df76-0229-1b44-5646-5cced1bc1718@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 26-09-19 20:26:46, John Hubbard wrote: > On 9/26/19 3:20 AM, Kirill A. Shutemov wrote: > > BTW, have you looked at other levels of page table hierarchy. Do we have > > the same issue for PMD/PUD/... pages? > > > > Along the lines of "what other memory barriers might be missing for > get_user_pages_fast(), I'm also concerned that the synchronization between > get_user_pages_fast() and freeing the page tables might be technically broken, > due to missing memory barriers on the get_user_pages_fast() side. Details: > > gup_fast() disables interrupts, but I think it also needs some sort of > memory barrier(s), in order to prevent reads of the page table (gup_pgd_range, > etc) from speculatively happening before the interrupts are disabled. Could you be more specific about the race scenario please? I thought that the unmap path will be serialized by the pte lock. -- Michal Hocko SUSE Labs