From patchwork Wed Feb 23 16:05:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12757166 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA85AC433F5 for ; Wed, 23 Feb 2022 16:06:03 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.277542.474081 (Exim 4.92) (envelope-from ) id 1nMu9E-0008E6-MZ; Wed, 23 Feb 2022 16:05:48 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 277542.474081; Wed, 23 Feb 2022 16:05:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nMu9E-0008Dz-JY; Wed, 23 Feb 2022 16:05:48 +0000 Received: by outflank-mailman (input) for mailman id 277542; Wed, 23 Feb 2022 16:05:47 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nMu9D-0008Dl-Qp for xen-devel@lists.xenproject.org; Wed, 23 Feb 2022 16:05:47 +0000 Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 76017dca-94c2-11ec-8eb8-a37418f5ba1a; Wed, 23 Feb 2022 17:05:46 +0100 (CET) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04lp2053.outbound.protection.outlook.com [104.47.13.53]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-34-aLZRpbzcPm-R-iu9EkuZDQ-1; Wed, 23 Feb 2022 17:05:45 +0100 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by DB3PR0402MB3803.eurprd04.prod.outlook.com (2603:10a6:8:e::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.19; Wed, 23 Feb 2022 16:05:43 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::d479:b728:345c:bd65]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::d479:b728:345c:bd65%6]) with mapi id 15.20.5017.022; Wed, 23 Feb 2022 16:05:43 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 76017dca-94c2-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1645632346; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9KYg7EGIpsPMfdCGhpfXXPnI+8C1a2jFdZUo/dNcjvI=; b=UdaPDpzPKhozyJIW2OBIUqw+4pt5NQLgJjXMjRDy1LORQyEU5IUOOToN+gW5fDi1Xfutxr 5jyAmfboeqYsVuZWuxaqIrBW5vhWjqQ/nZrHQ8j8BgK6oWCKEQVyD88Y+2Ff2dkzo1+eHf Wi8LWsbQSHN6evMm8LSUHs0M3cMC7lk= X-MC-Unique: aLZRpbzcPm-R-iu9EkuZDQ-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cNz5jjzW1OhytF9f2xN0YITudhK29hMyD0g4CBatFM3ux5Wi8JLbRl1fqODTN4w6wz+9th/9vjg2Ty0uP7+kWMont1ZOqABatZjJabcaNLE0z6ByDcSk/4G88zgIYepj3FGwnE4uEo8cxhld1jOM2PziC3QXq0LsiUOnIn3CuFSWRd0yrtxI1BRTJsNW6Oz6G/eDcKY48O+PGGDk2Rchp5dZDwxbgAdzWvwOkLSHC1nyY1Vl094rKaFEQWnR6f/8YazyyRVuGiP4TNxKzuEcuUu/rAOC/xQfukeobK6bM0WaehFRqbzYeIhGj9flLxXDp+OGhBu1WKl81B7/cok4hQ== 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=9KYg7EGIpsPMfdCGhpfXXPnI+8C1a2jFdZUo/dNcjvI=; b=Wj5z+y3xarQOXN9BLfIcEie3N6ZzT56TE2Ora/Et7o7aCalvGVRVkGNtPZe2FUPLDLvKLrfh/bspFzhTSET6bOwUIWtXfa94WuAwgwNORyjlQ0mDsyIDx0eIlr+dfl4kdhtufDvAxB+LURyLknRS1IeCK1R0n1JRA8IQf9P6v57o6XHkbDKAmMATiOzpyOIa4lFSu+Df62GVcHtstClAtHPprAtKp9XJu2b70cBG4+pV5x5olmjRooKiRkToa5kfR5xXvsSrbromP6EsiXWGEG5ZtYIl5GWAqaM8XGuvvZGe7sRfq6B/KW2JgYs5GEJAVii/Q/OlBqMKXhHO4OycNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: Date: Wed, 23 Feb 2022 17:05:41 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: [PATCH v2 12/14] paged_pages field is MEM_PAGING-only Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu References: In-Reply-To: X-ClientProxiedBy: AS9PR06CA0251.eurprd06.prod.outlook.com (2603:10a6:20b:45f::28) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 92ff817d-7971-4327-2449-08d9f6e65861 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3803: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: pVWyEOGGrTZ2tSpsOHz0mMAuDpkyRIXV2wOEaBPLi3EVORr69LZiGcP0WPOHzXSRYj+c6lT8hxgrmTlpd/hyFqU0SUsUnvaGdS3ND+35FdOwiCIdKRsJh7pjUM8SdGKvU7hWuPJdtB4/SyL0Y4pQ0aQSqDjHI478oToo0JAsH370/l0rfNRrZDeOcDBAWEkxbu1hkuI4ORONffl59YXzb3yQ6SP95C9dkzJzSqXcagMqm4kA3cXehcROB4QEpeFtz8lBVQk20ef8zlZOPbsWOggUJC4pZqkN31ocJWVvty/jaXIVdXEbWGg1HjnlsSSb6tXOZgCYt+afnULyezpRvvW9iw5tloTctRPCcPesonRMfrSlL+OHIDdKYBsNMJMGWp1HaJW9Pcn3KYqw2Oj2MyZ/FB0d37jjBjhhforBtLC9WM4deY1bCp6YTBbIMflAQ8y9/M7ACSXFyjot8JczX7VaYPIrfxHfJ84euXw54LbEVTpo8HbH8M3+WctwCG59lX5o8ZH5YoA4Q4iY77uniiqmOd6CCLKnFJJzACYUkTcITuNr+P2Fs/QRtTy/JV4zDvE6dYk5lpsHiIsU70ccQSIo3ecvZEvsdOrTv9kBt6ocEUv7BkrV2e7UVEDKuszLyRCe1fuKtbx5fEu+os7ivReFsHHHEsdsjoimlkoE6z8i0aBUwFbZR52XXkFSZ6E5Srxy4D8pSo11uakwTc1lhKRX1x+rJUIpIjx0cRJw3qdfDTpfUFQAIHSVlr9mlFSG X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6512007)(66476007)(8676002)(6916009)(6506007)(31686004)(86362001)(8936002)(31696002)(6486002)(316002)(66556008)(508600001)(66946007)(26005)(5660300002)(36756003)(4326008)(38100700002)(186003)(2906002)(54906003)(2616005)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?nMOfdXyfpyFZegzdGgb9/BkoUIuI?= =?utf-8?q?3OSpCwvhBgPJ0DVM4tapbW+uf+ol/Oy97yVvsb/2gg/d8wKoOO97embtgDUet4M+m?= =?utf-8?q?KUXwuYAtEKw4pv/2hptBu1RxtXOFwEJP3KgH5Nq0eyQHOD9NBUVqQMLbabo1ULPer?= =?utf-8?q?B+FJ5XtKNNsc9Rvi5xWeYhXMOzbPJcLvbjZBKy2NX/zZIzdikT9JRBtvnSdO36WgH?= =?utf-8?q?GyGDw02c4Ycj0nyfc/R5n9f1ovZ7NMdDr/xPqtnQ6o7m0DXvqD6omLSd1v7LPaWDK?= =?utf-8?q?OpVldyuF9Za7uT1szHmyuZrwKHbrDDHlJeDKbmh/yR32LsUeQOMQQW3XPn6KLC1Hn?= =?utf-8?q?1yhiRI/ticZxL79WnfAa7vu+n9Y2HdOzVrbiMBbK+SyekmMcsZFYxRa4chsbPfwY7?= =?utf-8?q?NzxeNN0h0YxMIwNJ0NFvDYyRqyr+RaumZ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/ITwQfxo9/BfbsiFGyI/hvYIgMpZJhT/NVHeI?= =?utf-8?q?XrUJDDTFf5tpBN9Sj4lTcBm1PdmVWxlybHaE9Da10AO1f9ffx3ByiF/yyUbG4UK1O?= =?utf-8?q?5NhuryQhsqKaP6QPQ0GMpL5xD/ivU+VGQh+zvrz4ueAdhC8C/kuLFbVcEt/pzQwTY?= =?utf-8?q?F/v9y5IljlbmMKQzoScOiWfE3zRQ/0IIyL2lBFIjhwwuOLfsrG1KvlRd1qRMP7sQ2?= =?utf-8?q?39UsQ0jg3WbBnOUmb4MHvT9IPCPmkmkesGstDxuNTTjox+DEaawb3dU=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92ff817d-7971-4327-2449-08d9f6e65861 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2022 16:05:43.6558 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GfBDFdq3wXdxM63wyfIfXILJ18GdRjL7NxradvD5OYMHcoV6xlevPHrCQGSQm4+W50oT37yU9eu5qtcP3Ir3JA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3803 Conditionalize it and its uses accordingly. Signed-off-by: Jan Beulich Reviewed-by: Tamas K Lengyel Reviewed-by: George Dunlap --- v2: Re-base (drop clearing of field in getdomaininfo()). --- I was on the edge of introducing a helper for atomic_read(&d->paged_pages) but decided against because of dump_domains() not being able to use it sensibly (I really want to omit the output field altogether there when !MEM_PAGING). --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -1213,6 +1213,7 @@ int add_to_physmap(struct domain *sd, un } else { +#ifdef CONFIG_MEM_PAGING /* * There is a chance we're plugging a hole where a paged out * page was. @@ -1238,6 +1239,7 @@ int add_to_physmap(struct domain *sd, un put_page(cpage); } } +#endif } atomic_inc(&nr_saved_mfns); --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -691,11 +691,13 @@ p2m_add_page(struct domain *d, gfn_t gfn /* Count how man PoD entries we'll be replacing if successful */ pod_count++; } +#ifdef CONFIG_MEM_PAGING else if ( p2m_is_paging(ot) && (ot != p2m_ram_paging_out) ) { /* We're plugging a hole in the physmap where a paged out page was */ atomic_dec(&d->paged_pages); } +#endif } /* Then, look for m->p mappings for this range and deal with them */ --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -112,7 +112,9 @@ void getdomaininfo(struct domain *d, str #ifdef CONFIG_MEM_SHARING info->shr_pages = atomic_read(&d->shr_pages); #endif +#ifdef CONFIG_MEM_PAGING info->paged_pages = atomic_read(&d->paged_pages); +#endif info->shared_info_frame = gfn_x(mfn_to_gfn(d, _mfn(virt_to_mfn(d->shared_info)))); BUG_ON(SHARED_M2P(info->shared_info_frame)); --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -278,14 +278,18 @@ static void dump_domains(unsigned char k #ifdef CONFIG_MEM_SHARING " shared_pages=%u" #endif +#ifdef CONFIG_MEM_PAGING " paged_pages=%u" +#endif " dirty_cpus={%*pbl} max_pages=%u\n", domain_tot_pages(d), d->xenheap_pages, #ifdef CONFIG_MEM_SHARING atomic_read(&d->shr_pages), #endif - atomic_read(&d->paged_pages), CPUMASK_PR(d->dirty_cpumask), - d->max_pages); +#ifdef CONFIG_MEM_PAGING + atomic_read(&d->paged_pages), +#endif + CPUMASK_PR(d->dirty_cpumask), d->max_pages); printk(" handle=%02x%02x%02x%02x-%02x%02x-%02x%02x-" "%02x%02x-%02x%02x%02x%02x%02x%02x vm_assist=%08lx\n", d->handle[ 0], d->handle[ 1], d->handle[ 2], d->handle[ 3], --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -390,7 +390,9 @@ struct domain atomic_t shr_pages; /* shared pages */ #endif +#ifdef CONFIG_MEM_PAGING atomic_t paged_pages; /* paged-out pages */ +#endif /* Scheduling. */ void *sched_priv; /* scheduler-specific data */