From patchwork Fri Jan 26 18:29:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "StDenis, Tom" X-Patchwork-Id: 10186727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DCAA660383 for ; Fri, 26 Jan 2018 18:30:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDC2D297F7 for ; Fri, 26 Jan 2018 18:30:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C210029BC8; Fri, 26 Jan 2018 18:30:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 71F79297F7 for ; Fri, 26 Jan 2018 18:30:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6876E6E669; Fri, 26 Jan 2018 18:30:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0071.outbound.protection.outlook.com [104.47.36.71]) by gabe.freedesktop.org (Postfix) with ESMTPS id 052756E706; Fri, 26 Jan 2018 18:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=O72IkNfdWeu6fFNPDZSBEM3U93X3QJ/slzpx5GXDvTU=; b=eVtGTIBmiNZzI/rqxps4ZRPoMqnfksK+o/JUpXWytCYyxY0UFzfFl1ElykHeN5J0ZCtaGiLE+IuPacE0shZo7bzp1cCU85jKJi2nAGdEhRwmMZfjAoUlVu6EgkVt4rg7/wxbq5gXII1fu7qq+57uzbj4sg5sftR9NkzRPFew3No= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Tom.StDenis@amd.com; Received: from fx8.amd.com (165.204.55.251) by DM5PR1201MB0076.namprd12.prod.outlook.com (10.174.106.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Fri, 26 Jan 2018 18:29:33 +0000 From: Tom St Denis To: amd-gfx@lists.freedesktop.org Subject: [PATCH 10/12] drm/ttm: Remove unncessary retval from ttm_bo_vm_fault() Date: Fri, 26 Jan 2018 13:29:09 -0500 Message-Id: <20180126182911.20761-11-tom.stdenis@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180126182911.20761-1-tom.stdenis@amd.com> References: <20180126182911.20761-1-tom.stdenis@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: MWHPR03CA0027.namprd03.prod.outlook.com (10.174.173.144) To DM5PR1201MB0076.namprd12.prod.outlook.com (10.174.106.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e361a3ad-2af4-41a1-ffe9-08d564eabfa0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM5PR1201MB0076; X-Microsoft-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CJCz9u3uZDXgvB9Q8OqvtqfAiRWm7IwgBGI7xrEV6xOk73N/My2Id2qR5i7xisAShhLQMJgYzGRzUPGJmEzHKaLI3qZNvgVtILN8JlxtxJjsxSwQWL+8oVxZOy04KEnG0pEWiZMTc6q/MfBmKT5hgwvRdxgueJRt5t+FvPfwb8VFUlqYEq6lVHeMCxD4gABZwSKF7Tvbx9FmHNfpYzO7y2yYbSAFCLB9IdlJ6rWVxMMg7t8yJx1YWw1YcCCRQrEoseCEM1QxXHNrAZGDO2xyW4FlTzRWYZxAB6B8y/e/4dTOZ3lx9Q/tLtNNBVkKeort0rAgQr03fS/YHf9+ACswXDN9FR1zuP68tJ48dDEpfkq2E/spfK/ED5b8+TocFRRKEzl5f5W+l; 4:ZP3gD7+Mtp3Yy2BjKrG/lKb0iU1A8H5MqoI5V8RblBQlgljByHlNnMxRSSQvV9a8LqKeQ+9255vyWBXa9YYxaAVd+67MZ2+gQh0/PvbUwkZiVa39J3uNSdkxoDxzfqz7BuUWrBq+8hl44ui1U4Ghydd1goL4lK8xvySC1/c+uQTsnPQRZ7zkSGpCydMPJurdGj2kJ6Yec4S1E9T59PYGlWhBusFqqCec92kzbZdDSUF7RnpZYotwte1I/IU9iWxdUNo6/dG9nJdA+SFgMJkuPF627K5ZnYwIXpp6vHNvjIUT55BiC0+SarXUnZA1BKcr X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231075)(2400081)(944501161)(93006095)(93001095)(6055026)(6041288)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR1201MB0076; BCL:0; PCL:0; RULEID:; SRVR:DM5PR1201MB0076; X-Forefront-PRVS: 05641FD966 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(376002)(396003)(39380400002)(346002)(199004)(189003)(6916009)(2950100002)(6666003)(7736002)(305945005)(5660300001)(1076002)(6486002)(6116002)(3846002)(53936002)(86362001)(51416003)(16526019)(81156014)(7696005)(52116002)(186003)(26005)(8676002)(97736004)(59450400001)(386003)(50226002)(53416004)(76176011)(8936002)(81166006)(25786009)(36756003)(316002)(478600001)(72206003)(47776003)(50466002)(68736007)(16586007)(48376002)(450100002)(66066001)(4326008)(2361001)(106356001)(105586002)(2906002)(2351001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0076; H:fx8.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR1201MB0076; 23:V9BfunB6YFE9i4NCWxE7ptI4fid/DomOS+YJB46?= =?us-ascii?Q?xiMxUnol52nBbaKx7ukQ3umHdsX2E+SvPhWddPSvOATgq8BRZ9AXYIxGagoR?= =?us-ascii?Q?DK3PIaWSDxVTZRljlmbIjQ+hcBkrr+nHczt9MUmnAPhzvkdX30FqPc9c30Q/?= =?us-ascii?Q?r04JW2vOpdjNAN2k9+GbfjvrrYlRGERa3oYYzJbG9W5qRxhuAgQGLLJoJfqY?= =?us-ascii?Q?jIXa6KGRY8o2KCRx50+8rVGTKdEjh5aLYiCBHVt2A1DhpcYyn7RWom1zDlU4?= =?us-ascii?Q?+1PqKrAuJMz9ifh030LliQf2UfPBdqtMhoLjvhnWXP71ReC7oLt1hO1W/XhO?= =?us-ascii?Q?ie6YHTImWn5yqj5s4wJNXQxVEirVntePJzFKuTdyGGWhnPfsL2+u5hLhm4ad?= =?us-ascii?Q?63JARezaJYqUXc+DhdVOTE5v4NYE1tnAjDxjUFmmISUI5aUKDO1/8Vr4t/qo?= =?us-ascii?Q?FYhgdNSxskFwPLZ1zzK3dPlKnrnVwB6nIiqSIl8GLUE77wO1pty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V4ZAJ1Sjevl46adZt+93yA+kWJTWin9CW+TUSVPoaaGvKWyCn2EXcDBDDI X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2018 18:29:33.6511 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e361a3ad-2af4-41a1-ffe9-08d564eabfa0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0076 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tom St Denis , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Tom St Denis --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 08a3c324242e..07b22f04b969 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -118,7 +118,6 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) int ret; int i; unsigned long address = vmf->address; - int retval = VM_FAULT_NOPAGE; struct ttm_mem_type_manager *man = &bdev->man[bo->mem.mem_type]; struct vm_area_struct cvma; @@ -158,7 +157,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) * (if at all) by redirecting mmap to the exporter. */ if (bo->ttm && (bo->ttm->page_flags & TTM_PAGE_FLAG_SG)) { - retval = VM_FAULT_SIGBUS; + ret = VM_FAULT_SIGBUS; goto out_unlock; } @@ -169,10 +168,10 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) break; case -EBUSY: case -ERESTARTSYS: - retval = VM_FAULT_NOPAGE; + ret = VM_FAULT_NOPAGE; goto out_unlock; default: - retval = VM_FAULT_SIGBUS; + ret = VM_FAULT_SIGBUS; goto out_unlock; } } @@ -183,12 +182,10 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) */ ret = ttm_bo_vm_fault_idle(bo, vmf); if (unlikely(ret != 0)) { - retval = ret; - - if (retval == VM_FAULT_RETRY && + if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) { /* The BO has already been unreserved. */ - return retval; + return ret; } goto out_unlock; @@ -196,12 +193,12 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) ret = ttm_mem_io_lock(man, true); if (unlikely(ret != 0)) { - retval = VM_FAULT_NOPAGE; + ret = VM_FAULT_NOPAGE; goto out_unlock; } ret = ttm_mem_io_reserve_vm(bo); if (unlikely(ret != 0)) { - retval = VM_FAULT_SIGBUS; + ret = VM_FAULT_SIGBUS; goto out_io_unlock; } @@ -211,7 +208,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) drm_vma_node_start(&bo->vma_node); if (unlikely(page_offset >= bo->num_pages)) { - retval = VM_FAULT_SIGBUS; + ret = VM_FAULT_SIGBUS; goto out_io_unlock; } @@ -238,7 +235,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) /* Allocate all page at once, most common usage */ if (ttm->bdev->driver->ttm_tt_populate(ttm, &ctx)) { - retval = VM_FAULT_OOM; + ret = VM_FAULT_OOM; goto out_io_unlock; } } @@ -255,7 +252,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) } else { page = ttm->pages[page_offset]; if (unlikely(!page && i == 0)) { - retval = VM_FAULT_OOM; + ret = VM_FAULT_OOM; goto out_io_unlock; } else if (unlikely(!page)) { break; @@ -280,7 +277,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) if (unlikely((ret == -EBUSY) || (ret != 0 && i > 0))) break; else if (unlikely(ret != 0)) { - retval = + ret = (ret == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS; goto out_io_unlock; } @@ -289,11 +286,12 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) if (unlikely(++page_offset >= page_last)) break; } + ret = VM_FAULT_NOPAGE; out_io_unlock: ttm_mem_io_unlock(man); out_unlock: ttm_bo_unreserve(bo); - return retval; + return ret; } static void ttm_bo_vm_open(struct vm_area_struct *vma)