From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 80BC0C433F5 for ; Fri, 17 Dec 2021 18:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uHel3ZlX6aMDVJSyLLzs/ZMALn+kVuOqWPWkA+AQit4=; b=iM2iEMwJpnkt8w vYa88KM4LmdTBYoQ6Zo7SONEKurzp4kPdElN66MgeuCx4NN56yoDF9Qp/jaAn3To+FMqcFTN36fi/ xfPYpO4PIts4HUaa7hdfMPoR/pvCuF/O1iusaDyq4P6Cu0gANY7Op0+56sukUNawSqu6MN5DnhvpJ bTy0SSfM8SzCcn2PnOHrbN52OieR+IEGgVwwjSJq2C1ny58j0z3sjcIM1jj+RxA4tKH2xOE/6szQW kgKxoOg/Ut7CyqClOcr6KILp8PmuU/5kwxDkLlREcAuqRm7oyw7QZqXOAnVgAHzjiiYSCCZuR9fd2 X2TobU/vOYHRIet1YQRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myHpm-00BlyO-SH; Fri, 17 Dec 2021 18:19:59 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1myGxG-00BSp3-Sw for linux-arm-kernel@lists.infradead.org; Fri, 17 Dec 2021 17:23:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639761817; 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=2E4moqp/c8I4AQdWLvxljNuUdO0Hkrp+/zBhC2tHogE=; b=CpUDKrSICM8u29mKZKbmqtfvYQZDX0hcv4KoFRaAbelwM7gwPFgqaK6ejMXDKyPW5t+6Mt MNBYaRGl5auRVBZWl3wR7Lc+AKoptl0Z7I/m8QH2NWqQ4RXEl8RHTZInxWCQ2d3mAwOnCC +6IAYEiQ+GynibIuHd0NzQXTAt7h75k= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-633-0JyxHO0PNkio6_M4ri-m9Q-1; Fri, 17 Dec 2021 12:23:36 -0500 X-MC-Unique: 0JyxHO0PNkio6_M4ri-m9Q-1 Received: by mail-ed1-f72.google.com with SMTP id b16-20020a056402351000b003f81e62ab2aso1450301edd.8 for ; Fri, 17 Dec 2021 09:23:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=2E4moqp/c8I4AQdWLvxljNuUdO0Hkrp+/zBhC2tHogE=; b=1/H3w1FprQYXgSdj7HsQbraKznkqMni5XMoq11LpcrQqkB3gn6WBCtUgPwWEiW/p76 maMVIQgP3VjONnCtnBOEOfjR1RQsX56QwAacPMMj49MYdzGzcH04rtqMgbh4Zm0ua6Y/ 0gBHqwDn/hugeg4Kxj6COuG4IabQjeCx3CGpTRsJnjk8QxqZvNYzWzK3B8DkvEbEAMgq zo9kq5GxmiCojF0ykttkw2YnJXcXZyb49yKl9bKylihL2MCoA3gccmkX8PKKera4mLjg qs4QWfT2DHgHIkMCuPxMzYsjAH2wqsErEVgr3HX4GUbEAanG/2P2DCPGMTbpg2wQKRzY Mfgw== X-Gm-Message-State: AOAM532UjIndOz+VnAhkvDYmixaXLwnB0EL8DAKYiKU7+Etz9wmRvzmT 4Z8i3EYMRo4EdPYPZi3KOtFReFD6HllW099FIc0XxIjTXYPP1npl1UtzHRWFPvTEUaRxhBK6RbV HjEh7BI/NMkUWG7k+/yuNk2JOXn8Lb7373ls= X-Received: by 2002:a17:907:2d9f:: with SMTP id gt31mr3276993ejc.353.1639761815436; Fri, 17 Dec 2021 09:23:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyYaUeLeDwkSn+1UkB3EEbIuMyCeJwU20sBpBLMNBVvm8tzJn+Taaia56Rbt5qT+bN3TbTMg== X-Received: by 2002:a17:907:2d9f:: with SMTP id gt31mr3276976ejc.353.1639761815192; Fri, 17 Dec 2021 09:23:35 -0800 (PST) Received: from ?IPV6:2001:b07:6468:f312::ac3? ([2001:b07:6468:f312::ac3]) by smtp.googlemail.com with ESMTPSA id a16sm1798277ejk.8.2021.12.17.09.23.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Dec 2021 09:23:34 -0800 (PST) Message-ID: <24268298-c51f-afcd-72e2-22c39eb002b5@redhat.com> Date: Fri, 17 Dec 2021 18:23:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: Possible nohz-full/RCU issue in arm64 KVM To: paulmck@kernel.org Cc: Mark Rutland , Nicolas Saenz Julienne , maz , frederic , linux-kernel , rcu , Thomas Gleixner , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel References: <70f112072d9496d21901946ea82832d3ed3a8cb2.camel@redhat.com> <9ab8107f-ff41-6a9e-57e1-a261bea93aca@redhat.com> <20211217160749.GS641268@paulmck-ThinkPad-P17-Gen-1> <20211217164535.GU641268@paulmck-ThinkPad-P17-Gen-1> <4c369ca2-2ad0-4a02-90e9-2d82df6c289d@redhat.com> <20211217171218.GV641268@paulmck-ThinkPad-P17-Gen-1> From: Paolo Bonzini In-Reply-To: <20211217171218.GV641268@paulmck-ThinkPad-P17-Gen-1> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211217_092339_091428_7CE679AE X-CRM114-Status: GOOD ( 22.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 12/17/21 18:12, Paul E. McKenney wrote: > On Fri, Dec 17, 2021 at 06:02:23PM +0100, Paolo Bonzini wrote: >> On 12/17/21 17:45, Paul E. McKenney wrote: >>> On Fri, Dec 17, 2021 at 05:34:04PM +0100, Paolo Bonzini wrote: >>>> On 12/17/21 17:07, Paul E. McKenney wrote: >>>>>> rcu_note_context_switch() is a point-in-time notification; it's not strictly >>>>>> necessary, but it may improve performance a bit by avoiding unnecessary IPIs >>>>>> from the RCU subsystem. >>>>>> >>>>>> There's no benefit from doing it when you're back from the guest, because at >>>>>> that point the CPU is just running normal kernel code. >>>>> >>>>> Do scheduling-clock interrupts from guest mode have the "user" parameter >>>>> set? If so, that would keep RCU happy. >>>> >>>> No, thread is in supervisor mode. But after every interrupt (timer tick or >>>> anything), one of three things can happen: >>>> >>>> * KVM will go around the execution loop and invoke rcu_note_context_switch() >>>> again >>>> >>>> * or KVM will go back to user space >>> >>> Here "user space" is a user process as opposed to a guest OS? >> >> Yes, that code runs from ioctl(KVM_RUN) and the ioctl will return to the >> calling process. > > Intriguing. A user process within the guest OS or a user process outside > of any guest OS, that is, within the host? A user process on the host. The guest vCPU is nothing special: it's just a user thread that occasionally lets the guest run by invoking the KVM_RUN ioctl. Hopefully, KVM_RUN will be where that user thread will spend most of the time so the guest runs at full steam. KVM_RUN is the place where you have the code that Nicolas and Mark were discussing. From the point of view of the kernel however the thread is always in kernel mode when it runs the guest, because any interrupt will be recognized while still in the ioctl. (I'll add that from the point of view of the scheduler, there's no difference between a CPU-bound guest and a "normal" CPU-bound process on the host, e.g. wasting time with "for(;;)" or calculating digits of PI is the same no matter if you're doing it in the guest or in the host. Likewise for I/O-bound guests; e.g. doing "hlt" or "wfi" constantly in the guest looks exactly the same to the scheduler as a process that spends its time in the poll() system call). Paolo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel