Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3225198ybt; Mon, 22 Jun 2020 19:02:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyawR8qBlYG2DLKCXE+3R6lz/ywy9GtXyJQyzscO6BiykNkLTmjGLFXF2lnApvzB8UTXGBs X-Received: by 2002:a17:906:e298:: with SMTP id gg24mr17950688ejb.120.1592877764753; Mon, 22 Jun 2020 19:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592877764; cv=none; d=google.com; s=arc-20160816; b=wQgJTRajDXgf1H1R2fdzQVoFiSMGRTItj5RbZGwWc4G1AN/mCuhhQICtiaoDwUAvnx S146TzzALphXKsYT7KQFmlMmxC6Hc1XAmkpw5Rk+3pcdfl3yKPDryRph6hHcYraQkEyJ ukmMkVWNOVwJYg2oIFEqphZ7eans11+qRb0KMn4gBDzoKfh2SgfHRSKyq6coNmGc9PZL VHlBpBbflEdA5vkcP3A6rewNgp2XrCtQl19YMRmgdKCSFIGxFlk4QmS+WCV1yEuK4rLH 97wr2NLtld5l6rCPHW+P/ur/RBGONjvDh3apaJ8jPGupM7p2iQhhup9Re3FVcDtcph+q LraQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=2WrAbqXV4DGqxlrZm0+ZDSPDtMkQaV6QGvn6pSPJL84=; b=xyLgyOv/ijXvFUu15w8P0v3IO4TgCxmL2rFRmaq7MAcK7A0/uiNHlMEbxbRZguUsSg 2tw95kwOkBW2pt5NbVDk8txakpNWsol2jZX6sdSkLc6whFKl7PcLmFZg3qxkw01V3RUh /1Wc6zQqL+T217c2NgJlHX/zMmZe4uknqiUTX2qYw6CtIzCfnoz0WRbKfmBg12pu7xuh UkD5pINOlA6z8mnV4gC7UiUVi8/Yzncit0pAW/wgNTDeSagQx1CPEv878sOL5UVc9Eg8 LeDZ+C3ige7YS2J/n10kXH7ugDi3TE7v6R399uPSfkGqyqVcKv+LnkdAS5z/d3dbnp0P vpdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="GUxJV+C/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f6si10762766ejf.208.2020.06.22.19.02.21; Mon, 22 Jun 2020 19:02:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="GUxJV+C/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731856AbgFWAbD (ORCPT + 99 others); Mon, 22 Jun 2020 20:31:03 -0400 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:2467 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731717AbgFWAa7 (ORCPT ); Mon, 22 Jun 2020 20:30:59 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 22 Jun 2020 17:29:27 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 22 Jun 2020 17:30:58 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 22 Jun 2020 17:30:58 -0700 Received: from [10.2.59.206] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 23 Jun 2020 00:30:50 +0000 Subject: Re: [RESEND PATCH 2/3] nouveau: fix mixed normal and device private page migration To: Ralph Campbell , , CC: Jerome Glisse , Christoph Hellwig , "Jason Gunthorpe" , Ben Skeggs References: <20200622233854.10889-1-rcampbell@nvidia.com> <20200622233854.10889-3-rcampbell@nvidia.com> From: John Hubbard Message-ID: Date: Mon, 22 Jun 2020 17:30:50 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200622233854.10889-3-rcampbell@nvidia.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1592872167; bh=2WrAbqXV4DGqxlrZm0+ZDSPDtMkQaV6QGvn6pSPJL84=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=GUxJV+C/xcw2X+UKzYR0HO4lSwOnk4RAsKDmxnyBhUc/ZDOpq7i1TBhtNI0IuxO8t Vk3aU9aLCeDYez3x/H43zWX4DVKc7QreC8NXnlEDeI6R1j2f10oqs644W1dGmzh+vp 3d1+XPUn3Qt0Y8dyGN1pG/18VShsrDIK+uZxaMdNQuaTdUoZaTkcoesEazRT376OJS KNAxa2LzMt6rAmVPucNTn5Lpahf5/zF5vaRa1HPQ5H2GLNV/WaMzoduLSJnX2PwT6x 8cGJ8f8oRxHYkmU9TDnVvOT9Fv+gWry9WmY8iIA/L2UlSqnNZtiwHjomp3maYRYPB+ h7QmH3p7gxbzA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-06-22 16:38, Ralph Campbell wrote: > The OpenCL function clEnqueueSVMMigrateMem(), without any flags, will > migrate memory in the given address range to device private memory. The > source pages might already have been migrated to device private memory. > In that case, the source struct page is not checked to see if it is > a device private page and incorrectly computes the GPU's physical > address of local memory leading to data corruption. > Fix this by checking the source struct page and computing the correct > physical address. > > Signed-off-by: Ralph Campbell > --- > drivers/gpu/drm/nouveau/nouveau_dmem.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c > index cc9993837508..f6a806ba3caa 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c > +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c > @@ -540,6 +540,12 @@ static unsigned long nouveau_dmem_migrate_copy_one(struct nouveau_drm *drm, > if (!(src & MIGRATE_PFN_MIGRATE)) > goto out; > > + if (spage && is_device_private_page(spage)) { > + paddr = nouveau_dmem_page_addr(spage); > + *dma_addr = DMA_MAPPING_ERROR; > + goto done; > + } > + > dpage = nouveau_dmem_page_alloc_locked(drm); > if (!dpage) > goto out; > @@ -560,6 +566,7 @@ static unsigned long nouveau_dmem_migrate_copy_one(struct nouveau_drm *drm, > goto out_free_page; > } > > +done: > *pfn = NVIF_VMM_PFNMAP_V0_V | NVIF_VMM_PFNMAP_V0_VRAM | > ((paddr >> PAGE_SHIFT) << NVIF_VMM_PFNMAP_V0_ADDR_SHIFT); > if (src & MIGRATE_PFN_WRITE) > @@ -615,6 +622,7 @@ nouveau_dmem_migrate_vma(struct nouveau_drm *drm, > struct migrate_vma args = { > .vma = vma, > .start = start, > + .src_owner = drm->dev, Hi Ralph, This .src_owner setting does look like a required fix, but it seems like a completely separate fix from what is listed in this patch's commit description, right? (It feels like a casualty of rearranging the patches.) thanks, -- John Hubbard NVIDIA