Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp240243ybh; Thu, 12 Mar 2020 00:56:30 -0700 (PDT) X-Google-Smtp-Source: ADFU+vveETSyw1odcAsRcXq1Pqz615NvXg6Pbhh6j48K/C6DyKcFVaQMb1QdOnAVxoH6xF0F5cem X-Received: by 2002:aca:4287:: with SMTP id p129mr1606586oia.168.1583999789987; Thu, 12 Mar 2020 00:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583999789; cv=none; d=google.com; s=arc-20160816; b=JH4jmtTSZsKYlWGTk/mpWgAUgfZG2nZBXEMvyG1FAUvfqbQs+8zeWr6OzSzM0N0dr3 hvxNl9KiUfRzxoBl2N/Y1OJ+a+Bnu9HUxP8jKJGEngjsRucuiEvzSkPXY8y7tetRFREu ZMvBiAQErwsEUVTRSzX114bJ9E367f2FbliQcVzSHECQ1nQfIr5ZulJBeIUwOdESYPx6 lym2AAkyQScICijBk6Zr4cA1DCdswbbhyhs6pzL3ESMkvMhPBZqZsyddISGlEzvXFZqF tY1Uvb4rHkQPmI/zaf4H7vS32oc1fn1AIdEJtfFoLqpwCQtLjcaWc3sJ8bwrpRLxmOfJ YEpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Y8PH8OwRLD6nQXDDi9y8VIf66Uz6y/cjwU3hUU4CHeQ=; b=e7E74OgiUArLL8b4fdQe57Q0fW/k2ouJKW5L7sDnzoQNtAoLhlVqUwXQPOAW7IWJPO ESI6aldrIRxLoaL+zBv/vSOk1RMycA/b1u++OVjgyWCOol8zJ7bwOpt+vi5+3u799t4j 00yQTt21d+55lfG3JavdG2XQK4vLQHNM0bF+fIH4p8xpwaycDyCtNQioUwWYPSBjBI2s DkpND8IpTzBAS4QN+SHLyjL5hCLym+/7+MLvR/d65Kd11Mp54FqGXs+UBNEpMkBAd6VG MFnqLZ4pAaQg54iKTZCHrUuAzHdNvEMSXMUZdeP7oygjoPXjYxCDnv7Xvp3WiRWZk4aT Ugvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NYpb5ale; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m20si2320532otp.255.2020.03.12.00.56.16; Thu, 12 Mar 2020 00:56:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NYpb5ale; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388096AbgCLHzy (ORCPT + 99 others); Thu, 12 Mar 2020 03:55:54 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:40831 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387869AbgCLHzy (ORCPT ); Thu, 12 Mar 2020 03:55:54 -0400 Received: by mail-yw1-f66.google.com with SMTP id c15so4710174ywn.7; Thu, 12 Mar 2020 00:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Y8PH8OwRLD6nQXDDi9y8VIf66Uz6y/cjwU3hUU4CHeQ=; b=NYpb5alec01RBygunaSyIwAvzoDgMhxcnYOM5Z0iWhI6ke8QJJuGbFWLgFtCkzOhSo GmBEWrvQPIhOxjn7HuZ7k5vG73LaHkos049KQPV5cc2hFNRvbijKNH9UqIw+VgasE4xn 3u7y7elTcNfK1JzMXRbdFDFnqbOxqmLRe+0rUE5mK/coiDm/Xdd+K3y7vJXqETfNaKUl I7SRSFAGlpKQOP6enB7qLsjfHZagaBg0kGG8KnhuK9p/9Obksy8WCavX1brmWM52OIno Zyuu7bat/tQDr2/OE3y96UhIQ7QPveDoq0k2IxJJU4ACBvdTqQ5KLP5bueYl/O1MeTvH Bw2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Y8PH8OwRLD6nQXDDi9y8VIf66Uz6y/cjwU3hUU4CHeQ=; b=hBnnebFSUQ2yabngB6S6VMTJU3fvP72f3dGH2CfOhn1aV/8/AvShEURfjJ7ZKjdODE AL1T0rpoGLD1PDmRhE93lKBpC4FImDjZFAagOnpshzjmzFLVwCA6KRcvlccHMrkybTC3 lsKurZLKNtXJWvaeoyZsQD/yZSgVJCXgU3E7M4wZ06hHAvL8vFXZm7ttEObQ4QBmzMi9 OKHO1g9LcYtZdfY84ZVaNwvAwyAU9Pn8IpRsdlKBigQYOrgfKKZOJ5qkKTPs+zeDKDXc uAOFKVHcGfEn7oD00RQGiLf1pJbwg/5+pl1lPf+B3mKO7h5SZRlqhCPyEJzxqVRfNvUn i6pw== X-Gm-Message-State: ANhLgQ2BXU0YTQApYn/Qmme6h/Vd33X5lxM17OFG9CFizx1GWG8yj7ju xLMtmQgGvQH/2vJe8MiLxKd4wQ1TM7Jsk0tfwSY= X-Received: by 2002:a25:ace2:: with SMTP id x34mr7802951ybd.83.1583999750963; Thu, 12 Mar 2020 00:55:50 -0700 (PDT) MIME-Version: 1.0 References: <20200304001339.8248-1-rcampbell@nvidia.com> <20200304001339.8248-2-rcampbell@nvidia.com> In-Reply-To: <20200304001339.8248-2-rcampbell@nvidia.com> From: Ben Skeggs Date: Thu, 12 Mar 2020 17:55:39 +1000 Message-ID: Subject: Re: [Nouveau] [PATCH v3 1/4] nouveau/hmm: fix vma range check for migration To: Ralph Campbell Cc: ML dri-devel , linux-rdma@vger.kernel.org, linux-mm@kvack.org, LKML , ML nouveau , Jason Gunthorpe , Ben Skeggs , Andrew Morton , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I've taken all 4 patches in my tree. Thanks Ralph, Ben. On Wed, 4 Mar 2020 at 10:14, Ralph Campbell wrote: > > find_vma_intersection(mm, start, end) only guarantees that end is greater > than or equal to vma->vm_start but doesn't guarantee that start is > greater than or equal to vma->vm_start. The calculation for the > intersecting range in nouveau_svmm_bind() isn't accounting for this and > can call migrate_vma_setup() with a starting address less than > vma->vm_start. This results in migrate_vma_setup() returning -EINVAL for > the range instead of nouveau skipping that part of the range and migrating > the rest. > > Signed-off-by: Ralph Campbell > --- > drivers/gpu/drm/nouveau/nouveau_svm.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c > index df9bf1fd1bc0..169320409286 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_svm.c > +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c > @@ -179,6 +179,7 @@ nouveau_svmm_bind(struct drm_device *dev, void *data, > if (!vma) > break; > > + addr = max(addr, vma->vm_start); > next = min(vma->vm_end, end); > /* This is a best effort so we ignore errors */ > nouveau_dmem_migrate_vma(cli->drm, vma, addr, next); > -- > 2.20.1 > > _______________________________________________ > Nouveau mailing list > Nouveau@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau