Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5119505pxv; Wed, 28 Jul 2021 03:41:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcOGdsQLxdlDEjvW/++1TYFWDlUyVCYadtt6YDNbWcKSkTYSOVP8pA2ixSUrlZsC3++qWu X-Received: by 2002:a17:906:8463:: with SMTP id hx3mr5034910ejc.422.1627468919436; Wed, 28 Jul 2021 03:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627468919; cv=none; d=google.com; s=arc-20160816; b=Jw+1/qAmwX6lAi376zFaUcSaJcNQ1foTxGO9BdrZQJK/Wnyu659+MFZsCd9KzFNytd luXnUZR0TtW7mCXBmY7rwH3WsU0QHRFYirxtzdrNxDIelNHcXxru+0/Qnv9DhUpLyV4a s/1cGe8oYu7QkuSNV0N0vhXi3Vm/2rRFaYBgFlmobkw3YHonUzHwntfCAUkeLbXNSZLZ +HaGpRSQqEA4pDKghZTsP7SFQIBNSsqGFtd55RErK5GNuABEhArNr8O34slRuCbIZcUu c3ilGexiTGNiQX9ljAEnZi2nM8IrgFGMPf2ITVvjEj17Gisfi7xsYo619YCK7O36YhPI ynQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ppF9hsuApA1gAdtp04EoScTyC9qpS+x6as3y4xQpHnc=; b=eUIAPsbMjpR+kr2W0ISVBZHFSdDHJymNtjhtHT7anVxxytrTIkkyFxslDIpJsWuzsu l2WY5BD1e1BT4BFw13tkJDW80pc9ya+5JOQxNRhSCUC2fEpHZ4e9CjZUu7RKWXsdlDFo Nmgnr7Ac+8JIzDLR6JgB4Pd7DUpO6rM7GV6DoWsfHs7HTjAebSagXfFfaBP5GhaXWaXc Cl2epoWMK+PpiVL9CwKnZunossIa0LNCOgv0e2YrMXQ6QLup8sgyry1x9bg+fEeAJ/f1 zu01R5/BS4pCXYSGjkEsqL9BbIQrpKpgLy6JbPUMMAwGkk1GOJ0awjSZQI9xjdib2xzh oo0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vFfg09wR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si5365553eje.501.2021.07.28.03.41.36; Wed, 28 Jul 2021 03:41:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vFfg09wR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235655AbhG1KiP (ORCPT + 99 others); Wed, 28 Jul 2021 06:38:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231238AbhG1KiI (ORCPT ); Wed, 28 Jul 2021 06:38:08 -0400 Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7651FC061757 for ; Wed, 28 Jul 2021 03:38:07 -0700 (PDT) Received: by mail-ua1-x931.google.com with SMTP id v3so929769uau.3 for ; Wed, 28 Jul 2021 03:38:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ppF9hsuApA1gAdtp04EoScTyC9qpS+x6as3y4xQpHnc=; b=vFfg09wRfvg1ngcWXs+miTYupLNW1VwZMJvYDgLL7QbAI0OfUBuyy5+DLuRcmFapfq 1J6VCh2JwpP+b7DJiQawtdZXxGOF8Uqqtgd6+jPlDs80GK3V0ByC87/go3MjplD4KiAr +OX1JFBLpDDYKPeE0z03CX8Dy13smOFiINSkbo0i6f1rFqdab7MOzw/uFyEl6EAqPYKc gIh1LSblkZ3X8ooX9iPL8XrOKDqCR3ABZDgH6rcOeuH/QqaL4Wh5EQk9svqVDEVlVTFW HNWdB5Qt1STo03x+O1VSAWoChDZ+QfyCUaztu0/Ktu9PSV4ApD/SQ+KXmSN7z8lNcLlv qCgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ppF9hsuApA1gAdtp04EoScTyC9qpS+x6as3y4xQpHnc=; b=dvI5YVeysUQeY6Rw4gclSDTYjyegu1JXMrt8paYGX7z2vWdFjP7oT9J0IiyRRPUBal s34k8ps7lUM6LnIawnjzEyjchnPyAisj1MN2UcMaXE4nKkapRmYVeNkfDuCBv92k3fhp aaVfJF/+sNekOPqJMZely7fyqZaikLYlK3MWXMnjsLoQZMIR0fPcjW5WQsRcAEbBat7g 5SiZtATle9xgNuHFzw4vIp/pwklzODL1kXJKM4iD6MejKBd3CshsR9THabVH9AtHYuiA Fai93XY4kJyPjm7tt1c22XR4kCt9f5XRAqe3Fq61sFXk3JW0eBlPRI2QmUiQmrJE1+U5 sLGA== X-Gm-Message-State: AOAM531pYo5XzJrmy8cSg6sB9yJJajvPEH2WLd7L/dqcHR5XnLO91P8F 11gOh2YtkO0CTi/KCtQt7ExruGPYmlZgO1cjdVJUtg== X-Received: by 2002:ab0:76d0:: with SMTP id w16mr22128615uaq.15.1627468686420; Wed, 28 Jul 2021 03:38:06 -0700 (PDT) MIME-Version: 1.0 References: <20210728073700.120449-1-suleiman@google.com> <20210728103253.GB7633@fuller.cnet> In-Reply-To: <20210728103253.GB7633@fuller.cnet> From: Suleiman Souhlal Date: Wed, 28 Jul 2021 19:37:55 +0900 Message-ID: Subject: Re: [RFC PATCH 0/2] KVM: Support Heterogeneous RT VCPU Configurations. To: Marcelo Tosatti Cc: Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Suleiman Souhlal , Joel Fernandes , Sergey Senozhatsky , Linux Kernel , kvm@vger.kernel.org, Nitesh Narayan Lal , Nicolas Saenz Julienne Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 28, 2021 at 7:34 PM Marcelo Tosatti wrote: > > On Wed, Jul 28, 2021 at 10:10:31AM +0200, Peter Zijlstra wrote: > > On Wed, Jul 28, 2021 at 04:36:58PM +0900, Suleiman Souhlal wrote: > > > Hello, > > > > > > This series attempts to solve some issues that arise from > > > having some VCPUs be real-time while others aren't. > > > > > > We are trying to play media inside a VM on a desktop environment > > > (Chromebooks), which requires us to have some tasks in the guest > > > be serviced at real-time priority on the host so that the media > > > can be played smoothly. > > > > > > To achieve this, we give a VCPU real-time priority on the host > > > and use isolcpus= to ensure that only designated tasks are allowed > > > to run on the RT VCPU. > > > > WTH do you need isolcpus for that? What's wrong with cpusets? > > > > > In order to avoid priority inversions (for example when the RT > > > VCPU preempts a non-RT that's holding a lock that it wants to > > > acquire), we dedicate a host core to the RT vcpu: Only the RT > > > VCPU is allowed to run on that CPU, while all the other non-RT > > > cores run on all the other host CPUs. > > > > > > This approach works on machines that have a large enough number > > > of CPUs where it's possible to dedicate a whole CPU for this, > > > but we also have machines that only have 2 CPUs and doing this > > > on those is too costly. > > > > > > This patch series makes it possible to have a RT VCPU without > > > having to dedicate a whole host core for it. > > > It does this by making it so that non-RT VCPUs can't be > > > preempted if they are in a critical section, which we > > > approximate as having interrupts disabled or non-zero > > > preempt_count. Once the VCPU is found to not be in a critical > > > section anymore, it will give up the CPU. > > > There measures to ensure that preemption isn't delayed too > > > many times. > > > > > > (I realize that the hooks in the scheduler aren't very > > > tasteful, but I couldn't figure out a better way. > > > SVM support will be added when sending the patch for > > > inclusion.) > > > > > > Feedback or alternatives are appreciated. > > > > This is disguisting and completely wrecks the host scheduling. You're > > placing guest over host, that's fundamentally wrong. > > > > NAK! > > > > If you want co-ordinated RT scheduling, look at paravirtualized deadline > > scheduling. > > Peter, not sure what exactly are you thinking of? (to solve this > particular problem with pv deadline scheduling). > > Shouldnt it be possible to, through paravirt locks, boost the priority > of the non-RT vCPU (when locking fails in the -RT vCPU) ? Unfortunately paravirt locks doesn't work in this configuration because sched_yield() doesn't work across scheduling classes (non-RT vs RT). :-( -- Suleiman