Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1400120pxp; Thu, 10 Mar 2022 04:58:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzSNrPc8Yt5p0t/+t2ssnxDnLn4kOibL2+MmMf+IgTByXpH4ZRL558UhQCDRUw2CA8C6GVq X-Received: by 2002:a05:6a00:14c8:b0:4f7:69c4:ccd2 with SMTP id w8-20020a056a0014c800b004f769c4ccd2mr4580184pfu.36.1646917101703; Thu, 10 Mar 2022 04:58:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1646917101; cv=pass; d=google.com; s=arc-20160816; b=gsMV3S6uCD2jZpzbrP2VB9DAZLE+ZUorvngexl48CT5rhXgyQmNHKw5mC0yRAMK05g cfhq/cD9OykOFqjbIis/vNNpwLg5494clf0R99AuQF96XRpU44kLmS9m6saWkF2bq26P fMV1XnbGRLe4yGe1vsB5aBNLHDx4aQgkPZg1H5wsuBR4NzV9zfV1fqhadBiULEnD5G/t S/b29ZXqhG9YnasmqYb2kbBf1tESn3ffQ0VxnTRwfc7qgFJt3hPPFKO0tnqF/LBco+SH 7JLf6DO47jlzvo1dnTHpfECXGLUhDixgm+e6Epxhgs6uDhG9pQ41fkxiv5l0ABIx4PrY c3/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:in-reply-to:user-agent :references:date:subject:cc:to:from:dkim-signature; bh=LyfZAyVxNys47go1nLxf43REYE/MKyfCPnkdvYKqWDg=; b=o1FjxNyUIdJZOp4lkvFd29SV9L0PcoHqes0R9hhMTVuAo4OkL1ma4LnaKfOD42DBQ0 XAgte8gs1w/kZnR5yYt5VxDbssi/Jtpi5CuGW7fN9wMRla5cP+0y+Mpp5P0TEdkCfd53 kwtRM6uNDfkO4Wl2dCBed152ixqNaixxiBnVAB7JmD0vxfijfRfZo6vzonsYJX1Bw3Dy hbfW2mAaivyoIlZF3v6BytwMGlA2JSzuKhMApW65Jsds2t2u9lAse/3k80yDpUX+uBXH qqAMHFVVvEXaZKi3ESze+6Q4HXpJEGikaTHUkh+kI+y/nVqdYyKPQUE7VBcbPZEu6o3z kZEQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=M4qvLexc; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020a056a00170100b004cc95270639si5153929pfc.80.2022.03.10.04.58.06; Thu, 10 Mar 2022 04:58:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=M4qvLexc; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241811AbiCJMBC (ORCPT + 99 others); Thu, 10 Mar 2022 07:01:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230387AbiCJMBB (ORCPT ); Thu, 10 Mar 2022 07:01:01 -0500 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2049.outbound.protection.outlook.com [40.107.102.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE7DD42481 for ; Thu, 10 Mar 2022 03:59:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rt9iaCREdZqd8J8tzzBx58yA87vYI5+UTLuxS7iryF/6ikble2HMnQymNH5zCFYs/si9JWDEyq1CcCKLCceAn04w47o21MNzNJmdy8fsISF7SIhF9huITSahvIrU8InNn+lCVDcuEv5lNlYXjs9i/6Zwb3skAKUDW8lVj8AcLgvql2OALg/t07U7rk1prhgiHNEYM05pi0kRnyggMzU2CD9r9P7hBk+rTJO3Kgj64ejh35OwPIwmxpA9qOYk1zDDpTP90vuyp8cozLNQ3g/QWXbNUviSvJNDmC/AngVPFWWN7+vEs7Kev0uj0qDDABHWfjSLdnDtWa/tPQGDhpzBeA== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LyfZAyVxNys47go1nLxf43REYE/MKyfCPnkdvYKqWDg=; b=UFh5a42yQXEnhsUGwlXwmpS+EglNu2O1iZOfNA2z7Lua4G8SLkyp1J1kj11IndMW3RAhkVHpIYGgkRk7NzEMAxuFV7UuG3LUjQXSgrUO5nEdZ5jC1J5pKiAX7Qbe05vlhoWvziC3kIQ/+4LmqZbZkZlls5Pc+/uxUvnm7rCIeFXh7Xt45Yt7hpDnF4OxkcsFrflBT2oQ8CAyfyfgDPFylu8Dr6z1XQZ+/K3Gm/X/PfWWdZC6YkQfo8uekFJOt7EslRXduxC7at6xjVll4ClLvvonMDr4JyjqocX6tzlX0e/fI0H2mr/8jaCLgH+klFvnWOsk3sIKwhGbmIr75Q/fMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LyfZAyVxNys47go1nLxf43REYE/MKyfCPnkdvYKqWDg=; b=M4qvLexcS0PcT6Yao+8a2VgBwjYRYl9tXWkzdegebEmB3BVJHYPcN7KmotXJLqYmO51iO5jesfSaSQYXxRm5ia0oGQLA2wFeDT1bOtaKdW+Uo0yG38LDTwThLTuwTco7OPm/FHPWJOo3EAEbSKG1ZtRhYwHywmxgRAouIGPtHRm8hJUNuMZJpLZBJYJ/qDxwf4Iqh965URfeaU5ZjjuUdyyB90Jv7WkPE+1w+r1GtpPr399AjhAICJ0J7j+9pLgIrvrPWdmCsi62JZlxArrazyFrAh5Dz888criGrv/xYCOpHz+ex+AdX0+t7PGjvClqvvArpk+D/6VOY+wx6FSbig== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) by CH0PR12MB5188.namprd12.prod.outlook.com (2603:10b6:610:bb::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.15; Thu, 10 Mar 2022 11:59:56 +0000 Received: from BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::152f:613b:7041:68d6]) by BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::152f:613b:7041:68d6%7]) with mapi id 15.20.5061.022; Thu, 10 Mar 2022 11:59:56 +0000 From: Alistair Popple To: Mika =?utf-8?Q?Penttil=C3=A4?= Cc: John Hubbard , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org, =?utf-8?B?SsOpcsO0bWU=?= Glisse , Ralph Campbell , Jason Gunthorpe Subject: Re: [PATCH] HMM selftests changes Date: Thu, 10 Mar 2022 22:52:41 +1100 References: <20220308015705.8424-1-mpenttil@redhat.com> <7fc9cae2-04b3-153c-f826-e565a1beeb2d@suse.cz> <4c6bc437-32ba-7bfd-05e6-b555a1a13776@nvidia.com> User-agent: mu4e 1.6.9; emacs 27.1 In-reply-to: Message-ID: <87r17aow5i.fsf@nvdebian.thelocal> Content-Type: multipart/mixed; boundary="=-=-=" X-ClientProxiedBy: BYAPR07CA0093.namprd07.prod.outlook.com (2603:10b6:a03:12b::34) To BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f7f023b0-9fc5-4c01-afda-08da028d7ec2 X-MS-TrafficTypeDiagnostic: CH0PR12MB5188:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X2+RTKvGWFsvAp6fjPeKXZzORBYeNSr4dDD0BpRKZJD2kutvibm06UxjWgYRyEDVFnBnWbkepEwvfoQ9Iru8SOpgJQqTqfC1xZB3kkiLIU7P4bc78hh+vGi5Jx7yZ+d6kV957gAnT5ps8v6dVTjIxhEMx7CLFYNhDptCkbscj5sKvQpdHmxftaZ6CRkTOSxIyt3+Ov19Li0sso0t0zQygCWkRds8ka5h/T6sWk0jbRzATpdlevmO7RC2yYttUxKN3gDkfdAwzgwTsLLlSYDVhdE2NkycvjYvyRIn1vtVBpjjkobAWdDkv2aghjLAofrSqDcxoOX0ZdZoDEFXxTDAiOdIeCsXASBz0GPVadPxlrqx3vapHxf8emh8I4JyjBFUFrKbzp8aQYQTN6nCBySpQ+3AmVApdUNIvCUTFJHn0sJk6tCQ7zLB3NZwbNxW53Ho6JaswZj9L2AzqaFEaFM/7+4DLDatS3nNBy6vDNMzZ2S7a51p19Ww6T5ktfIWLjbGSq9GwiJEJN36v0kacHvq9XS7pwvGdXN7Rj3kWkHaFnBoDmOQRuVdUb0Yb1BPyt3+EmiHG3aWTsS93JzBeqY7eoAuE0KxXAPNhDjq9JhpfCirmtaD5RE2n3zr+kf4babH9udwABf3/ErUmuXX6urQnA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3176.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66946007)(6506007)(6916009)(186003)(54906003)(66556008)(6486002)(6512007)(316002)(9686003)(33964004)(44144004)(53546011)(8936002)(26005)(6666004)(38100700002)(83380400001)(86362001)(8676002)(4326008)(5660300002)(2906002)(508600001)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RUlLUmN4UW5kQ3I0RHgyQ2xJMUxDaVR5ME5XSVhtd1VUQ2JNRzRONDlEcGdT?= =?utf-8?B?c3ZTc1hmaDk0TWlqaTlLcHB1dlYrYzA3b3JTSmpoOWZNSVZhNGRCaXlYSVhB?= =?utf-8?B?cDF0Z1JDbC9Mc2F1djFWOVpTc2FzU3JWSFhtWkZSRnNKY21yUDhmWitTQm5p?= =?utf-8?B?MWxSQ1ZEQzJRT3pXS01WbEpWRE1ZUSt3QWJWNSs1QWN4QkhhUXN2TGFlWDcy?= =?utf-8?B?VXNmZ1djRlJ3SFRUbXhrM2MzSk80M1gzSnJoL1BBeUU2UkxxanZNSktGUDhQ?= =?utf-8?B?OEx6Y0FkZGUxK0d5c2NMbVA3TnVTZWZqLytXYXNjNHYzbjNUdzY3UHlzemdW?= =?utf-8?B?N2tMcmM0V2kzWFdGWnlmbndNMENiQVNlLy9vdDlrOE5OR1IySEVHbTVPNEdX?= =?utf-8?B?bWhMQzZDaldkSHZ2VzVkbDM1K3FYVU5EdVlDRGlIUmVQbnFSVkJ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01-afda-08da028d7ec2 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3176.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 11:59:56.8241 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ekFZOuf0/gSOeA5+7AdozAQA/bmgY6KJnNHIQm8zm0HTiqLB5NClw/zTjV+zxzltREMuJfVei7o/bgdfX+byVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5188 X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Mika Penttil=C3=A4 writes: > On 10.3.2022 5.44, John Hubbard wrote: >> On 3/8/22 5:10 AM, Vlastimil Babka wrote: >>> +CC relevant folks >>> >>> On 3/8/22 02:57, mpenttil@redhat.com wrote: >>>> From: Mika Penttil=C3=A4 >> Hi Mika, >> This looks like a very nice cleanup and simplification, delighted to see >> it! Agreed, thanks for doing this. > Thanks! > >> In fact, I like it so much that I've got a bunch of fussy nitpicks I'm >> hoping you'll consider applying, below. :) >> Also, I'm assuming you've tested it a little bit? (My test rig is boxed >> up for another day or two, don't ask...haha.) >> > > Yes it passed the tests with the changes. Feel free to add: Tested-by: Alistair Popple It does currently conflict with linux-next due to the changes for device coherent memory. So if that series ends up going in first this will need a little bit of rework. It should be fairly straight forward though - the mai= n difference is that series introduces two new extra minor nodes. - Alistair > > >>>> >>>> HMM selftests use a in-kernel pseudo device to emulate device private = memory. >>>> >>>> For now, the pseudo device registers a major device range for two pseu= do device instances. >>>> User space has a script that goes figures out from /proc/devices the a= ssigned major >>>> and mknods the device nodes. >>>> >>>> Change this use to a more standard device framework, like misc device, >>>> which makes the device node names to appear right under any decent use= r space. >>>> This also makes it possible for udev- like processing if wanted, >>>> and the /proc/devices parsing is not needed any more. >> How about this for the subject line and body? I've made the subject line >> match what other commits look like in this area, and I've clarified the >> wording in the body: >> >> mm/hmm/test: simplify hmm test code: use miscdevice instead of char dev >> HMM selftests use an in-kernel pseudo device to emulate device private >> memory. The pseudo device registers a major device range for two pseudo >> device instances. User space has a script that reads /proc/devices in >> order to find the assigned major number, and sends that to mknod(1), >> once for each node. >> This duplicates a fair amount of boilerplate that misc device can do >> instead. >> Change this to use misc device, which makes the device node names appear >> for us. This also enables udev-like processing if desired. >> Delete the /proc/devices parsing from the user-space test script, now >> that it is unnecessary. >> >>>> >>>> Signed-off-by: Mika Penttil=C3=A4 >>>> --- >>>> lib/test_hmm.c | 46 +++++++++++++++---------= -- >>>> tools/testing/selftests/vm/test_hmm.sh | 6 ---- >>>> 2 files changed, 26 insertions(+), 26 deletions(-) >>>> >>>> diff --git a/lib/test_hmm.c b/lib/test_hmm.c >>>> index 767538089a62..76f6129e1f1f 100644 >>>> --- a/lib/test_hmm.c >>>> +++ b/lib/test_hmm.c >>>> @@ -10,7 +10,6 @@ >>>> #include >>>> #include >>>> #include >>>> -#include >>>> #include >>>> #include >>>> #include >>>> @@ -25,18 +24,25 @@ >>>> #include >>>> #include >>>> #include >>>> +#include >>>> #include >>>> #include "test_hmm_uapi.h" >>>> -#define DMIRROR_NDEVICES 2 >>>> #define DMIRROR_RANGE_FAULT_TIMEOUT 1000 >>>> #define DEVMEM_CHUNK_SIZE (256 * 1024 * 1024U) >>>> #define DEVMEM_CHUNKS_RESERVE 16 >>>> + >> Extra newline, please delete. >> > > yep > > >>>> +static const char *dmirror_device_names[] =3D { >>>> + "hmm_dmirror0", >>>> + "hmm_dmirror1" >>>> +}; >>>> + >>>> +#define DMIRROR_NDEVICES ARRAY_SIZE(dmirror_device_names) >>>> + >>>> static const struct dev_pagemap_ops dmirror_devmem_ops; >>>> static const struct mmu_interval_notifier_ops dmirror_min_ops; >>>> -static dev_t dmirror_dev; >>>> struct dmirror_device; >>>> @@ -82,7 +88,7 @@ struct dmirror_chunk { >>>> * Per device data. >>>> */ >>>> struct dmirror_device { >>>> - struct cdev cdevice; >>>> + struct miscdevice miscdevice; >>>> struct hmm_devmem *devmem; >>>> unsigned int devmem_capacity; >>>> @@ -118,16 +124,20 @@ static void dmirror_bounce_fini(struct dmirror_b= ounce *bounce) >>>> static int dmirror_fops_open(struct inode *inode, struct file *fil= p) >>>> { >>>> - struct cdev *cdev =3D inode->i_cdev; >>>> + >>>> + struct dmirror_device *dd =3D container_of(filp->private_data, >>>> + struct dmirror_device, = miscdevice >>>> + ); >> Let's delete that whole chunk, because the variable is unnecessary, and >> is adding to the line count and mental load for no reason. > > > Agreed. > > >> Look how much cleaner this it gets after applying this incremental diff >> on top of your patch: >> diff --git a/lib/test_hmm.c b/lib/test_hmm.c >> index 76f6129e1f1f..3ec8ca8059cd 100644 >> --- a/lib/test_hmm.c >> +++ b/lib/test_hmm.c >> @@ -125,19 +125,16 @@ static void dmirror_bounce_fini(struct dmirror_bou= nce *bounce) >> static int dmirror_fops_open(struct inode *inode, struct file *filp) >> { >> - struct dmirror_device *dd =3D container_of(filp->private_data, >> - struct dmirror_device, mi= scdevice >> - ); >> struct dmirror *dmirror; >> int ret; >> - >> /* Mirror this process address space */ >> dmirror =3D kzalloc(sizeof(*dmirror), GFP_KERNEL); >> if (dmirror =3D=3D NULL) >> return -ENOMEM; >> - dmirror->mdevice =3D dd; >> + dmirror->mdevice =3D container_of(filp->private_data,struct dmirror_de= vice, >> + miscdevice); >> mutex_init(&dmirror->mutex); >> xa_init(&dmirror->pt); >> >>>> struct dmirror *dmirror; >>>> int ret; >>>> + >>>> /* Mirror this process address space */ >>>> dmirror =3D kzalloc(sizeof(*dmirror), GFP_KERNEL); >>>> if (dmirror `=3D NULL) >>>> return -ENOMEM; >>>> - dmirror->mdevice =3D container_of(cdev, struct dmirror_device, cde= vice); >>>> + dmirror->mdevice =3D dd; >>>> mutex_init(&dmirror->mutex); >>>> xa_init(&dmirror->pt); >>>> @@ -1216,16 +1226,18 @@ static const struct dev_pagemap_ops >>>> dmirror_devmem_ops =3D { >>>> static int dmirror_device_init(struct dmirror_device *mdevice, int= id) >>>> { >>>> - dev_t dev; >>>> + >>>> int ret; >>>> - dev =3D MKDEV(MAJOR(dmirror_dev), id); >>>> mutex_init(&mdevice->devmem_lock); >>>> spin_lock_init(&mdevice->lock); >>>> - cdev_init(&mdevice->cdevice, &dmirror_fops); >>>> - mdevice->cdevice.owner =3D THIS_MODULE; >>>> - ret =3D cdev_add(&mdevice->cdevice, dev, 1); >>>> + mdevice->miscdevice.minor =3D MISC_DYNAMIC_MINOR; >>>> + mdevice->miscdevice.name =3D dmirror_device_names[id]; >>>> + mdevice->miscdevice.fops =3D &dmirror_fops; >>>> + >>>> + ret =3D misc_register(&mdevice->miscdevice); >>>> + >>>> if (ret) >>>> return ret; >>>> @@ -1252,7 +1264,7 @@ static void dmirror_device_remove(struct >>>> dmirror_device *mdevice) >>>> kfree(mdevice->devmem_chunks); >>>> } >>>> - cdev_del(&mdevice->cdevice); >>>> + misc_deregister(&mdevice->miscdevice); >>>> } >>>> static int __init hmm_dmirror_init(void) >>>> @@ -1260,11 +1272,6 @@ static int __init hmm_dmirror_init(void) >>>> int ret; >>>> int id; >>>> - ret =3D alloc_chrdev_region(&dmirror_dev, 0, DMIRROR_NDEVICES, >>>> - "HMM_DMIRROR"); >>>> - if (ret) >>>> - goto err_unreg; >>>> - >>>> for (id =3D 0; id < DMIRROR_NDEVICES; id++) { >>>> ret =3D dmirror_device_init(dmirror_devices + id, id); >>>> if (ret) >>>> @@ -1277,8 +1284,7 @@ static int __init hmm_dmirror_init(void) >>>> err_chrdev: >>>> while (--id >' 0) >>>> dmirror_device_remove(dmirror_devices + id); >>>> - unregister_chrdev_region(dmirror_dev, DMIRROR_NDEVICES); >>>> -err_unreg: >>>> + >>>> return ret; >>>> } >>>> @@ -1288,7 +1294,7 @@ static void __exit hmm_dmirror_exit(void) >>>> for (id =3D 0; id < DMIRROR_NDEVICES; id++) >>>> dmirror_device_remove(dmirror_devices + id); >>>> - unregister_chrdev_region(dmirror_dev, DMIRROR_NDEVICES); >>>> + >> Another extra newline, please delete it. > > yes > >> >>>> } >>>> module_init(hmm_dmirror_init); >>>> diff --git a/tools/testing/selftests/vm/test_hmm.sh b/tools/testing/se= lftests/vm/test_hmm.sh >>>> index 0647b525a625..69f5889f8575 100755 >>>> --- a/tools/testing/selftests/vm/test_hmm.sh >>>> +++ b/tools/testing/selftests/vm/test_hmm.sh >>>> @@ -41,17 +41,11 @@ check_test_requirements() >>>> load_driver() >>>> { >>>> modprobe $DRIVER > /dev/null 2>&1 >>>> - if [ $? =3D=3D 0 ]; then >>>> - major=3D$(awk "\$2=3D=3D\"HMM_DMIRROR\" {print \$1}" /proc/devices) >>>> - mknod /dev/hmm_dmirror0 c $major 0 >>>> - mknod /dev/hmm_dmirror1 c $major 1 >>>> - fi >>>> } >>>> unload_driver() >>>> { >>>> modprobe -r $DRIVER > /dev/null 2>&1 >>>> - rm -f /dev/hmm_dmirror? >> Nice! >> >>>> } >>>> run_smoke() >>> >> thanks, > > > > Ok will make the changes and repost, > > thanks! > > --Mika --=-=-=--