From patchwork Wed Aug 11 05:48:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1515589 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=WTszGok4; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GkzR70CLpz9sWc for ; Wed, 11 Aug 2021 15:49:23 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4GkzR66CZzz3bT2 for ; Wed, 11 Aug 2021 15:49:22 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=WTszGok4; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1029; helo=mail-pj1-x1029.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=WTszGok4; dkim-atps=neutral Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4GkzQn70Xqz30gd for ; Wed, 11 Aug 2021 15:49:05 +1000 (AEST) Received: by mail-pj1-x1029.google.com with SMTP id mq2-20020a17090b3802b0290178911d298bso2929722pjb.1 for ; Tue, 10 Aug 2021 22:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LlErCfCrC+/ah0CQZ9kn+MmNJYgWTlY6EePAMO5Mwqw=; b=WTszGok43fT4/GEd0CCSs2+Bdkn/WlxnlTLWM11mkpqFfJ93sD3rPpVaNVNwNT5/nf TkZyCu9RpAR5cXlP4i0xcQAJW3AszfymZiUBtdS1ZrYxY9B1KIOTp338r7VZOSrJbjPt UFa/W6ZnI5VjpL992d3AA3ICKU10yLsNlr+/UoTMKG3uYm7OT3/uGe3NjC6Ly6Tn/ynP 60Dgj+virMyY/pbUspwzd9qbBQouqvk/aPrIX6d5aZob4DAbg3q4a/2JADRHIwetXw9j lDDNl4sPShiko9FUluh+DJosMmIP4n9r88zVYh33qwwIeuF0zLLrRznEU3HCugdPMj2u MTmA== 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=LlErCfCrC+/ah0CQZ9kn+MmNJYgWTlY6EePAMO5Mwqw=; b=d6mvWyynJvV+97eJJFLQTss4oyS333ZwcHBsnBecbOeCX8F5Jn/9e1Zm9Tjl/Y/JUE yekDUFEXfLeFkiPMvUKKC5iLX0GOfTGlm+wnHghVkPkiZMPxuRdovj+yd5cqE01ceVIB OvNsgikJQjxNPaPHto4v3JWkwe9O8yW60BLV1B0YJlp+OF6/kvM9LqEIgce0TlHvDEPN ilsuStL1NBbf02GWKvPDhB62gWFwExTy/kdPMuaz1lMTBmL+armqLFRvuTndR+gmw04q YBzMXiCOCGQaW/c6wXWrO56zgmSdetQQMJKcMhi8GUPngwRSk6WJBcyVBq41AzULmek9 sfcw== X-Gm-Message-State: AOAM533OOAePzTQ5DBq8Mu0NqK/Jo5jt/402pN7tCx81TPMIfAu4xQUf I9bRpni7B3ADNNsL/Zi7z13ScwmMk2A= X-Google-Smtp-Source: ABdhPJwE9foMwHShgqiaBsYEXnDV+9nPL/PMt6ayczpPAO9z4Gb2kl+rXUcy/L39NKaf4GMYSEJ9FQ== X-Received: by 2002:a63:4c0d:: with SMTP id z13mr77609pga.0.1628660943848; Tue, 10 Aug 2021 22:49:03 -0700 (PDT) Received: from bobo.ibm.com ([118.210.97.79]) by smtp.gmail.com with ESMTPSA id q1sm1222317pjl.44.2021.08.10.22.49.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 22:49:03 -0700 (PDT) From: Nicholas Piggin To: skiboot@lists.ozlabs.org Date: Wed, 11 Aug 2021 15:48:48 +1000 Message-Id: <20210811054851.861482-4-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210811054851.861482-1-npiggin@gmail.com> References: <20210811054851.861482-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Skiboot] [PATCH v1 3/6] core/cpu: refactor IPI sending X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Pull the IPI sending code into its own function where it is used in two places. cpu_wake() already checks in_idle, so its caller does not need to check pm_enabled. Signed-off-by: Nicholas Piggin --- core/cpu.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/core/cpu.c b/core/cpu.c index 940b02ce4..d77ab7c93 100644 --- a/core/cpu.c +++ b/core/cpu.c @@ -90,13 +90,8 @@ void __nomcount cpu_relax(void) barrier(); } -static void cpu_wake(struct cpu_thread *cpu) +static void cpu_send_ipi(struct cpu_thread *cpu) { - /* Is it idle ? If not, no need to wake */ - sync(); - if (!cpu->in_idle) - return; - if (proc_gen == proc_gen_p8) { /* Poke IPI */ icp_kick_cpu(cpu); @@ -105,6 +100,14 @@ static void cpu_wake(struct cpu_thread *cpu) } } +static void cpu_wake(struct cpu_thread *cpu) +{ + /* Is it idle ? If not, no need to wake */ + sync(); + if (cpu->in_idle) + cpu_send_ipi(cpu); +} + /* * If chip_id is >= 0, schedule the job on that node. * Otherwise schedule the job anywhere. @@ -189,8 +192,7 @@ static void queue_job_on_cpu(struct cpu_thread *cpu, struct cpu_job *job) cpu->job_has_no_return = true; else cpu->job_count++; - if (pm_enabled) - cpu_wake(cpu); + cpu_wake(cpu); unlock(&cpu->job_lock); } @@ -597,16 +599,9 @@ static void reconfigure_idle_start(void) */ sync(); - if (proc_gen == proc_gen_p8) { - for_each_available_cpu(cpu) { - if (cpu->in_sleep || cpu->in_idle) - icp_kick_cpu(cpu); - } - } else if (proc_gen == proc_gen_p9 || proc_gen == proc_gen_p10) { - for_each_available_cpu(cpu) { - if (cpu->in_sleep || cpu->in_idle) - p9_dbell_send(cpu->pir); - } + for_each_available_cpu(cpu) { + if (cpu->in_sleep || cpu->in_idle) + cpu_send_ipi(cpu); } smt_lowest();