From patchwork Fri Jul 9 04:37:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 12366663 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95050C07E9E for ; Fri, 9 Jul 2021 04:39:41 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5C9DC61437 for ; Fri, 9 Jul 2021 04:39:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C9DC61437 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZgtaWYcFUspNk3vBCxBmAZE+FqGV2ba4VKUbWesFDmE=; b=HXIBo9pVALhhms jIm6A8xW6xlGuFNvCKXxA3w52x8aPTiJTzJMx5n9MwpHL+FCYTXepRqbeneh+gAoFEIlfyWwFFkUS mTCiedvIpKqabkdcluyt3z2iC1GVe+0zkdj+ySFz15sLleDELYvZL7cZsgZf7daFJ6/hyRlC9cx3P /dF58/F2D2384xNDY6HPDj+tVmKJ27IAlaFmBqgEt7v/jfCgU02BZlgcZIVxMX8jOgbivAIV/qskj N8OlLmN7GkLDfLRDh9Dr4yyiT+gOuQDGcoZvWW5HCEpb4j79JixUWbuS24C5+OHOhmHG9kz9FMj0q Rk7L9IkhJEw4IWBQFZ6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m1iHD-000k96-PX; Fri, 09 Jul 2021 04:38:11 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m1iGk-000k4t-4t for linux-arm-kernel@lists.infradead.org; Fri, 09 Jul 2021 04:37:43 +0000 Received: by mail-pj1-x102a.google.com with SMTP id l11so5072102pji.5 for ; Thu, 08 Jul 2021 21:37:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QP3/GYzOBKmilm7HuEJkuqubxHWg9l5vJdRHFzc5VNI=; b=RclDDj3+rehsUldw5TyhuwvHXTZwkgCQaCL0mXmrg3nr75emQHZsdQL/PMBpmd2FSB 1okB0a10syEhmCx3GptxPQ6XYeTuHpa4AESmoVEqtDp3+bLgb4ii01UctXQhRSyNL3s2 nQd9N40sCnQ4Tz9f+NrHySY4qVntzcKYSjVho= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QP3/GYzOBKmilm7HuEJkuqubxHWg9l5vJdRHFzc5VNI=; b=bIZ/UoeBjiwYu8LRpjm4t3kn4A6LmzQtuwi9CjGUuIU4xAdP7ykM3qrHdJmiqrKisK 7a7XqlmKENky71h3XaUpfs5A/tlVhtb4kD7oleqCUZ+JWbYou8l/dCA8ie8Nfu+nctEh +sNCwM9yPbcov+Ff97Dg6fQMD6N4n5S4wOWQ/wNlTCiszEAoAnJmAPdFb22888ETnWPP KzUTTTrWbEIlu60Hpt1MxuhhXHLCWAo6w2/d/YabnYMVx/yrM6iQrtenhB1okxFHqg4p rDo9d1NrBzvjQrGMG6qh6xuj/ZO2tuLgt+rp08vuaDn9C6eaa0fR2AmhhitGfChV9KRR TeIg== X-Gm-Message-State: AOAM5310g4s/0NuZ6eItuNRINAcKdcNnCDFPLcBby/Seu80sWZZRPvF9 ra/G5FZP3rOMdkSzFXsrOBEI2g== X-Google-Smtp-Source: ABdhPJw7ofI5jbueMZXenvbdrtCTJqUoJIWkbzb4yngHCY3TUfGWSBMgYm2T5M9G4xte0hL+XeYjmw== X-Received: by 2002:a17:902:bc47:b029:129:dd30:1c30 with SMTP id t7-20020a170902bc47b0290129dd301c30mr5497773plz.4.1625805461468; Thu, 08 Jul 2021 21:37:41 -0700 (PDT) Received: from senozhatsky.flets-east.jp ([2409:10:2e40:5100:a30d:fc4:7834:ee08]) by smtp.gmail.com with ESMTPSA id y4sm4420760pfa.14.2021.07.08.21.37.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jul 2021 21:37:41 -0700 (PDT) From: Sergey Senozhatsky To: Marc Zyngier , Will Deacon Cc: Suleiman Souhlal , Joel Fernandes , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Sergey Senozhatsky Subject: [PATCHv2 3/4] arm64: do not use dummy vcpu_is_preempted() Date: Fri, 9 Jul 2021 13:37:12 +0900 Message-Id: <20210709043713.887098-4-senozhatsky@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210709043713.887098-1-senozhatsky@chromium.org> References: <20210709043713.887098-1-senozhatsky@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210708_213742_232695_6EAD49B8 X-CRM114-Status: GOOD ( 11.87 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org vcpu_is_preempted() now can represent the actual state of the VCPU, so the scheduler can make better decisions when it picks the idle CPU to enqueue a task on. Signed-off-by: Sergey Senozhatsky --- arch/arm64/include/asm/spinlock.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h index 0525c0b089ed..1d579497e1b8 100644 --- a/arch/arm64/include/asm/spinlock.h +++ b/arch/arm64/include/asm/spinlock.h @@ -7,21 +7,23 @@ #include #include +#include /* See include/linux/spinlock.h */ #define smp_mb__after_spinlock() smp_mb() -/* - * Changing this will break osq_lock() thanks to the call inside - * smp_cond_load_relaxed(). - * - * See: - * https://lore.kernel.org/lkml/20200110100612.GC2827@hirez.programming.kicks-ass.net - */ #define vcpu_is_preempted vcpu_is_preempted -static inline bool vcpu_is_preempted(int cpu) + +#ifdef CONFIG_PARAVIRT +static inline bool vcpu_is_preempted(unsigned int cpu) +{ + return paravirt_vcpu_is_preempted(cpu); +} +#else +static inline bool vcpu_is_preempted(unsigned int cpu) { return false; } +#endif /* CONFIG_PARAVIRT */ #endif /* __ASM_SPINLOCK_H */