From patchwork Fri Aug 2 20:01:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13751950 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 81990C52D6F for ; Fri, 2 Aug 2024 20:02:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To: From:Subject:Message-ID:References:Mime-Version:In-Reply-To:Date: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xQLoSNAIlbI381p0LRgfP/Yiv8RuXN9KeorgYSd+JBM=; b=LQEcwdWdxQsu/Eg/bRHYf9u7CU RdaIMp7vi+VXTn0Xpq0hsV0tgrZvBEQ9zP3Apzu2msReBf/ASYfZ3epPkPEZDhVHaZr01uw1CjfyH cUQs1PMzqQFiCZst+shACUZ9bK7B/Wt8QwrsDK3Y4WqUueGS9uhFkWP4LOp6gXww1VhtGyJj0FOqM g7YlQJjUtZGqaVDhj2bp6iV5rUhzathJqh4PA4/Rsaw/WNWi1LJO+O1k5ZIkW9R/HHXOdTg9/iVe7 arp3SaLlqD8p25WJZw28WcFBopGtIiN9vaIY6+Bk/B2coINJYvDG8ZecUTVx3zfJm7ZfswhKD4uAq eYJJ8uTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZyU6-00000009wL9-2Hcz; Fri, 02 Aug 2024 20:02:42 +0000 Received: from mail-pj1-x104a.google.com ([2607:f8b0:4864:20::104a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZyT9-00000009w3K-2Cxf for linux-arm-kernel@lists.infradead.org; Fri, 02 Aug 2024 20:01:44 +0000 Received: by mail-pj1-x104a.google.com with SMTP id 98e67ed59e1d1-2cb63abe6f7so10194461a91.0 for ; Fri, 02 Aug 2024 13:01:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722628901; x=1723233701; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=xQLoSNAIlbI381p0LRgfP/Yiv8RuXN9KeorgYSd+JBM=; b=3dBRLgG3kKPRI9odW2q1pl8C4dBd8zx4Mrq3CQM4lrI2vCRacFiM8J6/VU3YyT6miM ffD6gDBc5Fxr+R/03Jqbqbcy8Tx04Ntp69CblYHqpihhNJs+yd172JXuBUqMnvJvQI+s rYPPdbKR8vKIDBn9SF8WcdYHmLRsASLpgy+7JLQrbOz8z/Ei1Se8qyMyBhBmNHhUx3lD V21RiK1jbxLEyF0FZPo/XQR92GcLNXXG7i23fiD7/Fx3NdXtkVla6ZlMTq/aikI/DDpw U+OjWIjeeWKB193ryOPGa7X1dryyplyLXJJZ0RbXOrG1KdjEKCv1pme2tTSbO6FzzRAb C6Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722628901; x=1723233701; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xQLoSNAIlbI381p0LRgfP/Yiv8RuXN9KeorgYSd+JBM=; b=ofJBTs4QfzdNMV3LhG6h5Ty//PHLkc4lUXXVa+/VsZ8Bvm+ZzZcBR1wnQGVuNQUgTa r1dmeIm0rOVNALOqXhh4wr4x/1B/nW4ya26NDOQptBghc5Dd76mm5AfzowrozbgP7onI 9CEj85lBDe/Cn3LZ2pBME/UBTrTuO1G+qA8R5euXddCIZ3D/fCDX7uYrU7jgMpE9l9Bg uQNIPovl+pFQMXHWBTSeOUN7ZE8DVjiGWTp9O0cbSuG20ihc9KlZZx/MbMozl4AXneFT q32ul96Xm50LxKoC3NDxkBJjlhPcWgIFG81TlosAAWCDocvXIpacml1FYtsmE8FwU+OD mXmQ== X-Gm-Message-State: AOJu0Yxnt/VJOu3tTSU4JVPAy/Fqeh01Icmfss8rr7/xbeJnsV8/5q0Y jnAkQNBIxJHzmdGpJqSNZqKxdb40ZzxS/XtLh+U4S3Ig2+8At35VSuW4ZK2yOWOgnftCHKXZncX +Zw== X-Google-Smtp-Source: AGHT+IFId3HHn5L5fWCDKxPTuecTBLeAk2p3kpSjqAki6o3dAad+BGMQ+YjK6m4jW2ZqIb6OkUGH+CX4xls= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90a:ee94:b0:2c8:9052:58bb with SMTP id 98e67ed59e1d1-2cff93d2bfbmr119920a91.2.1722628901308; Fri, 02 Aug 2024 13:01:41 -0700 (PDT) Date: Fri, 2 Aug 2024 13:01:35 -0700 In-Reply-To: <20240802200136.329973-1-seanjc@google.com> Mime-Version: 1.0 References: <20240802200136.329973-1-seanjc@google.com> X-Mailer: git-send-email 2.46.0.rc2.264.g509ed76dc8-goog Message-ID: <20240802200136.329973-2-seanjc@google.com> Subject: [PATCH 1/2] KVM: Return '0' directly when there's no task to yield to From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Paolo Bonzini Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Christopherson , Steve Rutherford X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240802_130143_584264_D2C46ED2 X-CRM114-Status: GOOD ( 12.71 ) 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: , Reply-To: Sean Christopherson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Do "return 0" instead of initializing and returning a local variable in kvm_vcpu_yield_to(), e.g. so that it's more obvious what the function returns if there is no task. No functional change intended. Signed-off-by: Sean Christopherson --- virt/kvm/kvm_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index d0788d0a72cc..91048a7ad3be 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -3932,7 +3932,7 @@ int kvm_vcpu_yield_to(struct kvm_vcpu *target) { struct pid *pid; struct task_struct *task = NULL; - int ret = 0; + int ret; rcu_read_lock(); pid = rcu_dereference(target->pid); @@ -3940,7 +3940,7 @@ int kvm_vcpu_yield_to(struct kvm_vcpu *target) task = get_pid_task(pid, PIDTYPE_PID); rcu_read_unlock(); if (!task) - return ret; + return 0; ret = yield_to(task, 1); put_task_struct(task);