Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5370720imb; Thu, 7 Mar 2019 14:07:35 -0800 (PST) X-Google-Smtp-Source: APXvYqz+miRcXRQIki8Ikm8nFDSEW7AHupB9R7vjicjEWdYP6U3fn1LXxAtYEnsjutuh81irVuj2 X-Received: by 2002:a62:ed06:: with SMTP id u6mr14726437pfh.132.1551996455425; Thu, 07 Mar 2019 14:07:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551996455; cv=none; d=google.com; s=arc-20160816; b=ungQIwBvCahhxLe6nYlmWxmX0D38d+Z9XWrMONVQG6FuQQezWPuTrPB9I0MivWqG7Z 4fdZEg3e7aPsdxz+kZKptLWZZJwIs1u1r28Veq4ILD5IcnszicwcqzmE2G9y6MmGY+Oz YbVbVJGbbpGBc/wRamFOMwZvQIYqIEgkV3UfTXmqqL9WejjI8izIMVkB06bwPAa68B2E hGcziq81o+me43VT9jiG/MEQRJ2+04wUPl/GdC5zf2Nb3B/I2qMJrlzkPG3nwQEl5O4f GREarBIGOJ0wmyRucF1C16S8AVj3oG9lxd3pCIPA/F6CytpxF+7wNz3Zpt7ojVcIiLls dl8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=SkHvbQ/yBjkcZJqD3NaC7rDliqZHjmecn38iIs/obHQ=; b=ukgZ7gRo+O0/z/FVK5ZYAr1tkteGL16P5TOnUH2Cvc6CePzS7H5D7ClrPPwJhy3E6x BYlRXpSg0Yh7Ro9uQVJUp/Zy2id0lknEq4kDx2zqewHfs4TQcXy/NKyh/PHRRjcJ6hUu GLpLTaVqjZnsgHCF2d/Jf1gS9TEPO6re1uXSClxIFAkEB0dgxpOrZdIyt88LUDgs3H7L SKISC/Qxh7psqsTXNAqd+4pe2WvQ6UGTpddpitKzPHn92WSlQ6T/9rEOTwcsbww5f0J6 VS/NXaZkcibCBW6KQu9aq3zf4r6C5s9T7DN8yFgcOEeAdHTNMeWHAlfo27gbG9ZSVIsJ sDaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=lNGayHhN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si4946127pff.277.2019.03.07.14.07.19; Thu, 07 Mar 2019 14:07:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=lNGayHhN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726279AbfCGWGj (ORCPT + 99 others); Thu, 7 Mar 2019 17:06:39 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:50627 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726237AbfCGWGj (ORCPT ); Thu, 7 Mar 2019 17:06:39 -0500 Received: by mail-wm1-f68.google.com with SMTP id x7so10794703wmj.0 for ; Thu, 07 Mar 2019 14:06:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:openpgp:autocrypt:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SkHvbQ/yBjkcZJqD3NaC7rDliqZHjmecn38iIs/obHQ=; b=lNGayHhNYQqiFbX1XwmS8wVlW9FVFHDCKLhOPAvLdvb4WQC5wW4+KNG3RZGs5d45qU zciLkmHBbR6aKLw92792rE+dKuikV2pyJOxt8LqYPY1+dNsYtq0gcmC/zLofjXBhfOqy l/EF4aq8tjUMqCJm4oVv3JC56jg8qIDBt+ByAcktlMJLkv+rXtRzrzhHOKGf5VvUdCoe xyPUjc9xCmmxqiqei274ekGHeqd3JcW5MS7PQONEYEWqd3ZW06s2zhfE1CYXAnN1tVI9 9dpZvaAR/KwSVu13sxuIJT3/PP3a75+yKUHEg52xKfosclJ1s3SOhdz39CZ8qaDRKi+5 KkNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:openpgp :autocrypt:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=SkHvbQ/yBjkcZJqD3NaC7rDliqZHjmecn38iIs/obHQ=; b=KucAdNcwQgUljCj6dtEYhq0eAUX7UQOGzLx5qJVTk1Gk0Nau9ExA1z8bYrqVmmhECv UYKqCcZrySTWsJxHH8RT1gqGn2oG52IifoPbY3j6zNma2yMRV3nfU6/a+sAcqDrePAEO H3kZxByMHXksEiFbEr5Zs3og59eJ0/BWaKse8b4t52vOS/fnK98ODKjzOa8vUsGGdky7 CCvD+++9zGlpL4blZ8PE1oUJcu3dnPk6rzwWAEB0OBrrlfFiNYcfw0ud/PjjEIrOd8sx kif/lSFBVTIecMwdJcuQ/v5ylr86I3nyqR1/hTMUYbz6JLWMVEpMaEX4Ra5KRJdGN+N+ 0ycQ== X-Gm-Message-State: APjAAAVD9DEmOYNpdcqYnF/XXcQQ6Kx0D+wrQaw4ILdgJcbXvpHcqE5N 9mSsXo0442PY+7idbbmYX5k= X-Received: by 2002:a7b:c7da:: with SMTP id z26mr7138482wmk.151.1551996396366; Thu, 07 Mar 2019 14:06:36 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:c1b:dbd7:15a6:4014? ([2001:b07:6468:f312:c1b:dbd7:15a6:4014]) by smtp.googlemail.com with ESMTPSA id p5sm6151534wme.14.2019.03.07.14.06.34 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 14:06:35 -0800 (PST) Subject: Re: [RFC][PATCH 00/16] sched: Core scheduling To: Peter Zijlstra , Greg Kerr Cc: Greg Kerr , mingo@kernel.org, tglx@linutronix.de, Paul Turner , tim.c.chen@linux.intel.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, subhra.mazumdar@oracle.com, fweisbec@gmail.com, keescook@chromium.org References: <20190218165620.383905466@infradead.org> <20190220094255.GE32494@hirez.programming.kicks-ass.net> <20190220183355.GA213003@kerrnel.com> <20190222141035.GZ32494@hirez.programming.kicks-ass.net> From: Paolo Bonzini Openpgp: preference=signencrypt Autocrypt: addr=pbonzini@redhat.com; keydata= mQHhBFRCcBIBDqDGsz4K0zZun3jh+U6Z9wNGLKQ0kSFyjN38gMqU1SfP+TUNQepFHb/Gc0E2 CxXPkIBTvYY+ZPkoTh5xF9oS1jqI8iRLzouzF8yXs3QjQIZ2SfuCxSVwlV65jotcjD2FTN04 hVopm9llFijNZpVIOGUTqzM4U55sdsCcZUluWM6x4HSOdw5F5Utxfp1wOjD/v92Lrax0hjiX DResHSt48q+8FrZzY+AUbkUS+Jm34qjswdrgsC5uxeVcLkBgWLmov2kMaMROT0YmFY6A3m1S P/kXmHDXxhe23gKb3dgwxUTpENDBGcfEzrzilWueOeUWiOcWuFOed/C3SyijBx3Av/lbCsHU Vx6pMycNTdzU1BuAroB+Y3mNEuW56Yd44jlInzG2UOwt9XjjdKkJZ1g0P9dwptwLEgTEd3Fo UdhAQyRXGYO8oROiuh+RZ1lXp6AQ4ZjoyH8WLfTLf5g1EKCTc4C1sy1vQSdzIRu3rBIjAvnC tGZADei1IExLqB3uzXKzZ1BZ+Z8hnt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+MMNDm S1SMx7wu0evvQ5kT9NPzyq8R2GIhVSiAd2jioGuTjX6AZCFv3ToO53DliFMkVTecLptsXaes uUHgL9dKIfvpm+rNXRn9wAwGjk0X/A== Message-ID: <6c2a697a-cb2b-2061-b791-21b768bea3db@redhat.com> Date: Thu, 7 Mar 2019 23:06:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190222141035.GZ32494@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/02/19 15:10, Peter Zijlstra wrote: >> I agree on not bike shedding about the API, but can we agree on some of >> the high level properties? For example, who generates the core >> scheduling ids, what properties about them are enforced, etc.? > It's an opaque cookie; the scheduler really doesn't care. All it does is > ensure that tasks match or force idle within a core. > > My previous patches got the cookie from a modified > preempt_notifier_register/unregister() which passed the vcpu->kvm > pointer into it from vcpu_load/put. > > This auto-grouped VMs. It was also found to be somewhat annoying because > apparently KVM does a lot of userspace assist for all sorts of nonsense > and it would leave/re-join the cookie group for every single assist. > Causing tons of rescheduling. KVM doesn't do _that much_ userspace exiting in practice when VMs are properly configured (if they're not, you probably don't care about core scheduling). However, note that KVM needs core scheduling groups to be defined at the thread level; one group per process is not enough. A VM has a bunch of I/O threads and vCPU threads, and we want to set up core scheduling like this: +--------------------------------------+ | VM 1 iothread1 iothread2 | | +----------------+-----------------+ | | | vCPU0 vCPU1 | vCPU2 vCPU3 | | | +----------------+-----------------+ | +--------------------------------------+ +--------------------------------------+ | VM 1 iothread1 iothread2 | | +----------------+-----------------+ | | | vCPU0 vCPU1 | vCPU2 vCPU3 | | | +----------------+-----------------+ | | | vCPU4 vCPU5 | vCPU6 vCPU7 | | | +----------------+-----------------+ | +--------------------------------------+ where the iothreads need not be subject to core scheduling but the vCPUs do. If you don't place guest-sibling vCPUs in the same core scheduling group, bad things happen. The reason is that the guest might also be running a core scheduler, so you could have: - guest process 1 registering two threads A and B in the same group - guest process 2 registering two threads C and D in the same group - guest core scheduler placing thread A on vCPU0, thread B on vCPU1, thread C on vCPU2, thread D on vCPU3 - host core scheduler deciding the four threads can be in physical cores 0-1, but physical core 0 gets A+C and physical core 1 gets B+D - now process 2 shares cache with process 1. :( Paolo