From patchwork Tue Jan 16 06:18:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "He, Hongbo" X-Patchwork-Id: 10166071 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 E0562601E7 for ; Tue, 16 Jan 2018 06:18:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8E6C2811E for ; Tue, 16 Jan 2018 06:18:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBC63281DB; Tue, 16 Jan 2018 06:18:28 +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=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 5BEC02811E for ; Tue, 16 Jan 2018 06:18:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D25906E194; Tue, 16 Jan 2018 06:18:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0057.outbound.protection.outlook.com [104.47.38.57]) by gabe.freedesktop.org (Postfix) with ESMTPS id E21366E192; Tue, 16 Jan 2018 06:18:22 +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=B40CZQ7YXslxvm9T2S8HuE1x11m4xa2Ilsc3wf7xvww=; b=2FZ0oHDYTzYfj2mgBk3e4YzZwfRrPdNMj1tUeOxWt76/PN7rnbggUYqK8vg1fT37y/GUjShIBpd40mGdYQNFqJblF7ZlCWUXheAVV/pIbu8gdiGv/0OJGy6MfJSpSqbCuLznmJIvsAbT7VkhDjMkkNZbFcy8/dcizzeabUJbN1o= Received: from MWHPR1201MB0127.namprd12.prod.outlook.com (10.174.98.142) by MWHPR1201MB0126.namprd12.prod.outlook.com (10.174.98.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Tue, 16 Jan 2018 06:18:21 +0000 Received: from MWHPR1201MB0127.namprd12.prod.outlook.com ([10.174.98.142]) by MWHPR1201MB0127.namprd12.prod.outlook.com ([10.174.98.142]) with mapi id 15.20.0407.009; Tue, 16 Jan 2018 06:18:19 +0000 From: "He, Roger" To: "Grodzovsky, Andrey" , "dri-devel@lists.freedesktop.org" , "amd-gfx@lists.freedesktop.org" Subject: RE: [PATCH 2/2] drm/amdgpu: Use new TTM flag to avoid OOM triggering. Thread-Topic: [PATCH 2/2] drm/amdgpu: Use new TTM flag to avoid OOM triggering. Thread-Index: AQHTi/TDQu+2rTSk7k2DSqgGu5vSAKN2B3Uw Date: Tue, 16 Jan 2018 06:18:19 +0000 Message-ID: References: <1515796118-18971-1-git-send-email-andrey.grodzovsky@amd.com> <1515796118-18971-2-git-send-email-andrey.grodzovsky@amd.com> In-Reply-To: <1515796118-18971-2-git-send-email-andrey.grodzovsky@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Hongbo.He@amd.com; x-originating-ip: [116.228.147.241] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR1201MB0126; 7:LjjFyw4gLzzkudahgDtPPhScqeLu0P2NQhNzxpKbO3BJLPHpLmz28E2mDxC1psbqH65SVBz1ysp0kNjawUDrSzFGjobADM3zhoMp2F+SuF5MZ9LafAJumTEvEca0B9C6o0nuhQRhLmVPMKTFGqWlP54Zfi4Lr73pITzraQD+GgYfMscQ0nzuPD9TOAJlkdNMRi2SmHaZpV/ZIQ4AWnisUTQ0DA3APRu1aJsLDZZF1m713EXQ6G/2N+TxZkTNfoBP; 20:Ns0sLaDrO07a0YWg4SPv64J4RuctYeL1f8P5Po7yOKm14adpVOCsVpERvVXuk5590EnVHCgdofdy+nCKcUoq4rSU79OPtK/0qOmTOJt/oDjQAXQMPWZ7kPLnXQLDFdbOMYrWTs9HechmYu2N46ZfVGmU1rMdmlteyPrJV9quLT/Maab7WrUKJr58atllN+YII4Fbpwv8nxXtc++9XogssTlghUpUkXkEAmzyI61ZxpEE/+A2a2CBh/wEEhRWzoA8 x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10009020)(396003)(39860400002)(376002)(346002)(39380400002)(366004)(199004)(189003)(13464003)(25786009)(450100002)(8936002)(81166006)(81156014)(54906003)(6116002)(3846002)(316002)(2201001)(229853002)(86362001)(110136005)(8676002)(2906002)(478600001)(68736007)(72206003)(14454004)(99286004)(76176011)(7696005)(7736002)(74316002)(6436002)(106356001)(2501003)(3280700002)(59450400001)(53546011)(77096006)(97736004)(33656002)(102836004)(6506007)(5660300001)(66066001)(2950100002)(2900100001)(3660700001)(4326008)(6246003)(55016002)(53936002)(105586002)(26005)(305945005)(9686003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR1201MB0126; H:MWHPR1201MB0127.namprd12.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 03df836f-c68a-43e4-ba10-08d55ca8f05e x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:MWHPR1201MB0126; x-ms-traffictypediagnostic: MWHPR1201MB0126: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(767451399110)(217544274631240); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(10201501046)(3231023)(944501161)(3002001)(93006095)(93001095)(6055026)(6041268)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011); SRVR:MWHPR1201MB0126; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MWHPR1201MB0126; x-forefront-prvs: 0554B1F54F received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ZoBZj2srPtZG1wxTU8l+3oV16RFZCsCA8g5jKdXoYwLk5t2ztxxn9btF/WH6j8o71P4b/30QluwInf5E+8y2gg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03df836f-c68a-43e4-ba10-08d55ca8f05e X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jan 2018 06:18:19.7919 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0126 Cc: "Koenig, Christian" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP -----Original Message----- From: Andrey Grodzovsky [mailto:andrey.grodzovsky@amd.com] Sent: Saturday, January 13, 2018 6:29 AM To: dri-devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org Cc: Koenig, Christian ; He, Roger ; Grodzovsky, Andrey Subject: [PATCH 2/2] drm/amdgpu: Use new TTM flag to avoid OOM triggering. This to have a load time option to avoid OOM on RAM allocations. Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index b7c181e..1387239 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -127,6 +127,7 @@ extern int amdgpu_job_hang_limit; extern int amdgpu_lbpw; extern int amdgpu_compute_multipipe; extern int amdgpu_gpu_recovery; +extern int amdgpu_alloc_no_oom; #ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index d96f9ac..6e98189 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -130,6 +130,7 @@ int amdgpu_job_hang_limit = 0; int amdgpu_lbpw = -1; int amdgpu_compute_multipipe = -1; int amdgpu_gpu_recovery = -1; /* auto */ +int amdgpu_alloc_no_oom = -1; /* auto */ How about turn it on as default? Thanks Roger(Hongbo.He) MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); @@ -285,6 +286,9 @@ module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444); MODULE_PARM_DESC(gpu_recovery, "Enable GPU recovery mechanism, (1 = enable, 0 = disable, -1 = auto"); module_param_named(gpu_recovery, amdgpu_gpu_recovery, int, 0444); +MODULE_PARM_DESC(alloc_no_oom, "Allocate RAM without triggering OOM +killer, (1 = enable, 0 = disable, -1 = auto"); +module_param_named(alloc_no_oom, amdgpu_alloc_no_oom, int, 0444); + #ifdef CONFIG_DRM_AMDGPU_SI #if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 5c4c3e0..fc27164 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -420,6 +420,10 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, #endif bo->tbo.bdev = &adev->mman.bdev; + + if (amdgpu_alloc_no_oom == 1) + bo->tbo.bdev->no_retry = true; + amdgpu_ttm_placement_from_domain(bo, domain); r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type, -- 2.7.4