From patchwork Fri Feb 9 10:00:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "He, Hongbo" X-Patchwork-Id: 10208709 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 021E2602D8 for ; Fri, 9 Feb 2018 10:01:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEFFA2982D for ; Fri, 9 Feb 2018 10:01:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C380A29845; Fri, 9 Feb 2018 10:01:06 +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=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, 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 640162982C for ; Fri, 9 Feb 2018 10:01:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 52A516E7AB; Fri, 9 Feb 2018 10:01:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0087.outbound.protection.outlook.com [104.47.37.87]) by gabe.freedesktop.org (Postfix) with ESMTPS id 68F406E7AB for ; Fri, 9 Feb 2018 10:01:00 +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=HCKkHf2ZF4wRBhZLTxINgfyhkwtulR57rZ8iWpbtmPs=; b=SBbh8BrNhN38HfJLgnajfHEt8A8gG6xbfZ/1fl/B/pPtOhwjdLnBe/zOv4fHeUm9t+l+IVDnNftffPKJSlGSBxk56sGeXv/8BkabHSoZqccijnZerng5nKsxM78Q9Jm0Y//qkZMWcpaqANGAXOcnfswJVggFAZExos93Y4PmUbY= Received: from SN1PR12CA0004.namprd12.prod.outlook.com (10.162.96.142) by MWHPR1201MB2478.namprd12.prod.outlook.com (10.172.95.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Fri, 9 Feb 2018 10:00:58 +0000 Received: from CO1NAM03FT008.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::208) by SN1PR12CA0004.outlook.office365.com (2a01:111:e400:5174::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.485.10 via Frontend Transport; Fri, 9 Feb 2018 10:00:57 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by CO1NAM03FT008.mail.protection.outlook.com (10.152.80.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.485.12 via Frontend Transport; Fri, 9 Feb 2018 10:00:57 +0000 Received: from roger-build-server.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.361.1; Fri, 9 Feb 2018 04:00:56 -0600 From: Roger He To: Subject: [PATCH 1/3] drm/ttm: add bit flag TTM_OPT_FLAG_FORCE_ALLOC Date: Fri, 9 Feb 2018 18:00:50 +0800 Message-ID: <1518170452-31111-1-git-send-email-Hongbo.He@amd.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(39860400002)(346002)(376002)(39380400002)(2980300002)(428003)(199004)(189003)(105586002)(4326008)(2906002)(77096007)(8936002)(26005)(336011)(106466001)(186003)(16586007)(54906003)(72206003)(86362001)(478600001)(47776003)(305945005)(2351001)(7696005)(104016004)(50226002)(68736007)(8676002)(356003)(316002)(51416003)(97736004)(53416004)(50466002)(36756003)(53936002)(81166006)(6916009)(6666003)(59450400001)(81156014)(48376002)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR1201MB2478; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT008; 1:N/oaaz/G9zMSZmaMbPtg8mVvUU/7rPEOlYFoYOcyxZcF7rQL9C85FHzNtZdKA8a5Yfe6FHFgxbhs60pgl3IkI9YhhU/RN4DujFkhKbhe2OBa3bD0XzKReGZIldCGJ4c9 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f06f5476-979d-4df9-4b98-08d56fa40403 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:MWHPR1201MB2478; X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB2478; 3:OtT1MQf3sXEarCvI/O2PScsNJccg9rFt0xPuVKcM6ZVp33tmR3A0rfuFsn+oqk1vJeaULWMo1q61kZ6dsQwTrRdCPVi4Y0S0GuW71jLesfBw4w1w4gmChjUuyRvSsUuan7kuTZutQbPmv3Ye3v7xAALrxgmcHj9hdjpv3J7sz5EHX84g9N8Hs32TqqO8frldy6wJ0EQkdFnCQ0S1MtHbMG6nOk6n5a5bT6H0/x746+sGBHCDdCZUC1hxbTlGRs2k23fMicDCYb4/RGAr4gWcxIAYdmhDPYn5mf3yMXtYOSyhsea1zoTwI7MNwRhLm2AEcrDJLUSgidYzqWxjtEAxetN1BljLwEIY5RBzy1KEMpY=; 25:YsnN465mFbNMQPEanZpn8xaUigQ3HzDE04TBLqnya0jkp4cjV00vZpQPb3wgZil6VVqPDrufjMU/R5dSDB7LtJWwiCmjJ4HAfZOA0eyM1AJi8wYjzw89YQmBo3en/g3nzm+8yf0RECEQX1qbW5VENIkvs6R58DXFuNF+hNZJgOp1FqCMowI5hwQaUj927Z1lXD4Zz75iDrr0LSWwRKgfilaEGvzi3nqZueBrLkh2rMsejyBc0zm4xvQtYJomA1U2/rOIaVftbxrvdb+pMJh6PxPqgFDWRhPKtnonQ8xFviKG0FyyJdL39kjMJZ0GOtFFWC2cRB/1ozIG5YKc+2vKJA== X-MS-TrafficTypeDiagnostic: MWHPR1201MB2478: X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB2478; 31:LxiN6Hk4e0v26GZFxdA+yAlP54sMXcpey8tGzOCV84Nv31lnRuHpBLvOQO1Zyt58mC3VA9m8niuipXyUC8+lk9kOAZvUbljvHggVscTwI0MnselYwE4KSQbkqzl6VtDMgJTASXccHtMw71F+9ZdsVXALq8mQrWn8nGxsXMiBtccfoKZeu072eqt9JdDj+zUYwEFilE+2tgVniJzma8wLxLkw3CWIxypI7A7XJycu2SU=; 20:aDefQ9s27ew4WDwqqQd/Js81OJ+wc++TkbjuJA8PU0MVPs9W23psANQyB21tigT4JXXPUeYnVjJJMTcG/0SNw9WIPzBRusziCw8uvttoui24jQFmWw73ynO2jeYfHdjZFSOcuJa8fpACo09CI9nkRR+ohXVf5K9c91mriybKMqDHsAQcUGslX1e06R5oMDeQzrJmM675XeY1ldL1U6x06raeeOfBwPEzG0w256uR0EoDVMFnRl+82rtWz35O+DBhej1PlIGbzFX0ZK13JWmOnKTlRHhecST/6H0prKhlhgZS5Af03hhkWZyr7WNqG7pnRZ/uRYp82A7DFDuv6CS+o8aZj1MplMRRdJd1yBE9gwU2r0/rhn4M6F0RTvEwUHE5BapHhSK/1Cq0dLuK7GO5ZNNfI31dQAKrgD2xvOCTQjKsyO70+CZ5+dnRLaSxcJ0Zbu8TLWX2sqon+EyyezyRp2ENieEcSua0RNQftPekiQ06xFVedCOQWdEGFkgOT3TD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3231101)(2400082)(944501161)(93006095)(93003095)(3002001)(10201501046)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:MWHPR1201MB2478; BCL:0; PCL:0; RULEID:; SRVR:MWHPR1201MB2478; X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB2478; 4:DmbFUTMHNC1G0rLT2JufmA00CVz8gC8v9y67IkE4AHMM6Z5gPXbk/BdEUM1CSazXx6OkZMj2iymvFk4bQW2C0GfyW15kSEn/4FTev71M5wPLP2mlE7ERmSyVr9ExtLfPMSgjLcoqRwwKZAXPRwusXnAPWxERWLswFRvFrnekdpAr2/V/BjmqQqGQ1EPTC0F0OPTa6Sxx9Z/hY125zwPHlJ4VeoXh2UWYcJJUC+qDrsQ70TM/U5RO2hgzCa/eHKVfCWm2gSRMfLefaeoZhE0f+6WwPDj75q3usr1bZAWdKEKGDSv6fCcYAOhQZn+tRzIH X-Forefront-PRVS: 057859F9C5 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR1201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tUCQL5Qn0vcGZxSL9yb9yGSJJoIZ2ZsuoV/sy/VOZvduK+m8y3daH79FpnQxCggGWrfRSyecMf0IcqpfaEtq0TgHmZzReq0TAZ1NsvXxLD7zF7MOHRDgYZ7hgN4hoLcT+DDTL8c9wELFuI5f6A SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB2478; 20:bepNH5Fe6mHt0j5wo+maPo5HWXG8RXPpAjipTwU7cs9xMAqrBWmR8l56+qIcqm0Ting142s+r3wEEZ9AFZE5+9o3aXVVHcGmY6OvQM5bdq8b+1lGv+3gW0/P1pe2yTAMroMbaPdvHHXiA0SadE0LDkPpCL4w4azr7gXYWSNZ0nPYZ7Rs6gLTA28gBYyVYa7cpixgVsrP4BpYcWq06hwaN2QILfa/6eWRMp0Q9M06dk4i+gQYt/EGo0igSE0/FF9s X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2018 10:00:57.3562 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f06f5476-979d-4df9-4b98-08d56fa40403 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB2478 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: Roger He , Christian.Koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP set TTM_OPT_FLAG_FORCE_ALLOC when we are servicing for page fault routine. for ttm_mem_global_reserve if in page fault routine, allow the gtt pages reservation always. because page fault routing already grabbed system memory and the allowance of this exception is harmless. Otherwise, it will trigger OOM killer. will be used later. v2: set the FORCE_ALLOC always v3: minor refine Signed-off-by: Roger He --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 4 +++- include/drm/ttm/ttm_bo_api.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 716e724..7ad8d70 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -226,7 +226,9 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) } else { struct ttm_operation_ctx ctx = { .interruptible = false, - .no_wait_gpu = false + .no_wait_gpu = false, + .flags = TTM_OPT_FLAG_FORCE_ALLOC + }; ttm = bo->ttm; diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 872ff6c..2142639 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h @@ -278,7 +278,9 @@ struct ttm_operation_ctx { }; /* Allow eviction of reserved BOs */ -#define TTM_OPT_FLAG_ALLOW_RES_EVICT 0x1 +#define TTM_OPT_FLAG_ALLOW_RES_EVICT 0x1 +/* when serving page fault or suspend, allow alloc anyway */ +#define TTM_OPT_FLAG_FORCE_ALLOC 0x2 /** * ttm_bo_reference - reference a struct ttm_buffer_object