From patchwork Mon Sep 13 16:15:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sierra Guiza, Alejandro (Alex)" X-Patchwork-Id: 12489909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE1DAC433FE for ; Mon, 13 Sep 2021 16:16:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8164C60F58 for ; Mon, 13 Sep 2021 16:16:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8164C60F58 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id D015D6B0075; Mon, 13 Sep 2021 12:16:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD9576B0078; Mon, 13 Sep 2021 12:16:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0318900002; Mon, 13 Sep 2021 12:16:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0223.hostedemail.com [216.40.44.223]) by kanga.kvack.org (Postfix) with ESMTP id A1C2E6B0075 for ; Mon, 13 Sep 2021 12:16:22 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5584C267C8 for ; Mon, 13 Sep 2021 16:16:22 +0000 (UTC) X-FDA: 78583052604.37.9539D27 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2086.outbound.protection.outlook.com [40.107.223.86]) by imf17.hostedemail.com (Postfix) with ESMTP id E5370F00039B for ; Mon, 13 Sep 2021 16:16:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RKweG7Wx6hfU78SNcLP/ZrxC/aGYMVSwCgtDk5KGcXUENQ5eyNlV0i6jwTulN5A08RA5DFpEeRUwuJno9klFvHuTtY/TtNJXtniPXHZ3zIUHtaGW1aBZZ9L0UsPqPIGp0d1xHu5tImBW/nJHX9urtWudozVl5Bp/ALVUEW11W/Hw3KvUI1PAO0Z8xTMHMDAFwgug+sDB5X2yHi8oABiYflsFLaWQxuxUCJ6mRA5Oiv51qzKx4WTkTDOymhCxFSnhkhn7Dzyqgl3ec2HH0nBWbd5zw/NKIGi669vfB2p/bykk6rdCti4rBLgzJolQyKrO9QUzxcGRWh7auG83na7NGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=DtslbnmgwcmVuw3/IJPuNMBAqQP2tzGnRh8lFmQvcmg=; b=oAaR3GtSJx5M9sA/G6TAkAE3rVlAYUYH8wl/C6ppVrBv4+pPYlJ2cX6bC/gZkQcWL/3/Zpex9m9QzcmN3ulTIIS/3rFSnjCuU1Cbteq12l2pipzkV++0/scQuSIZPDxwOvzrUudXWN3LqQF7G58XT3G4BwHHOYiMXsH9gGiSEyAg19MDPs8MePxtFcNyvaoZXLI5L3bYD4YBDIBEgzSugsJBWIw9wHnFMn0cCfXBWlMNJ2rEHR/j/6NxK08N/hkZuCETXck3cmt4r2CpYj+59O82pkObGzCt2BSzFuxAJh7GagXbHXzSpMLPLr0CDXU6OLmBCscJA5w0EbyiOJxESg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DtslbnmgwcmVuw3/IJPuNMBAqQP2tzGnRh8lFmQvcmg=; b=WysfpxMJgNIFvpKm6atq9yT9N72N9MTzx+x3x75Mt3xm946+ZOc7Q71WMCXHPy6BM42i9zrGujKIdRR2ORSasN5hAq4Y2L5Hor179Ex7Sx2tprxhKkeKaKN5sx5/nNdNZWzT0VoDpnlC6Nt6/GRtxA24lEC/eXot0WTP5OYuJeI= Received: from SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) by SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.18; Mon, 13 Sep 2021 16:16:20 +0000 Received: from SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::f1aa:9adc:b4f:4d14]) by SA0PR12MB4430.namprd12.prod.outlook.com ([fe80::f1aa:9adc:b4f:4d14%7]) with mapi id 15.20.4500.019; Mon, 13 Sep 2021 16:16:20 +0000 From: Alex Sierra To: akpm@linux-foundation.org, Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jgg@nvidia.com, jglisse@redhat.com Subject: [PATCH v2 05/12] drm/amdkfd: ref count init for device pages Date: Mon, 13 Sep 2021 11:15:57 -0500 Message-Id: <20210913161604.31981-6-alex.sierra@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210913161604.31981-1-alex.sierra@amd.com> References: <20210913161604.31981-1-alex.sierra@amd.com> X-ClientProxiedBy: SA9P223CA0015.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:26::20) To SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) MIME-Version: 1.0 Received: from alex-MS-7B09.amd.com (165.204.78.1) by SA9P223CA0015.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:26::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Mon, 13 Sep 2021 16:16:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b8218a3-a963-4a0f-56d7-08d976d1d2a0 X-MS-TrafficTypeDiagnostic: SN6PR12MB2767: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1265; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6I2Zus+O0FBgz+1ApIpd52hkvk3S/pKvqSH6SZyg/pxvtFZCooyFOC/uazIWNuNCSra9FCc6mDySHB32l+VQq/5GwyNfGk+v6vOC6kus6/wLfEKv0bLUVghhn+97AG5ce/R0BZsTFGiONXkWQLu3+LISz145QUj/YjicksLb7EWWtA7X6KrSDhHQ18zMSgcuSADTCldhnDla8uxcOf4XJCvWhnU8mfduMiR8AbWeV66c0xLPqyeJ48MFLb0sLJW7yN0nxXfn23AxVyhsUl6v++s30C+QmDMHiKgna6JhtaBLuPPum3avU1bFD1fPGj1vMECI7h5/+SznvQhK8R/XOE+UfxMnHrkXMzF8MK7RUhDNGyFbcLcDPAfkbr04uBAaKp2KSpm2kczmg/YTp/6/TLMpf8UW3OJ2SK0T0H0gzeeSbJhSjbcmQNlm5unQYWyg9rYPKB3nLX80pbXQcYXJSTu3/bHhO5uDC+IeG/lb6WY6azkSp15finwW6H+sx6Y2oiUyOXjj1UnSIGYquV3by3kkk592Yml8XtrsqDAiUdnjrWCIqU5782zWaYwdip4mC1IgHCzJ4jxx2ipjXryN/w2zJxj7EA2bgCw1InH5dzLnZPAkJH3fMMHiHX4YRY1sxvlHVDUS3iKRDPDTw7XXcTDooWUiSpEeH2QMz5B7uFgzbEeaCwInk7OPX6pGDgTSRh5I0Fys/1VjlpzcjN38Ew== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA0PR12MB4430.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(376002)(39860400002)(366004)(136003)(396003)(1076003)(7416002)(86362001)(66946007)(4744005)(44832011)(478600001)(2616005)(6666004)(6486002)(52116002)(7696005)(956004)(5660300002)(316002)(83380400001)(4326008)(38350700002)(38100700002)(8676002)(66556008)(66476007)(2906002)(186003)(26005)(36756003)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BhpBqPIwpLB38UvGlkdXfdJtLyHgl9MBt4DFfigJYgW2X4M++DT1RuKo3ya8URhYnoDD8nLp0dB7BD/sflUcjyiAq3f0hsZIpq0VahsPbIruP3clUNF78KW7BipnORAHErGFaAVXNiJyoC6k6Qw3ZvhVPomM2OMldXLgCAKDjEpMl7FkY2I5XVz3Ai+pKPDHhsVqMPLShgYsI/EWPM8Nxxi9CBIWMx9SecElgcOwLOVWceK/DXiavDqfqOREbBuQtw56hFhdSBsja6IO2OmpeTpBOW4IUBbM2/gwu5/aRF0i6NyN+SbcFImdhSu/UXsG8TkzRhtMj7SiN2iXQZ+MD0PXc7Fo9XPymeYffU9VqHeNsHo73XtADAPEzVbApUJJptgy/AmWOZQLj0/ItGKACI9CP/w+3BznkwlnYtuXvHuzVPCsN7vSmu4luUDZ66nWzLnPvFLaSwVUTIFHfD8+p2PKpognr6etP9JU8u14xM9lrUWvOGzdynH8jU88r+hB7/HHf06wsOE4wCt6UubFb4XwqSVfNTi8+1D22iHACTaqa2WC1Ul2gBSvhsAugjtzMNjh2imXzBIgWTt+/3K5w9PLKVRu/eUKeTwmBeImW6aG9DSlIyzvtdEAANRj6gIsHB26+U02KXiO2ppKmjHUIDxqlQD71Pjwb9+g9nOAhAXv/eB9PQ872ee96m4GeWGgmKlRfsIGaZzkfypDti+CjfmyrKXtHyVrHtxkfyZtwkXQIaJCruD9UfRUcjwkyqOLNi0q2Yj6rkxEBcg3BIi1BWZG+hVG7MFDZcMfZVdT49cxgAu4lg2FAR9MaENFHHkiLAHMymA6+4Il9vpSuwkVHwbQ5QICww1BvZm7G/EIB+n2L5T6R7JOoyxf21EL6vBYXayaopw30qnuQSeiKAuY6YbCiYZvuOM+zUEvojjjfFWuEXxknlFHVD4Y84F6uIDaDzP5bZb8VrlFn583oh4ay08VBWJnyQG4LwI21RfJ96m+WMBAnTBJpDXvSKaJHdzc7d164UJ2FRiQ2ShBYy5xrppPiF+IHeZYQDlTFDqr9qGZtVFK0cXvo4Dp/kUpy8Kin640RFuAI8atDHvVb15s0Zns5zrjDzp96Wd1iqNbw/dLPjE7NczAyVpZQBcdhc8qNUujZFPiARcHt6bSSa2QqGWHjE+aC6JDfzX09Tk5wFRQFuO+SDb3KKFIH2YpUr9bnB4PrirH87Qsf7m0J56H4FGiTEttrxcJmo7d3zyMrMFyjhjcr4bu8kTb8J4KUf5iGP27HcHi6Mi/2AAzD+4aFSxof/LeYFkVk49QwWloJVncRgfO8bDfX8kNil0q2J3o X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b8218a3-a963-4a0f-56d7-08d976d1d2a0 X-MS-Exchange-CrossTenant-AuthSource: SA0PR12MB4430.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 16:16:20.5214 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RtoVzQaTrJcpN4z1dnO3PyEiWFygZvUUjqPlwQXWxlo3OsVwhhD1a/g0e97wE1QVZa9wDfzLsD99eUzQvsHJ+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2767 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E5370F00039B Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=WysfpxMJ; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf17.hostedemail.com: domain of Alex.Sierra@amd.com designates 40.107.223.86 as permitted sender) smtp.mailfrom=Alex.Sierra@amd.com X-Stat-Signature: d6dqqf6pegnqpzb91qz1gbfmu7shoh8g X-HE-Tag: 1631549781-837432 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Ref counter from device pages is init to zero during memmap init zone. The first time a new device page is allocated to migrate data into it, its ref counter needs to be initialized to one. Signed-off-by: Alex Sierra --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c index dab290a4d19d..ffad39ffa8c6 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c @@ -220,7 +220,8 @@ svm_migrate_get_vram_page(struct svm_range *prange, unsigned long pfn) page = pfn_to_page(pfn); svm_range_bo_ref(prange->svm_bo); page->zone_device_data = prange->svm_bo; - get_page(page); + VM_BUG_ON_PAGE(page_ref_count(page), page); + init_page_count(page); lock_page(page); }