From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15813381DE; Wed, 17 Jul 2024 15:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721229605; cv=none; b=IajDUhXFRGTgKDtEdzKoMMY85M9Lb+aBWuXNTg6wOPht+Lb+vaiOsCKp7Pq0DNLmwZFrQQZuoWwyX+OVScCKotvuluRaW0fCqvJU0MykgEPePl4buidxACUbqdI0A9ztn+R07X1X7mskPxwE34lqlTl+fO5E5XQmAchQLLctJ+Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721229605; c=relaxed/simple; bh=TqAHcdZNs4x+UJUeVu6C2dl+LJgO8SWutw1zoRpdcfM=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AHy8RsrVmCJV0z4EVfzPSlJtJQ//FRlPGFmi+ll8oQ3vm851PN/Zzy4ip4VXcbVEbL/XO3ZPxc5JpqOQY4Fo3hJgn5s858lLTnr0v9ZygEGOtttReM1stEXX+8rser3W7XDFZ8q0bZhQRRo9LiuOi8v1Lf1/JN+vXWTUEnkBc9E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E281C2BD10; Wed, 17 Jul 2024 15:20:01 +0000 (UTC) Date: Wed, 17 Jul 2024 11:20:00 -0400 From: Steven Rostedt To: Sean Christopherson Cc: Joel Fernandes , Mathieu Desnoyers , Vineeth Remanan Pillai , Ben Segall , Borislav Petkov , Daniel Bristot de Oliveira , Dave Hansen , Dietmar Eggemann , "H . Peter Anvin" , Ingo Molnar , Juri Lelli , Mel Gorman , Paolo Bonzini , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Valentin Schneider , Vincent Guittot , Vitaly Kuznetsov , Wanpeng Li , Suleiman Souhlal , Masami Hiramatsu , himadrics@inria.fr, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, graf@amazon.com, drjunior.org@gmail.com Subject: Re: [RFC PATCH v2 0/5] Paravirt Scheduling (Dynamic vcpu priority management) Message-ID: <20240717112000.63136c12@rorschach.local.home> In-Reply-To: <20240717105233.07b4ec00@rorschach.local.home> References: <66912820.050a0220.15d64.10f5@mx.google.com> <19ecf8c8-d5ac-4cfb-a650-cf072ced81ce@efficios.com> <20240712122408.3f434cc5@rorschach.local.home> <20240712131232.6d77947b@rorschach.local.home> <20240717103647.735563af@rorschach.local.home> <20240717105233.07b4ec00@rorschach.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 17 Jul 2024 10:52:33 -0400 Steven Rostedt wrote: > We could possibly add a new sched class that has a dynamic priority. It wouldn't need to be a new sched class. This could work with just a task_struct flag. It would only need to be checked in pick_next_task() and try_to_wake_up(). It would require that the shared memory has to be allocated by the host kernel and always present (unlike rseq). But this coming from a virtio device driver, that shouldn't be a problem. If this flag is set on current, then the first thing that pick_next_task() should do is to see if it needs to change current's priority and policy (via a callback to the driver). And then it can decide what task to pick, as if current was boosted, it could very well be the next task again. In try_to_wake_up(), if the task waking up has this flag set, it could boost it via an option set by the virtio device. This would allow it to preempt the current process if necessary and get on the CPU. Then the guest would be require to lower its priority if it the boost was not needed. Hmm, this could work. -- Steve