Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp350193ybt; Wed, 24 Jun 2020 00:27:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2TE5pZadLnaQRr3kKOI7kafKfmYcSbDS/4OHKta1Y/cnlo9/2jR02jzOYTe+QUrlWexW+ X-Received: by 2002:aa7:c6d1:: with SMTP id b17mr26849731eds.39.1592983641237; Wed, 24 Jun 2020 00:27:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592983641; cv=none; d=google.com; s=arc-20160816; b=RscgrU0q6Yopkm/MIN898iI85gf5AzjmlmVE34jl09SDQNWRpniYKOg4dvp8+ubw+y Qh/7scTMhn3GlrQcdOrXMaIo63rxHSOlM27D05DedYaHW5ZK9vWGU++T13M6ovvhw3ks 8K4YQxdmmpptqBv7CIRa5d/+jEote8xE72OXlpwJzVT0aWzGStH4czXkxiNhdAJJmE7j p6h8u4fxqWnsNjJGXGGeqi1pQFlLe3F6qZgzBPpy7Lxk6/K7WQoxPEG8Uv7oKD8v9HLv t5unzvhc5denoF1JTyD0c6jU7gAQVmx5LgwPlpKBYr1RmzTqRXrPcd1fmB9waQAiUnE+ 8LdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=D1vJ9TQG7kye3YwvS+tmyIHUK6luqrUBl60ESUCMHKY=; b=o3Jg2N2IKBdOljU8ZDY/8XgOCzEhI9Az/ayPVTeOySLF8MJuiQcj0XxIVEUK6lzeld v/ozIsoQww0meb9C/BNfG4dfTZstYmIa4nx1UWouhKekx+NaOtHH44AKgbbgPddnPWe1 CMKOS6NTiY/dBkZny+CzSUquF022TkT8Eh9DvVoT8DmRUN6cmGVqWVe2Q0TfyJLm1Kxp NbTdfIhbxDGnLFLEQszobQX2/jdxa8dlnPwUvXg2KEDpHl0UTUJOP/lXZYJvouYioXux de8divJRx91uGMvWDI/VAsH4RK2nneg3xQ9TRx2eIFcArY/bHSXsfQBbzSA489HWldWG 3Iew== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si12495497ejp.499.2020.06.24.00.26.58; Wed, 24 Jun 2020 00:27:21 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389776AbgFXHX7 (ORCPT + 99 others); Wed, 24 Jun 2020 03:23:59 -0400 Received: from verein.lst.de ([213.95.11.211]:43139 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389651AbgFXHX7 (ORCPT ); Wed, 24 Jun 2020 03:23:59 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 1899468B02; Wed, 24 Jun 2020 09:23:56 +0200 (CEST) Date: Wed, 24 Jun 2020 09:23:55 +0200 From: Christoph Hellwig To: Ralph Campbell Cc: nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jerome Glisse , John Hubbard , Christoph Hellwig , Jason Gunthorpe , Ben Skeggs Subject: Re: [RESEND PATCH 2/3] nouveau: fix mixed normal and device private page migration Message-ID: <20200624072355.GB18609@lst.de> References: <20200622233854.10889-1-rcampbell@nvidia.com> <20200622233854.10889-3-rcampbell@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200622233854.10889-3-rcampbell@nvidia.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 22, 2020 at 04:38:53PM -0700, 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. I'm really worried about all this delicate code to fix the mixed ranges. Can't we make it clear at the migrate_vma_* level if we want to migrate from or two device private memory, and then skip all the work for regions of memory that already are in the right place? This might be a little more work initially, but I think it leads to a much better API.