From patchwork Mon Sep 12 04:09:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivam Kumar X-Patchwork-Id: 12973234 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81126ECAAD5 for ; Mon, 12 Sep 2022 04:27:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229531AbiILE0V (ORCPT ); Mon, 12 Sep 2022 00:26:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbiILE0U (ORCPT ); Mon, 12 Sep 2022 00:26:20 -0400 X-Greylist: delayed 627 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 11 Sep 2022 21:26:19 PDT Received: from mx0b-002c1b01.pphosted.com (mx0b-002c1b01.pphosted.com [148.163.155.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B007E1C908 for ; Sun, 11 Sep 2022 21:26:19 -0700 (PDT) Received: from pps.filterd (m0127844.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28BCIHA7020506; Sun, 11 Sep 2022 21:26:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=proofpoint20171006; bh=39Ppz8D5yUE2kLAAbJqLn+DP2snZCikuOwcRuOeO2W8=; b=DfSwCHtQNex549YcamMpg19EmsNwXAUpYGaQEvStLcIWsAr0rz7wvHkFWekbQZoQQIoL LmkcBxBsVpbU9BY5GWPw3z7EWc5mZc+BahFLfDeHA1UISNkwak3GWKtomyIELsLAyIba hK7k0/cB3HcPMPqeKvifej/AYeBFT2ZlzxkT4/M01I7V6r/lxkw2/LtmMJGiRRu9qiA7 jQYOHjTm6t6QRD7CJMm12D4ryZcyT2ZtsrHaoIFkx6lNMsbNLUSUA+aVfJkRrcA4Mdm8 4zoPPhr4GO4eeWQgGGuRYT9Hn6dKPeYirN4SNuWgjmMq0277ZIsjdjph3oCI6eSzSQqF KQ== Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3jgt41ap0n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 11 Sep 2022 21:26:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LiJ03uS1ZNJxEP4AvOaeaV9AXE1a9/kPE4mIe/6Wbmg9m1q7nY4F2XjTxLdKidZRIL+nd7dc49QJgnL42FSiBFZgQ+z0YtP3cD7pv75IKZH2cCr7frfUnrh0bZKp8L5pyt+49WnFuiWZT2qFC44WUz63px2TFa3bB/LfNRyCSQ811xB3mrfiNNJWO2FKW6YaqHyE+uEuEuzO7DZ5Bp6tx5G6PGrYHoLXDvv2JIGF2m8RvoRozFTVnM8gyny8ocYiNph4cXNBNtB/WRlghyQu4m8WvQP4fCQHCwKyzprgMvVIt5aEDqdaRpiERtgs8TQgjmYO6f/3jeDA6oFCxCAwlg== 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=39Ppz8D5yUE2kLAAbJqLn+DP2snZCikuOwcRuOeO2W8=; b=C45t8B8FEB5n1o+V21l7k1ROkm8OpLlOELIhFUKs2O9ZlqCyO0gcy0a9y7MqZX6eZwWeUst8dxd4IfRzFla5GtlC7/rXUxwCd+ODg1lUh2THW5QAsQ60vs2VESneWc5JZ1I4mOMtAKAzdPrrbfbHa/wY23bhwAgsAF2Pwbj+0rugjG0k4UZhveAox2hrn3HCQtA9AinysUIeAU3l5PdpB28S6oCQ2KMmJwKsw+j451BbVOV1GX/+2td1lTADdDZrHTOYDOlnLP6UlfDQ5fK3h4ZCloXAaRuJzceZsuvYlbDLbMvSWHLkMtakQKY+vyPbhL86D9BhFzFHCbsfRhbUpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none Received: from CO6PR02MB7555.namprd02.prod.outlook.com (2603:10b6:303:b3::20) by CH3PR02MB9116.namprd02.prod.outlook.com (2603:10b6:610:144::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12; Mon, 12 Sep 2022 04:11:35 +0000 Received: from CO6PR02MB7555.namprd02.prod.outlook.com ([fe80::bcdf:6d6f:e6e:b9cf]) by CO6PR02MB7555.namprd02.prod.outlook.com ([fe80::bcdf:6d6f:e6e:b9cf%7]) with mapi id 15.20.5612.022; Mon, 12 Sep 2022 04:11:35 +0000 From: Shivam Kumar To: pbonzini@redhat.com, seanjc@google.com, maz@kernel.org, james.morse@arm.com, borntraeger@linux.ibm.com, david@redhat.com Cc: kvm@vger.kernel.org, Shivam Kumar , Shaju Abraham , Manish Mishra , Anurag Madnawat Subject: [PATCH v5 3/5] KVM: arm64: Dirty quota-based throttling of vcpus Date: Mon, 12 Sep 2022 04:09:28 +0000 Message-Id: <20220912040926.185481-4-shivam.kumar1@nutanix.com> X-Mailer: git-send-email 2.22.3 In-Reply-To: <20220912040926.185481-1-shivam.kumar1@nutanix.com> References: <20220912040926.185481-1-shivam.kumar1@nutanix.com> X-ClientProxiedBy: BY5PR03CA0025.namprd03.prod.outlook.com (2603:10b6:a03:1e0::35) To CO6PR02MB7555.namprd02.prod.outlook.com (2603:10b6:303:b3::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR02MB7555:EE_|CH3PR02MB9116:EE_ X-MS-Office365-Filtering-Correlation-Id: af5a38bc-75f7-41d4-56bb-08da9474e1b6 x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zZVj/KkEA3swy212UdyU03yOF2jjqY/L/1QymaYjSwgf2oMX2PE0RKtUkzmyuxAXA3rV1+A0HMXebYZ/d9XFpLWhx3YI99HvX0oiYfKuIvx7urgwtQFh3a/gGJW924hze8++YTH5j6gd4M7ZPCnxaz/ZmbKZFx9XvZj7KPCSgBmZ5McIG7zq0GfhbGNoz/F4vr41JhCNtJvDHy81lmEWLY0T4fKHaJ8mVMUzvD37OUfLHrmY2aiH+G9kJb+H4wnNgYUHYQ4MetmoTssG2mk9qiVmvN1JPJPmPBQaTKykzvlpBdgRdgypWI/kS1MrBKyFNc8U3E7OJhupBTD4EM9qrRB86LThDzv+cJDUCjKiewpBT3Aj1KUG76A5dX91ZgfspgADOmlMKKe3R3vXf/TyxvKc1eHK4s35S4gnBhlxfCy7yGI5TeWcjxyMMQ2kjo9cHK+LiLmCjBJ6U0obb5J4Wbp9T5medyX5O+urMka+loP7MUxNf9a4XBE5cYV6uduhhXEp2+rWdrUvOGwvMY13KnF/28IRYop5pXKUpJ5q1u8mvi4k1VshlNabjAVHut0ikjBgHfI1+gc4LLntER5EJKouxgthpjmxKyOR4s5Q1lmf788E//JSYWVUF4Qo0TUfE3anWxOuo75cCbHwvnI1PUT9w+7OFOSkcdXJiB/80Fo2oWUwqdVXuUyg9u80VZs1PCtH3CKSBqfDNvfyibRX9vfInhRBRJ4d12Ow1PWyFW33h4T3YOwhWJUGNkrUvm7xR5U6vqbKHEEVPmen41eguY6t7RfqVmC0SDHVSsEGfeM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO6PR02MB7555.namprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(396003)(366004)(376002)(136003)(346002)(39850400004)(26005)(107886003)(6512007)(52116002)(41300700001)(54906003)(86362001)(6506007)(6666004)(478600001)(6486002)(2616005)(1076003)(186003)(38100700002)(83380400001)(2906002)(15650500001)(38350700002)(36756003)(5660300002)(8676002)(66946007)(4326008)(8936002)(66476007)(66556008)(316002)(14143004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9wZwdKP6iNhK20p3sY8IYLyCJ3t2XB6gbPpwfncL46Kcd9Q8pMd37zBNhu8T+SOYIP4j7j/mEzTaQjmPjRV4gHl67rKMVIHaj5O+b/FcNgNirCDRi837ZGutCmQX5hrJdYTnCdAZtkADVxx7ZQ+Dh8JJG3mmAIpTv3DHHdte7yqFFhU0In/e+IbBeU70xR4cLXus4hVzNp0ot72WXMVcrWa5ZRgje7LNYnc07mkcNRDPA9S+hJD2E8ziIJE/wNs+esZh7yCphp7VrBRkIrTTZDA3uSiIsb3axvUudQj4BhWc6hUA6VcfZm1ipanzZd5XjgtNTGHVrSAtwxFGltQ31LYIMnSwXfVQpK+C6XtXaDFhKbxIGx+QefJpBay85rG3tT/bJ+mO85zIkYTeHcjsBiBndUuiuSUOWoYqhQdfCfh1IEbM8GFHVh1ZMvvSs1v7YteXOuJxNqKBN1T7edpwuz0sY/4Tp5hcoDsPfcGn0H/SB+VBDjKOvQKmNpDlbIuT0Ac8sncHKSBCd/QI89nZFtrRHRUn43h46er+tJnNcRqS/GVJdBmnXzJ02UBfeE61SFOyQhHRvjgTRiRZJHQ0nBauIwHLuDwneC5+6N6gL5/xWr3JR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MS-Exchange-CrossTenant-AuthSource: CO6PR02MB7555.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2022 04:11:35.2161 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bh8l9T/vj+RgjsKhboTRbL0g7w5aI01EqWtlGfShw94FMH5FaPsGjkYFDMs1X06nNfgunDpbixAgml4F0KUDhhVd2AodE/GrCIsmXn4tyzw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR02MB9116 X-Proofpoint-GUID: DAdmWfm-yvtz_GTsG4Gc5G5BL6jISEVY X-Proofpoint-ORIG-GUID: DAdmWfm-yvtz_GTsG4Gc5G5BL6jISEVY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-12_02,2022-09-09_01,2022-06-22_01 X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Exit to userspace whenever the dirty quota is exhausted (i.e. dirty count equals/exceeds dirty quota) to request more dirty quota. Suggested-by: Shaju Abraham Suggested-by: Manish Mishra Co-developed-by: Anurag Madnawat Signed-off-by: Anurag Madnawat Signed-off-by: Shivam Kumar --- arch/arm64/kvm/arm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 2ff0ef62abad..ff17d14aa5b0 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -747,6 +747,15 @@ static int check_vcpu_requests(struct kvm_vcpu *vcpu) if (kvm_check_request(KVM_REQ_SUSPEND, vcpu)) return kvm_vcpu_suspend(vcpu); + + if (kvm_check_request(KVM_REQ_DIRTY_QUOTA_EXIT, vcpu)) { + struct kvm_run *run = vcpu->run; + + run->exit_reason = KVM_EXIT_DIRTY_QUOTA_EXHAUSTED; + run->dirty_quota_exit.count = vcpu->stat.generic.pages_dirtied; + run->dirty_quota_exit.quota = vcpu->dirty_quota; + return 0; + } } return 1;