From patchwork Thu Jul 10 21:47:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 4528511 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C2A9C9F37C for ; Thu, 10 Jul 2014 23:34:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0AFB8201B4 for ; Thu, 10 Jul 2014 23:34:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DE31B201F5 for ; Thu, 10 Jul 2014 23:34:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2BC906E7A5; Thu, 10 Jul 2014 16:33:24 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by gabe.freedesktop.org (Postfix) with ESMTP id 7CDEE6E0B0 for ; Thu, 10 Jul 2014 14:48:00 -0700 (PDT) Received: by mail-wi0-f169.google.com with SMTP id hi2so5148703wib.0 for ; Thu, 10 Jul 2014 14:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=6ScE+ZZsteziaz+1joNxViELDKNugvagmiydQjcy1bI=; b=lBuUgG/F2+4/JcQqs6LteHle81I4YRmxe399Uj1Jo5wNblbze1ZkCqcZWZHM7YXu0s MxBX2+Dt4ib7JomVZqMaCVn+r3E+XimudxXb76/znhSA1FpqNf6XpcVFeFEfcsbbn9bu ThvTqN412O7X7e9/fkGJB28szuepsgFiAX9n0uq8LCmwA8QbEgGSmvFx/QuFuP8nKxrQ 2JFW38GccBwCFK9keLU2Isb/V0nyyMhKRiwoMw3qHalW0+srEHQyClIUL7D2+ZdU2Cq3 MG6mwwiWAdNJD5l0dtwejxy0xfSaqhiMErvFW0JN94cEujKbIxAn00la3qsS4f/YlBTE c9xg== X-Received: by 10.180.21.200 with SMTP id x8mr22559880wie.67.1405028876295; Thu, 10 Jul 2014 14:47:56 -0700 (PDT) Received: from localhost.localdomain ([77.127.59.49]) by mx.google.com with ESMTPSA id nf11sm36280197wic.9.2014.07.10.14.47.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Jul 2014 14:47:55 -0700 (PDT) From: Oded Gabbay X-Google-Original-From: Oded Gabbay To: Andrew Morton Subject: [PATCH 01/83] mm: Add kfd_process pointer to mm_struct Date: Fri, 11 Jul 2014 00:47:26 +0300 Message-Id: <1405028848-5660-1-git-send-email-oded.gabbay@amd.com> X-Mailer: git-send-email 1.9.1 X-Mailman-Approved-At: Thu, 10 Jul 2014 16:33:12 -0700 Cc: =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Rik van Riel , Andrew Lewycky , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mm , Peter Zijlstra , Alex Deucher , Joonsoo Kim , Michel Lespinasse , "Kirill A. Shutemov" , Mel Gorman X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch enables the KFD to retrieve the kfd_process object from the process's mm_struct. This is needed because kfd_process lifespan is bound to the process's mm_struct lifespan. When KFD is notified about an mm_struct tear-down, it checks if the kfd_process pointer is valid. If so, it releases the kfd_process object and all relevant resources. Signed-off-by: Oded Gabbay --- include/linux/mm_types.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 678097c..6179107 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -20,6 +20,10 @@ struct hmm; #endif +#ifdef CONFIG_HSA_RADEON +struct kfd_process; +#endif + #ifndef AT_VECTOR_SIZE_ARCH #define AT_VECTOR_SIZE_ARCH 0 #endif @@ -439,6 +443,16 @@ struct mm_struct { */ struct hmm *hmm; #endif +#if defined(CONFIG_HSA_RADEON) || defined(CONFIG_HSA_RADEON_MODULE) + /* + * kfd always register an mmu_notifier we rely on mmu notifier to keep + * refcount on mm struct as well as forbiding registering kfd on a + * dying mm + * + * This field is set with mmap_sem old in write mode. + */ + struct kfd_process *kfd_process; +#endif #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS pgtable_t pmd_huge_pte; /* protected by page_table_lock */ #endif