From mboxrd@z Thu Jan 1 00:00:00 1970 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=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 A5E83C43331 for ; Tue, 2 Mar 2021 18:08:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80D9664F1E for ; Tue, 2 Mar 2021 18:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580367AbhCBSCX (ORCPT ); Tue, 2 Mar 2021 13:02:23 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:11982 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837925AbhCBJNK (ORCPT ); Tue, 2 Mar 2021 04:13:10 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Tue, 02 Mar 2021 01:12:29 -0800 Received: from nvdebian.localnet (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 2 Mar 2021 09:12:26 +0000 From: Alistair Popple To: Ralph Campbell CC: "linux-mm@kvack.org" , "nouveau@lists.freedesktop.org" , "bskeggs@redhat.com" , "akpm@linux-foundation.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "John Hubbard" , "jglisse@redhat.com" , Jason Gunthorpe , "hch@infradead.org" , "daniel@ffwll.ch" Subject: Re: [PATCH v3 6/8] mm: Selftests for exclusive device memory Date: Tue, 2 Mar 2021 20:12:24 +1100 Message-ID: <4866160.ulnvbvOQiP@nvdebian> In-Reply-To: References: <20210226071832.31547-1-apopple@nvidia.com> <20210226071832.31547-7-apopple@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1614676349; bh=FeQHtfi4mCSWbQH0/aD7Oy3q/R8JrFmF5liDHR+wnLk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Originating-IP:X-ClientProxiedBy; b=HEiZZh4DK3KNf5gTFX02zJnM2b4ou/jDcSzCQDNZpPUD1j+uXhbse5auYqfmiU7Ec YXvVqk1kNu+9JT6l7F02Id1OMF+U0wEmNbvQu+/A3fXdEze7YxM7ab4F6YYYKwV/Fg Dm4znbewQozpm7A3c+OLIY1ia2ne7u3sRgRh+vejOiSB6QgLd6BMQm44HQa9cMzZFo k5ZNYwLJtxHXK1Cy2RXvbbUDWH1IntCrq79+XEho9Uqe5MtS3waXVyOSNZ7GIWALM8 B+++XLu/MiXh8eoRa+xCczpfPLRtfclfNcVGwwZ6yWPMbfL6KvN2XP1foQfzlXEZuJ iqBU0ylYO9AMQ== Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Tuesday, 2 March 2021 10:14:56 AM AEDT Ralph Campbell wrote: > > From: Alistair Popple > > Sent: Thursday, February 25, 2021 11:19 PM > > To: linux-mm@kvack.org; nouveau@lists.freedesktop.org; > > bskeggs@redhat.com; akpm@linux-foundation.org > > Cc: linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org; dri- > > devel@lists.freedesktop.org; John Hubbard ; Ralph > > Campbell ; jglisse@redhat.com; Jason Gunthorpe > > ; hch@infradead.org; daniel@ffwll.ch; Alistair Popple > > > > Subject: [PATCH v3 6/8] mm: Selftests for exclusive device memory > > > > Adds some selftests for exclusive device memory. > > > > Signed-off-by: Alistair Popple > > One minor nit below, but you can add Thanks Ralph. Will fix that. > Tested-by: Ralph Campbell > Reviewed-by: Ralph Campbell > > > +static int dmirror_exclusive(struct dmirror *dmirror, > > + struct hmm_dmirror_cmd *cmd) > > +{ > > + unsigned long start, end, addr; > > + unsigned long size = cmd->npages << PAGE_SHIFT; > > + struct mm_struct *mm = dmirror->notifier.mm; > > + struct page *pages[64]; > > + struct dmirror_bounce bounce; > > + unsigned long next; > > + int ret; > > + > > + start = cmd->addr; > > + end = start + size; > > + if (end < start) > > + return -EINVAL; > > + > > + /* Since the mm is for the mirrored process, get a reference first. */ > > + if (!mmget_not_zero(mm)) > > + return -EINVAL; > > + > > + mmap_read_lock(mm); > > + for (addr = start; addr < end; addr = next) { > > + int i, mapped; > > + > > + if (end < addr + (64 << PAGE_SHIFT)) > > + next = end; > > + else > > + next = addr + (64 << PAGE_SHIFT); > > I suggest using ARRAY_SIZE(pages) instead of '64' to make the meaning clear. > > From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 90CEAC433DB for ; Tue, 2 Mar 2021 09:12:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2DF8560249 for ; Tue, 2 Mar 2021 09:12:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DF8560249 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=nouveau-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BBD8F89C83; Tue, 2 Mar 2021 09:12:31 +0000 (UTC) Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 066EF89B78; Tue, 2 Mar 2021 09:12:29 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Tue, 02 Mar 2021 01:12:29 -0800 Received: from nvdebian.localnet (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 2 Mar 2021 09:12:26 +0000 From: Alistair Popple To: Ralph Campbell Date: Tue, 2 Mar 2021 20:12:24 +1100 Message-ID: <4866160.ulnvbvOQiP@nvdebian> In-Reply-To: References: <20210226071832.31547-1-apopple@nvidia.com> <20210226071832.31547-7-apopple@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1614676349; bh=FeQHtfi4mCSWbQH0/aD7Oy3q/R8JrFmF5liDHR+wnLk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Originating-IP:X-ClientProxiedBy; b=HEiZZh4DK3KNf5gTFX02zJnM2b4ou/jDcSzCQDNZpPUD1j+uXhbse5auYqfmiU7Ec YXvVqk1kNu+9JT6l7F02Id1OMF+U0wEmNbvQu+/A3fXdEze7YxM7ab4F6YYYKwV/Fg Dm4znbewQozpm7A3c+OLIY1ia2ne7u3sRgRh+vejOiSB6QgLd6BMQm44HQa9cMzZFo k5ZNYwLJtxHXK1Cy2RXvbbUDWH1IntCrq79+XEho9Uqe5MtS3waXVyOSNZ7GIWALM8 B+++XLu/MiXh8eoRa+xCczpfPLRtfclfNcVGwwZ6yWPMbfL6KvN2XP1foQfzlXEZuJ iqBU0ylYO9AMQ== Subject: Re: [Nouveau] [PATCH v3 6/8] mm: Selftests for exclusive device memory X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "daniel@ffwll.ch" , "linux-doc@vger.kernel.org" , "nouveau@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "hch@infradead.org" , "linux-mm@kvack.org" , "bskeggs@redhat.com" , Jason Gunthorpe , "akpm@linux-foundation.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" On Tuesday, 2 March 2021 10:14:56 AM AEDT Ralph Campbell wrote: > > From: Alistair Popple > > Sent: Thursday, February 25, 2021 11:19 PM > > To: linux-mm@kvack.org; nouveau@lists.freedesktop.org; > > bskeggs@redhat.com; akpm@linux-foundation.org > > Cc: linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org; dri- > > devel@lists.freedesktop.org; John Hubbard ; Ralph > > Campbell ; jglisse@redhat.com; Jason Gunthorpe > > ; hch@infradead.org; daniel@ffwll.ch; Alistair Popple > > > > Subject: [PATCH v3 6/8] mm: Selftests for exclusive device memory > > > > Adds some selftests for exclusive device memory. > > > > Signed-off-by: Alistair Popple > > One minor nit below, but you can add Thanks Ralph. Will fix that. > Tested-by: Ralph Campbell > Reviewed-by: Ralph Campbell > > > +static int dmirror_exclusive(struct dmirror *dmirror, > > + struct hmm_dmirror_cmd *cmd) > > +{ > > + unsigned long start, end, addr; > > + unsigned long size = cmd->npages << PAGE_SHIFT; > > + struct mm_struct *mm = dmirror->notifier.mm; > > + struct page *pages[64]; > > + struct dmirror_bounce bounce; > > + unsigned long next; > > + int ret; > > + > > + start = cmd->addr; > > + end = start + size; > > + if (end < start) > > + return -EINVAL; > > + > > + /* Since the mm is for the mirrored process, get a reference first. */ > > + if (!mmget_not_zero(mm)) > > + return -EINVAL; > > + > > + mmap_read_lock(mm); > > + for (addr = start; addr < end; addr = next) { > > + int i, mapped; > > + > > + if (end < addr + (64 << PAGE_SHIFT)) > > + next = end; > > + else > > + next = addr + (64 << PAGE_SHIFT); > > I suggest using ARRAY_SIZE(pages) instead of '64' to make the meaning clear. > > _______________________________________________ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 DF7A9C433E0 for ; Tue, 2 Mar 2021 09:12:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6C63064E51 for ; Tue, 2 Mar 2021 09:12:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C63064E51 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 972A689B83; Tue, 2 Mar 2021 09:12:31 +0000 (UTC) Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 066EF89B78; Tue, 2 Mar 2021 09:12:29 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Tue, 02 Mar 2021 01:12:29 -0800 Received: from nvdebian.localnet (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 2 Mar 2021 09:12:26 +0000 From: Alistair Popple To: Ralph Campbell Subject: Re: [PATCH v3 6/8] mm: Selftests for exclusive device memory Date: Tue, 2 Mar 2021 20:12:24 +1100 Message-ID: <4866160.ulnvbvOQiP@nvdebian> In-Reply-To: References: <20210226071832.31547-1-apopple@nvidia.com> <20210226071832.31547-7-apopple@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1614676349; bh=FeQHtfi4mCSWbQH0/aD7Oy3q/R8JrFmF5liDHR+wnLk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Originating-IP:X-ClientProxiedBy; b=HEiZZh4DK3KNf5gTFX02zJnM2b4ou/jDcSzCQDNZpPUD1j+uXhbse5auYqfmiU7Ec YXvVqk1kNu+9JT6l7F02Id1OMF+U0wEmNbvQu+/A3fXdEze7YxM7ab4F6YYYKwV/Fg Dm4znbewQozpm7A3c+OLIY1ia2ne7u3sRgRh+vejOiSB6QgLd6BMQm44HQa9cMzZFo k5ZNYwLJtxHXK1Cy2RXvbbUDWH1IntCrq79+XEho9Uqe5MtS3waXVyOSNZ7GIWALM8 B+++XLu/MiXh8eoRa+xCczpfPLRtfclfNcVGwwZ6yWPMbfL6KvN2XP1foQfzlXEZuJ iqBU0ylYO9AMQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-doc@vger.kernel.org" , "nouveau@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "hch@infradead.org" , "linux-mm@kvack.org" , "jglisse@redhat.com" , "bskeggs@redhat.com" , Jason Gunthorpe , John Hubbard , "akpm@linux-foundation.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tuesday, 2 March 2021 10:14:56 AM AEDT Ralph Campbell wrote: > > From: Alistair Popple > > Sent: Thursday, February 25, 2021 11:19 PM > > To: linux-mm@kvack.org; nouveau@lists.freedesktop.org; > > bskeggs@redhat.com; akpm@linux-foundation.org > > Cc: linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org; dri- > > devel@lists.freedesktop.org; John Hubbard ; Ralph > > Campbell ; jglisse@redhat.com; Jason Gunthorpe > > ; hch@infradead.org; daniel@ffwll.ch; Alistair Popple > > > > Subject: [PATCH v3 6/8] mm: Selftests for exclusive device memory > > > > Adds some selftests for exclusive device memory. > > > > Signed-off-by: Alistair Popple > > One minor nit below, but you can add Thanks Ralph. Will fix that. > Tested-by: Ralph Campbell > Reviewed-by: Ralph Campbell > > > +static int dmirror_exclusive(struct dmirror *dmirror, > > + struct hmm_dmirror_cmd *cmd) > > +{ > > + unsigned long start, end, addr; > > + unsigned long size = cmd->npages << PAGE_SHIFT; > > + struct mm_struct *mm = dmirror->notifier.mm; > > + struct page *pages[64]; > > + struct dmirror_bounce bounce; > > + unsigned long next; > > + int ret; > > + > > + start = cmd->addr; > > + end = start + size; > > + if (end < start) > > + return -EINVAL; > > + > > + /* Since the mm is for the mirrored process, get a reference first. */ > > + if (!mmget_not_zero(mm)) > > + return -EINVAL; > > + > > + mmap_read_lock(mm); > > + for (addr = start; addr < end; addr = next) { > > + int i, mapped; > > + > > + if (end < addr + (64 << PAGE_SHIFT)) > > + next = end; > > + else > > + next = addr + (64 << PAGE_SHIFT); > > I suggest using ARRAY_SIZE(pages) instead of '64' to make the meaning clear. > > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel