Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4272687ybi; Mon, 29 Jul 2019 22:58:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqypTbcYNETmD+y3UuW4NXle2AooiM3eG21R4YFwVLpOVBfyDT1syrByHoA/Hd1jnZOgyWlF X-Received: by 2002:aa7:9117:: with SMTP id 23mr40444682pfh.206.1564466305966; Mon, 29 Jul 2019 22:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564466305; cv=none; d=google.com; s=arc-20160816; b=PzqGjbg0tRKlyFcdgzP5nXLO+ZMXd4xGEK5ez0ZD4m/u59qDy2VzZoRaTyV5ce7oRn mmHQp7JAssSKiPQSM36iwWnQbWVYzbgWNLtjWPl/T9/DYFgB+rQLMzqTosTzORemQns1 MjElMFzA554tkPRjCjXteIux1fyTKTPAR9eoPf9aNiBze49PK1Bl8oIG5jZaLoMFmRc7 6H84AOrDe6/2bEmMQh79/h5kXLpYQD3zxz4ILBpYoJC7i1z9DM6VP+SOHaCpdA7nkdeP SH1DsLfS50/V7opeHGbS5z9Q2mJDa3dRkcjtQl/3yCu0j338XnY6VEXrt/tClfayj8pY eHVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wGT0bIW6ZV4QHMeBIyzrsptb3Nkhx6kX9nD5TRsY+c8=; b=OUYz8OuF/LRB3Zk3hUz5X/BSQj7fR5iZIRqf/45RsV+6mpY4AuJFhaeHReodAXVx6P 2sUVXky83dsmg9pt3A1brTYi1M7x9OUPiI3d5wb103iPpyKV3pllaVLVzA2ALQx3H7+f 4Ve8LgbFVGhyjuIPeZltLoZcv98rnMr+exnYgeaVuxezP0oO3PBTtWH1K753BJv9bHeG bwQo+LttMgg3QfEN41WTPI+xFtmkLUsPpiZVco0hrZkiA8YleGD5lVVSRNr7HGnubzsn Nepx43NS/lqiCjcQbdoUJ4G0GzkFdC9KpFyAhfq1lO4BdHuzB+4vsyoSWdj86Z8MpFq1 XmwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ki48yLXE; 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 g20si28433489pfh.95.2019.07.29.22.58.11; Mon, 29 Jul 2019 22:58:25 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ki48yLXE; 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 S1728032AbfG3FwX (ORCPT + 99 others); Tue, 30 Jul 2019 01:52:23 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:46104 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726061AbfG3FwW (ORCPT ); Tue, 30 Jul 2019 01:52:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=wGT0bIW6ZV4QHMeBIyzrsptb3Nkhx6kX9nD5TRsY+c8=; b=ki48yLXEl1xJO9gV+39wOL1+y4 wZUPYoqzhuNLoAUej9SJNFqjxYoDfeF+zcoWTFIq79SU2dw9V4rtDFH9JYB6dp5qDlHOfUF6g5GUx JPpQ+gBYb9/5cNNU1yw5rxdau5EGWyoD1usdNNwqaDiB2NAzGKDv39L59sbM/rDJL0O/c8V8icRLO IDGx1Argn4Mazv1HFxn+KxWQbirB8spS5aq6oofxF4YASh2sIDt4wCApTnUblx5u77wLLZLq+Mq8q EkU5EF5o8yTZ2SfJUnTVtafXCPfDL7NTm4L9dySd4Nqc3T4K/jP1nQG6ETC9e6EK/1Vr44X4BbE1V nstFkRew==; Received: from [195.167.85.94] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hsL3Z-000154-Lg; Tue, 30 Jul 2019 05:52:18 +0000 From: Christoph Hellwig To: =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Jason Gunthorpe , Ben Skeggs , Felix Kuehling Cc: Ralph Campbell , linux-mm@kvack.org, nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/13] amdgpu: remove -EAGAIN handling for hmm_range_fault Date: Tue, 30 Jul 2019 08:51:51 +0300 Message-Id: <20190730055203.28467-2-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190730055203.28467-1-hch@lst.de> References: <20190730055203.28467-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hmm_range_fault can only return -EAGAIN if called with the block argument set to false, so remove the special handling for it. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 12a59ac83f72..f0821638bbc6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -778,7 +778,6 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages) struct hmm_range *range; unsigned long i; uint64_t *pfns; - int retry = 0; int r = 0; if (!mm) /* Happens during process shutdown */ @@ -822,7 +821,6 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages) hmm_range_register(range, mirror, start, start + ttm->num_pages * PAGE_SIZE, PAGE_SHIFT); -retry: /* * Just wait for range to be valid, safe to ignore return value as we * will use the return value of hmm_range_fault() below under the @@ -831,24 +829,12 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages) hmm_range_wait_until_valid(range, HMM_RANGE_DEFAULT_TIMEOUT); down_read(&mm->mmap_sem); - r = hmm_range_fault(range, 0); - if (unlikely(r < 0)) { - if (likely(r == -EAGAIN)) { - /* - * return -EAGAIN, mmap_sem is dropped - */ - if (retry++ < MAX_RETRY_HMM_RANGE_FAULT) - goto retry; - else - pr_err("Retry hmm fault too many times\n"); - } - - goto out_up_read; - } - up_read(&mm->mmap_sem); + if (unlikely(r < 0)) + goto out_free_pfns; + for (i = 0; i < ttm->num_pages; i++) { pages[i] = hmm_device_entry_to_page(range, pfns[i]); if (unlikely(!pages[i])) { @@ -864,9 +850,6 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages) return 0; -out_up_read: - if (likely(r != -EAGAIN)) - up_read(&mm->mmap_sem); out_free_pfns: hmm_range_unregister(range); kvfree(pfns); -- 2.20.1