From patchwork Fri Dec 17 02:17:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1569673 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=20210112 header.b=YQeKvLiE; dkim-atps=neutral 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=) 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) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JFXh00CRyz9t2p for ; Fri, 17 Dec 2021 13:17:52 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JFXgx1QZcz3c8R for ; Fri, 17 Dec 2021 13:17:49 +1100 (AEDT) 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=20210112 header.b=YQeKvLiE; 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::435; helo=mail-pf1-x435.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=20210112 header.b=YQeKvLiE; dkim-atps=neutral Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) (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 4JFXgn34CWz3036 for ; Fri, 17 Dec 2021 13:17:41 +1100 (AEDT) Received: by mail-pf1-x435.google.com with SMTP id v13so958637pfi.3 for ; Thu, 16 Dec 2021 18:17:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3BrBYpgfyA39hRVoc2stISZK2wALw7I4OmQeX4nysq4=; b=YQeKvLiEPYA0YLb8GydsvuI7AiWMPrHdVdfYVlDsIt2dFUG4wlcW9T8y8WNwdmaxPH T4B6wMh2DlAavarF26cwMbuG7kwNQ9igK5NIAnBZzuKbbN1v64lZVsaKP/dZPaOi5dE4 NMDcSjRtI7QaxumTJOmgLQcN9J33gRKPNMslz0TKICd+KqAPynzm96knyV1kdccJOJJk pCX0bhTmfkfdQ/tYWh2E4dZHrtVpKqzkOC/PHtz13STV6/zj6Iq4uDyY0IBz7BObuSrA ZmqJjtysouZgzSGueoz0a66tidHjJvutaCYPPCXbiPcvzR+PjJOvepGM17QOet17LVr8 vgSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3BrBYpgfyA39hRVoc2stISZK2wALw7I4OmQeX4nysq4=; b=A57gyYY28+oD5r8ggH/0+DPq4jIPVsDjfaOku7DyhWaEv54Efp1j0vnRwjVmdl2w+X fZWV2RKSXGShr0Py9hMzKgZp+GCM1/nmuyOpsatLso2GmQi30yb2fSfQderymC4PTeBZ RKWiJ5kWgjoyA1ViYYUsRh+0ajsv2OTyIDKeUPWawItXzskwXw/kBCBMPPHYYXQAeL7V 9KziNE5g+pFdSPSO+WAS5jZdqhZ7cb0C73kVzh3PzM5iQhnwl67w8s7cSYJ2C9dOTIQm HvOTVH1BF3IJziBsGY2+d96rZ+I5RvKTifRwe1BnFiKTmsmaLIrB5TCSK7TEDuxKzUFg oO9g== X-Gm-Message-State: AOAM532YxF0XRbqdJO03Mfh6vLm/Auq9dnEDpcbZyIlHIKNz6HEMeKjq nnv51POAR8/n75/nh6DWz2HohvWEzjw= X-Google-Smtp-Source: ABdhPJzUlA8LqjK6icSONm6jP1DTGdCdD6D33aB/VamW7ChU6caKlc5sJLer7pu8tBuPtE3LTE2T0w== X-Received: by 2002:a63:215e:: with SMTP id s30mr911443pgm.474.1639707459192; Thu, 16 Dec 2021 18:17:39 -0800 (PST) Received: from bobo.ozlabs.ibm.com (203-219-139-206.static.tpgi.com.au. [203.219.139.206]) by smtp.gmail.com with ESMTPSA id k16sm7982639pfu.183.2021.12.16.18.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 18:17:38 -0800 (PST) From: Nicholas Piggin To: skiboot@lists.ozlabs.org Date: Fri, 17 Dec 2021 12:17:21 +1000 Message-Id: <20211217021724.709370-4-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20211217021724.709370-1-npiggin@gmail.com> References: <20211217021724.709370-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Skiboot] [PATCH v2 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 20b3f6af3..e915d44fe 100644 --- a/core/cpu.c +++ b/core/cpu.c @@ -96,13 +96,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); @@ -111,6 +106,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. @@ -195,8 +198,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); } @@ -607,16 +609,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); } /*