Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp7456883ybh; Thu, 8 Aug 2019 16:25:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVMCuUwdqRI1stuBehOIo3o6xX74vgHdD61dwDFacTj1Rhw4Psn2px68xxVdaoHXr15opc X-Received: by 2002:a17:902:654f:: with SMTP id d15mr14999272pln.253.1565306733174; Thu, 08 Aug 2019 16:25:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565306733; cv=none; d=google.com; s=arc-20160816; b=TyD5aDLf+cPqWZPz7LFgvOh9XAVYHHkKVQd4y4Ul+yhe+NTpaZoRGGyzphAJhQlSRg EcPIGnxe/pq4zbJ8UTVFELVObvB9lXMG/jHz13ba2BiEzP1jC0kp4RV1GfltqsqmeaX7 o+QphutrDgiiYPi+s6IaDzUXmRJ6+o5mvs1Qyju5/ux4HPUU19XLNhgl7jgQHtCT9TQw 295k3O4w/9KV2G5XSlSeXMJs1AtcMdzjQmNz9Rzp5JEdqfcoN8okP8dYFJIyyiE3AhPM s/XsMQJpKBEga1kPQFBpsOgH3KdLo7HtxuYKvNGWX4wtJeLm01UpW7Z7XqacNKfpqOLz QU6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=+5ClyXF4/+matB7j6ropEiCrm63pptXnzihc56YYTPY=; b=sfgapH3ppkD5S6IHwe3Bt3XrVvvD0lbtdi3sR2WrbKsP6c68dHGgiTadzrJ9Z1hKnW jgTGLRK7dtNckkcIk3jHsONAwqUKuk5f1qJxPTOJRM2F6EsDu5vSCAFMtGiJjLUXWHFj nZtDmWiXmeIZu+JxBb+u3AoZgtILsXrHs5xMukRDHwbXNaGjgJhP9dNM2Cf38zgt/T66 1XFVqt+tQfWzJ01+/j532+VEKlmQ323VyXTIuPfTztk5g+LpiCjqQX0CBYJT+wQk5Xgg cPHJLMdRSEMNup2BEBH9huN78VNtedfbrj7kO8RYZQvbX3XKyR+0aGyPFpmEy32Ayily a5Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="l5IhY/V8"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y186si52470325pgd.440.2019.08.08.16.25.17; Thu, 08 Aug 2019 16:25:33 -0700 (PDT) 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=pass header.i=@nvidia.com header.s=n1 header.b="l5IhY/V8"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390501AbfHHXVq (ORCPT + 99 others); Thu, 8 Aug 2019 19:21:46 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:16780 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390006AbfHHXVq (ORCPT ); Thu, 8 Aug 2019 19:21:46 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 08 Aug 2019 16:21:47 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 08 Aug 2019 16:21:45 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 08 Aug 2019 16:21:45 -0700 Received: from [10.110.48.28] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 8 Aug 2019 23:21:45 +0000 Subject: Re: [Linux-kernel-mentees][PATCH v4 1/1] sgi-gru: Remove *pte_lookup functions To: Bharath Vedartham , , , CC: , , , , , , References: <1565290555-14126-1-git-send-email-linux.bhar@gmail.com> <1565290555-14126-2-git-send-email-linux.bhar@gmail.com> X-Nvconfidentiality: public From: John Hubbard Message-ID: Date: Thu, 8 Aug 2019 16:21:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1565290555-14126-2-git-send-email-linux.bhar@gmail.com> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1565306507; bh=+5ClyXF4/+matB7j6ropEiCrm63pptXnzihc56YYTPY=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=l5IhY/V8wKpl1V8ijQzYcYptStoxXGnVHOhdeyz+62DluKzAguhVGZiCGRezc95/U U8C6lT2MUtBedJD6kwr7Jr7y0OfIyp3vjjn8DI1jErn0J4NJeZs9lx6UF3OsV+59PF l9qKdPDJk9lnGXFf/ud/g8F09AgJn0qSM+zmSFnnYPTfYywdwSxcSAhkZRvLOWY1fO GdRjyB+IPWpS5D+ip+y8DKkG89yqpP1f/za6Lv89SZGgGtFsR+oiXNE6uljc1cMMJ1 vMRXg4Fs1Odywn1ugGiScfNOrclLqL0LzNz6i4WqKlB6fPKlo6RISUsFSt4Ex1WFaP DGa3Uuu+Ljl7w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/8/19 11:55 AM, Bharath Vedartham wrote: ... > static int gru_vtop(struct gru_thread_state *gts, unsigned long vaddr, > int write, int atomic, unsigned long *gpa, int *pageshift) > { > struct mm_struct *mm = gts->ts_mm; > struct vm_area_struct *vma; > unsigned long paddr; > - int ret, ps; > + int ret; > + struct page *page; > > vma = find_vma(mm, vaddr); > if (!vma) > @@ -263,21 +187,33 @@ static int gru_vtop(struct gru_thread_state *gts, unsigned long vaddr, > > /* > * Atomic lookup is faster & usually works even if called in non-atomic > - * context. > + * context. get_user_pages_fast does atomic lookup before falling back to > + * slow gup. > */ > rmb(); /* Must/check ms_range_active before loading PTEs */ > - ret = atomic_pte_lookup(vma, vaddr, write, &paddr, &ps); > - if (ret) { > - if (atomic) > + if (atomic) { > + ret = __get_user_pages_fast(vaddr, 1, write, &page); > + if (!ret) > goto upm; > - if (non_atomic_pte_lookup(vma, vaddr, write, &paddr, &ps)) > + } else { > + ret = get_user_pages_fast(vaddr, 1, write ? FOLL_WRITE : 0, &page); > + if (!ret) > goto inval; > } > + > + paddr = page_to_phys(page); > + put_user_page(page); > + > + if (unlikely(is_vm_hugetlb_page(vma))) > + *pageshift = HPAGE_SHIFT; > + else > + *pageshift = PAGE_SHIFT; > + > if (is_gru_paddr(paddr)) > goto inval; > - paddr = paddr & ~((1UL << ps) - 1); > + paddr = paddr & ~((1UL << *pageshift) - 1); > *gpa = uv_soc_phys_ram_to_gpa(paddr); > - *pageshift = ps; Why are you no longer setting *pageshift? There are a couple of callers that both use this variable. thanks, -- John Hubbard NVIDIA