Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3366282rdh; Mon, 27 Nov 2023 12:18:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IEyUJOC5/ZSBl1oz7LvOLKiAJ/VATeNtLjoxikjUkeO69U5jnoBpMsc+QcvkrbFBXPXpMio X-Received: by 2002:a05:6a21:2d87:b0:187:71f7:bb26 with SMTP id ty7-20020a056a212d8700b0018771f7bb26mr14051674pzb.54.1701116291470; Mon, 27 Nov 2023 12:18:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701116291; cv=none; d=google.com; s=arc-20160816; b=swPKSXWz/v7hnzxHTQCsOPYO8ohLLxRyD3TRqFx3tpIE9qHtg1zTMolmN+aaYxkZph zSAhShx1K8tDzJ8guCKRMlRAjYcsAV/ZpKyUbG/ppa3KHQKbuDCnbtIdeScFkXbyS5KC WZ3NzfZYJxGiWE9ZmQI/HRanDx5AEpZBuvrtgQ6SqkmMzDsFZnf6+d5wHbEE8HVZW/ru E8VR9WLAbNkvahXOO8sN86nUEhLXM1fCavdHJ29r0ht8l0mhaDkJLJsJ6/yku+mUyVF0 9ySSGwM7RgqALN3yF0QKgpVTs6VWJXsJyk3OwpzbON6SmCl7+PzObibbrpGjo9YVQkqH PeaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date; bh=bw7sG/J10FNSCBQNIiS3cv8xQnYCIwcwoCSGpip5brg=; fh=rIOhpPtacfXIMcaC4wmpIylW1Ssa0orbfnySoaOagVc=; b=HfRBlDs4w53U4pkTWt35+l7+h5x/ZgLS9e3NDKuIpU3c/UE+2LOo7rhET+hY49JKDX wLFx8NONMaRPozLwVHU+WEZpgknake5O40XBTfo7h1+K8k3lGMYY/icfYTQdiW/7cxG6 cBCVPgzD7hPMzhDkd1WwOmv2lIZH0qBiJYl6vGLHUalyZbRbt3qNPsivveg4yFiIqm8H lKzquhvQc+q56fI7xcNfqgbnj48e4r+sViHkoPmEpoU0IJoAE32wXkaWiAcMKxxtKsQD GvKVj7blis3tA2wH8fcuJOVX10f02om9o7A7z1QMWKyy5Vg4ww+Agur08MPQF7vKsepR 9s3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id cn2-20020a056a020a8200b005b8f401a3a6si10406258pgb.41.2023.11.27.12.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 12:18:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B5480809D32A; Mon, 27 Nov 2023 12:18:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233114AbjK0URj (ORCPT + 99 others); Mon, 27 Nov 2023 15:17:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231771AbjK0URh (ORCPT ); Mon, 27 Nov 2023 15:17:37 -0500 Received: from gentwo.org (gentwo.org [62.72.0.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FEFBD4B for ; Mon, 27 Nov 2023 12:17:44 -0800 (PST) Received: by gentwo.org (Postfix, from userid 1003) id B7CFE41AEE; Mon, 27 Nov 2023 12:17:43 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id B6CC641AED; Mon, 27 Nov 2023 12:17:43 -0800 (PST) Date: Mon, 27 Nov 2023 12:17:43 -0800 (PST) From: "Christoph Lameter (Ampere)" To: Mihai Carabas cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com, wanpengli@tencent.com, vkuznets@redhat.com, rafael@kernel.org, daniel.lezcano@linaro.org, akpm@linux-foundation.org, pmladek@suse.com, peterz@infradead.org, dianders@chromium.org, npiggin@gmail.com, rick.p.edgecombe@intel.com, joao.m.martins@oracle.com, juerg.haefliger@canonical.com, mic@digikod.net, arnd@arndb.de, ankur.a.arora@oracle.com Subject: Re: [PATCH 7/7] cpuidle/poll_state: replace cpu_relax with smp_cond_load_relaxed In-Reply-To: <724589ce-7656-4be0-aa37-f6edeb92e1c4@oracle.com> Message-ID: <277fbd0d-25ea-437e-2ea7-6121c4e269db@linux.com> References: <1700488898-12431-1-git-send-email-mihai.carabas@oracle.com> <1700488898-12431-8-git-send-email-mihai.carabas@oracle.com> <6bd5fd43-552d-b020-1338-d89279f7a517@linux.com> <724589ce-7656-4be0-aa37-f6edeb92e1c4@oracle.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1152771662-1701116263=:544079" X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 27 Nov 2023 12:18:08 -0800 (PST) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1152771662-1701116263=:544079 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Wed, 22 Nov 2023, Mihai Carabas wrote: > La 22.11.2023 22:51, Christoph Lameter a scris: >> >> On Mon, 20 Nov 2023, Mihai Carabas wrote: >> >>> cpu_relax on ARM64 does a simple "yield". Thus we replace it with >>> smp_cond_load_relaxed which basically does a "wfe". >> >> Well it clears events first (which requires the first WFE) and then does a >> WFE waiting for any events if no events were pending. >> >> WFE does not cause a VMEXIT? Or does the inner loop of >> smp_cond_load_relaxed now do 2x VMEXITS? >> >> KVM ARM64 code seems to indicate that WFE causes a VMEXIT. See >> kvm_handle_wfx(). > > In KVM ARM64 the WFE traping is dynamic: it is enabled only if there are more > tasks waiting on the same core (e.g. on an oversubscribed system). > > In arch/arm64/kvm/arm.c: > >  457 >-------if (single_task_running()) >  458 >------->-------vcpu_clear_wfx_traps(vcpu); >  459 >-------else >  460 >------->-------vcpu_set_wfx_traps(vcpu); Ahh. Cool did not know about that. But still: Lots of VMEXITs once the load has to be shared. > This of course can be improved by having a knob where you can completly > disable wfx traping by your needs, but I left this as another subject to > tackle. kvm_arch_vcpu_load() looks strange. On the one hand we pass a cpu number into it and then we use functions that only work if we are running on that cpu? It would be better to use smp_processor_id() in the function and not pass the cpu number to it. --8323329-1152771662-1701116263=:544079--