Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6044741rwn; Mon, 12 Sep 2022 20:01:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR4zjaoVIxUbCLLIJetoYD5Y/HKo7g23pCECB6rgZhaIp0bmv7jvK5U8is4DkqYlgbUs4qTM X-Received: by 2002:a05:6402:1943:b0:443:5ffb:b04e with SMTP id f3-20020a056402194300b004435ffbb04emr24236702edz.230.1663038087079; Mon, 12 Sep 2022 20:01:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663038087; cv=pass; d=google.com; s=arc-20160816; b=TdX0ysllI+RAbvDGRfJ/jnDIYCRChCT11+bf9Y8uYIGZvALxFQanZYKs5ii8TQHY3C A/issjyjmXcK2rHLDHXFitZ9K7Eyp4D5YeQGoM2uo9NlIg/+jpT35KrTJB70URa+sC6D Y1iKvFQeJTDFnxcSW97QViHToiMmosQlqXat1Re+tS6CmmZwCa81XtI+En11NVg5Osln sgUuLTI9a1Z2MI6opzokHp2GYd3z0S4hiBzQzTnDIcTfnnXSVtE9rHkqbQCxHw+MUidu iHE/h+YlbZvd/DGSN6OAw87T6RcR/Y5hNX3PvhQJbry5fSWESuAxcmdWpketDsvjTgVm IDBw== 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:date:subject :cc:to:from:user-agent:references:dkim-signature; bh=omC3X8HEN0/85hiLEF8vpnKf8kJzMNRLkGhZuYwV5/Q=; b=PuIvfMDy+7dFBYQAOCI8TK9t3so/6Fcj3o8T9pEcSxLP8bKdx/Af8yfNQsTEMQf1Ze 6KiX1VcE7ZYveLnq9uyFmaJ+zfahgZfH3lwzYad30AUyylIIYtWMroFOknt3IcFM+ZWn AgkhgPRORMMlBJ5NNA9Ucz22ECBj+RnsgUye66gJQV3hTv3BAihXmz8Cc9N2CePS+Mlf 0DpNtudwaUECcqpa28/spu6Xwoupnl7M2Cb4k+EW1Y5SgALlErdrivSI87450CJxwmQb QZZt0Ee04aRGAnOv05SS0trwQWlpCMLdpeWwxU5a4+MIkIMzeEIkt4FZrKgkPlB9xjhy 4BuQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=elhpZwE3; 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 oz18-20020a1709077d9200b0077f01df0b03si2600174ejc.881.2022.09.12.20.01.01; Mon, 12 Sep 2022 20:01:27 -0700 (PDT) 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=elhpZwE3; 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 S230026AbiIMCmM (ORCPT + 99 others); Mon, 12 Sep 2022 22:42:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbiIMClt (ORCPT ); Mon, 12 Sep 2022 22:41:49 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2054.outbound.protection.outlook.com [40.107.101.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8819952FCF for ; Mon, 12 Sep 2022 19:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TsDTEcjnzblio2Im3niYfwNYdNWFO22/rnylF3UwAdw3Ail5LTB4poZBN1mE9V/LK+cc5+fkhBnqgL1lQYv+yo0rK1PLMiTnkUtSv+fsZojb5lbXv/Ndphl7DpD91F51Vi5VfjyfN6cZpcmfkHz72fT5u6/TIc027TRddnJP6fo5qKZbbeFiN1qcCNz4vkZwgoXZeznqpwKwyvzt3/u0vnUo7gz7kUpj1cWYehlOjxWbipGwJLAKl0RXxY9LGLIqsW7TAqKb1jQPoaJg7+vgVn/5Z/e8XPkAqwynZIfi9xhQC7opPpzTVDwtzFBOd00AEY3RIqwdvQ0nowKjkFBmWA== 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=omC3X8HEN0/85hiLEF8vpnKf8kJzMNRLkGhZuYwV5/Q=; b=SINj4nvvOEY6teKBcadJNhKc4Z+3q21V0DRYkFO8E1F/q1lP7yDzt3f9CmP85dRR8SmoIYI9TPcdbG3RO4OvNSTIvN3rPVsyDGShbSOqwLyQadE7lJ3mmgibshOGHRIJSNtqqiifwUczJmyIPM7nW1bv+6PIMOBWudUKkgL6ARhi66OWQq1Rh9GYeCUkFDbaU/tq6mV/oowQh27AAafx3oYugL7qN0WA/cecLF7VGnemBdjukFs0KP5w8LWSPL41VBaLCZUFl6MNIR0Uu0uLW1AnFZSLLRAzmnd9Tw2vaMeIibJZ+WX7Wtc2UoDnvG6XyJ3g2lYMU4vk059a4b66lw== 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=omC3X8HEN0/85hiLEF8vpnKf8kJzMNRLkGhZuYwV5/Q=; b=elhpZwE3E57GnAGsVYhU3wa566794MfSNSgsJI90rReyTB041J/A/LAaL0knQYX2vMqgR3hNprd4F/UMUaSRmz4mmh1RMOQdwv1ButJPKslSEYb75yIPD5Lm21yKjhZrnp1qr5ycbN8FHb9kak8iilLVzg50Qn2NjQpFoLosaC+iKHAyed1WBMEp5mvzRPkR5kwRbqMksJNfg6KeF8dHXCSI8HWMQpPdSAYcVb2X3YlaTfaxE0vzVBCYXMuWPj7nL0eB3FH5Xz6qdmEMlqYzlpoCbi9LJAuQ7jnqOpgsNvHrMlqREEYpPTcc/RZcqRvJjEggPiUreAoKzUzP159CEw== 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 CH0PR12MB5387.namprd12.prod.outlook.com (2603:10b6:610:d6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.19; Tue, 13 Sep 2022 02:41:41 +0000 Received: from BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::243c:a9ba:2442:8974]) by BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::243c:a9ba:2442:8974%6]) with mapi id 15.20.5612.022; Tue, 13 Sep 2022 02:41:41 +0000 References: <9f801e9d8d830408f2ca27821f606e09aa856899.1662078528.git-series.apopple@nvidia.com> <68cf1d70f3fb8ce4e3c1a4899c19df4f6c382a13.1662078528.git-series.apopple@nvidia.com> <87mtbb5soy.fsf@nvdebian.thelocal> <90a0441e-47ad-007f-06c1-b30e5f7bb692@nvidia.com> User-agent: mu4e 1.6.9; emacs 27.1 From: Alistair Popple To: John Hubbard Cc: linux-mm@kvack.org, akpm@linux-foundation.org, Peter Xu , Nadav Amit , huang ying , LKML , "Sierra Guiza, Alejandro (Alex)" , Felix Kuehling , Jason Gunthorpe , David Hildenbrand , Ralph Campbell , Matthew Wilcox , Karol Herbst , Lyude Paul , Ben Skeggs , Logan Gunthorpe , paulus@ozlabs.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v4 4/4] selftests/hmm-tests: Add test for dirty bits Date: Tue, 13 Sep 2022 12:33:40 +1000 In-reply-to: <90a0441e-47ad-007f-06c1-b30e5f7bb692@nvidia.com> Message-ID: <87czc0m1wd.fsf@nvdebian.thelocal> Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0365.namprd03.prod.outlook.com (2603:10b6:a03:3a1::10) To BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB3176:EE_|CH0PR12MB5387:EE_ X-MS-Office365-Filtering-Correlation-Id: cb83a520-b19d-48fe-2db5-08da95317d18 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BANjnYoEB68rwRPwWEp68uKdZ8LkPf7pWy90KmlxxfQffcOOtA5uoZuLiQeRw+D/MDN3ADiSC5Uqh/fH5jUUTkE5ZRyt9bRAbRROPQeaUb8WTYBWoY/pJb6UnAix+FmNh5iM2l+wYR84hlta0DOSbx2/ohzgu5JWAZsXlOiJEgDZrxLYWzTntMUaMtkuDW8oBomnM5zgqt3rK2OhkM6zTIS9SZtNgLbzqZghDW5AHC/1xxQbSUAluqZ9a1myyi/Qs1KsOYio+D+DzPok0tEjCIT9gtokTCg6srD2ba9cDmBEUdNSz0924k5yzLXEYSr4P1VsmFQPo+dEI9tdkzpJ3MyuG+3WYPv7fvcUnTfhxt+14Kzsq3n5LP0bR9kLKbozqD79GOYnozO6fUEtg42Y0aLQalc9YDXHUrRi7IcSthMpi3MzTWQ02yZYdhUtUP6j5lYd76WGhWXg34ycbw4tBFfenWnyNeSs6tYX0zTQffWFJixTgb4b2NJ3Kx6vY9UJ7Y0M1XrJcfkG9/U7rXNsjZ3Y58Cg+G0r15hF28JfI0m6nepOjtHOYL5GYxxRgfc46zSyfWebQDa80NXbarhtNZM/7NhcKZICLc3EniKTCCgOTxHYRhmkESb4WzzPNka30yeZItgkMDvHT8WOiE/JlNL0jD41bfJxW+84nw1ybw1lr6+5PAfEGXq7UKiFGow/IwvuUiTQmjbFzo+Hwdsb+8qg7rHUojYFS9Co/5xmxIeSq/QLEYFOD01KSbp6LcQYwX65ZztpPRIgGb0kQORBGg== 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:(13230022)(4636009)(376002)(346002)(39860400002)(366004)(136003)(396003)(451199015)(8676002)(66476007)(2906002)(9686003)(86362001)(41300700001)(316002)(53546011)(6862004)(6486002)(186003)(6636002)(6506007)(6512007)(26005)(66946007)(5660300002)(54906003)(83380400001)(8936002)(478600001)(7416002)(4326008)(66556008)(38100700002)(14143004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?KaCH68r1cOfK6xkHEEUmKitGj0h5DWYR3Ure1vwz20giz4+xCugEV/DcRoZu?= =?us-ascii?Q?a9l2L97a/9YBaltC34p9/LMIoKKy5FndVHpRTAyzKT7i5uUHa193FNVZb0RU?= =?us-ascii?Q?OmYhMoqdK1EXjqXwz60sF4z1X6OQP4D343j6kyLbyvlhgIODB7w0tqiVJHg1?= =?us-ascii?Q?lcUN+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eMJy?= =?us-ascii?Q?OFR3g1cCoYEVL7zd08rRLiLIS/8dAmlgngVT0vQmhFwJpkeP4lRbf0mafTmf?= =?us-ascii?Q?2k4tOTLfFsVN0IiLybGQZUheP73T1C/kcj/5BTVbYwizktoXYa+aHKy72xxb?= =?us-ascii?Q?7AMg7qdzSxa2409jSXcApJqXt35Z44tBo+kMpwPhdKXNVH3WGHhwS7vFPsd0?= =?us-ascii?Q?ENIIejwtnchbdaVGLNEpLnByLZsOTQXgNaMhNcS1vK6C4cgEGC5hUXHJJkYM?= =?us-ascii?Q?kFkmgPiYFoQjPfaMYcvuuNzyzyscVYhpJ3qihqcWCpWinh1z9D/n1zAfWtAP?= =?us-ascii?Q?XDnbcRvTrqHWAHZFN4SKfrjihXcHyZ98OwRtz1xY6R2RCtlXup5fhfLY2if/?= =?us-ascii?Q?fxazVUZ+SVvo1h0sut9v++SEPNVoEmE8Fr5hvrIopPJYYObpVmlD22eo/Bbv?= =?us-ascii?Q?0viQydzOTjFCAdnqgKP3aJtBjhCKME1EQRgPWMCF2j3hXTqzfIvhjOD/wIo/?= =?us-ascii?Q?l+A+28gE5+fzZISAzZWcUf7XK3TjQ7BHEWit9+ND?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb83a520-b19d-48fe-2db5-08da95317d18 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3176.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2022 02:41:41.4612 (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: yKCoKgiYhGEnYEqOLpmZcT5nVh4BQ/vm+PtYfcPE8Al7Y3r6J91eg8NlXT9Jm8QRA6DkAqDE9HDdt2stL1Xizg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5387 X-Spam-Status: No, score=-1.1 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 John Hubbard writes: > On 9/7/22 04:13, Alistair Popple wrote: >>>> + /* >>>> + * Attempt to migrate memory to device, which should fail because >>>> + * hopefully some pages are backed by swap storage. >>>> + */ >>>> + ASSERT_TRUE(hmm_migrate_sys_to_dev(self->fd, buffer, npages)); >>> >>> Are you really sure that you want to assert on that? Because doing so >>> guarantees a test failure if and when we every upgrade the kernel to >>> be able to migrate swap-backed pages. And I seem to recall that this >>> current inability to migrate swap-backed pages is considered a flaw >>> to be fixed, right? >> Right, that's a good point. I was using failure (ASSERT_TRUE) here as a >> way of detecting that at least some pages are swap-backed, because if no >> pages end up being swap-backed the test is invalid. > > Yes. But "invalid" or "waived" is a much different test result than > "failed". True. Unfortunately our test framework needs some love as I don't think it's possible to return a result of "invalid" or "waived". We can skip a test though, so that might be the best option here. >> I'm not really sure what to do about it though. It's likely the fix for > > Remove the assert. If the test framework allows and you prefer, you > can print a warning. > >> swap-backed migration may make this bug impossible to hit anyway, >> because the obvious fix is to just drop the pages from the swapcache >> during migration which would force writeback during subsequent reclaim. >> So I'm inclined to leave this here even if it only serves to remind us >> about it when we do fix migration of swap-backed pages, because we will >> of course run hmm-tests before submitting that fix :-) We can then >> either fix the test or drop it if we think it's no longer possible to >> hit. > > Oh no no no, please. This is not how to do tests. If you want a TODO > list somewhere, there are other ways. But tests that require maintenance > when you change something are an anti-pattern. Fair enough, I think what you're asking for is a higher level test that doesn't rely on implementation side-effects. I wrote this test mostly to discover if we could hit problems with the current implementation hence why it's a bit messy. But I think I can fix this up without relying on implementation side-effects - really I just want to confirm that at least some pages got swapped to disk which I can do via looking at /proc/self/pagemap. - Alistair > thanks,