From patchwork Sun Apr 1 10:36:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 893977 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40DX2Y66hZz9s1c for ; Sun, 1 Apr 2018 20:41:09 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iSoKs/Bo"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40DX2Y4GvxzF216 for ; Sun, 1 Apr 2018 20:41:09 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iSoKs/Bo"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::244; helo=mail-pl0-x244.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iSoKs/Bo"; dkim-atps=neutral Received: from mail-pl0-x244.google.com (mail-pl0-x244.google.com [IPv6:2607:f8b0:400e:c01::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40DWxF2C48zF20w for ; Sun, 1 Apr 2018 20:36:33 +1000 (AEST) Received: by mail-pl0-x244.google.com with SMTP id 61-v6so559430plb.2 for ; Sun, 01 Apr 2018 03:36:33 -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; bh=frJArl1G35L5ymBmGEFR/pp919Gxl4TtnXQictngwTM=; b=iSoKs/BoyqnCN3Q3pLwAZHXILV1XqeazGhN76Ul/SVK/+AoPe9SLN6YMuyUT8U/Ps4 vZCu58Q6a+jo0VAw7D75G2PNqZz5B/c9dswzsS9MwC39R8dllrMXturCb6zEF2s3tXH1 146Hg0HvxC265qxrmDQ/FXvm76+e45pvY9iNUO13iH+4W3wHYfpVmgUUx/bN/i1A1237 NuNnaQ8luYs63UIuCu+3PoFvw9pXp1sW0uZbFcyq5XOYu34OO5rcP/I+4urJrRX/xUAM 9JlBA6EQhHmpObVxfSvf3DCsbMcRQaOdiyXIkqJN3YbVkrxtJ+7QhB1qGJgMh8u7py2Q 5d5Q== 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; bh=frJArl1G35L5ymBmGEFR/pp919Gxl4TtnXQictngwTM=; b=ew7vbekoEEi+1PAzRv733avh8QNa7E9PGGNCORrrRX9iGBMFpEcKgZUP0OwGEvPbC5 ugWq7txz7BAhpYgp8OU1rq6ZZ64UpJMvwhHCs8ypjrBJRBtaN1eR5Og5OWFOajMZhfqg XT13F0vcPfQbluDn6xab6UmvbUJhSyk6aiWvxuHzM7YFnqWYKuiIp3BJNkltTIIrEXDQ kdlYM7FuJkwx/qI5eeQeo1diDpyR+kbXP9CmhtYD+VXW37xmuZywZT/k0yWWbzq3f2l4 +plGP8PhahbxlkpsJqW6CP8n6f8kgDuIqPCHuTSbn4cCgsF/NbzM63m1v3TspA4ybMhI zWKg== X-Gm-Message-State: AElRT7Ga8VKIprPGRkvBieqG+lgYFtKjRKYKWBKjSN4RyZt4ZcuJ1Shy ehkwd/VPWw/egykjdereF1FGKw== X-Google-Smtp-Source: AIpwx4/KxocepIhZz6ZYpeNHpfvOHC5F+UF9r/QNakvRlxKJUWweJiQuB3exNHSCuWOmL5cCgzoqHg== X-Received: by 2002:a17:902:4001:: with SMTP id b1-v6mr5764099pld.273.1522578991212; Sun, 01 Apr 2018 03:36:31 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id d83sm26977486pfl.176.2018.04.01.03.36.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Apr 2018 03:36:30 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 1/3] powerpc: use NMI IPI for smp_send_stop Date: Sun, 1 Apr 2018 20:36:13 +1000 Message-Id: <20180401103615.15454-2-npiggin@gmail.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180401103615.15454-1-npiggin@gmail.com> References: <20180401103615.15454-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasant Hegde , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Use the NMI IPI rather than smp_call_function for smp_send_stop. Have stopped CPUs hard disable interrupts rather than just soft disable. This function is used in crash/panic/shutdown paths to bring other CPUs down as quickly and reliably as possible, and minimizing their potential to cause trouble. Avoiding the Linux smp_call_function infrastructure and (if supported) using true NMI IPIs makes this more robust. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/smp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index cfc08b099c49..db88660bf6bd 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -565,7 +565,11 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) } #endif +#ifdef CONFIG_NMI_IPI +static void stop_this_cpu(struct pt_regs *regs) +#else static void stop_this_cpu(void *dummy) +#endif { /* Remove this CPU */ set_cpu_online(smp_processor_id(), false); @@ -577,7 +581,11 @@ static void stop_this_cpu(void *dummy) void smp_send_stop(void) { +#ifdef CONFIG_NMI_IPI + smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, stop_this_cpu, 1000000); +#else smp_call_function(stop_this_cpu, NULL, 0); +#endif } struct thread_info *current_set[NR_CPUS];