Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1075991rwn; Thu, 8 Sep 2022 13:03:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR62Hx0lXNx+tycbVSI/TbYRM/tLBP9XAniV8hwdNSBAAZDf7pOO4tdQ7JynHWQmIVmM7VVr X-Received: by 2002:a2e:808f:0:b0:26a:b498:2c87 with SMTP id i15-20020a2e808f000000b0026ab4982c87mr3038547ljg.279.1662667399728; Thu, 08 Sep 2022 13:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662667399; cv=none; d=google.com; s=arc-20160816; b=p2Q1MySNyh4RrSYJMB82CtfJja5d7n2gp1E8awi5JFb+/35ETtFgf3LsLehSokKXZO dFFV0jbCm0kPczPVsqYxNvNH+JpFccU30wIUIez0jEF3h+LBQ285+RPaJ6tXko3Z9LV2 bU4n2FkAfTYkVx23N0fXSC/WQ6qEUWKv2wZs1EXQZBKoj/d/cmvASoqoi1OkwxpITayw DgqsAl/ws/fP1WT5nit5J/LILiAq2cYhECmHxB1Y2VTMvhSGBZhJZ0vjO7cruSV09MYE iU9Uxks0ZhEI8684sABW6BzFnPR4OMrvOBZqhCATJw8d+qQJskyF54P8QwV+EhykA8mx MkvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=N67gQ2stRWxvjqfXz9K3AlWY+C92r6fHBrkzUs9pLqs=; b=PlgVSWli5poUOfYw131uPmgP4bqXqYjiKaHNk6+YfihE1MB2v7geyeAl1FVleC1cAX Zmztn5d/Un1SLhW+kx7dEkIp9FaB/Zm3dpuSn0128Q2J40JMhh6y3X8NzGfjHFdQ8XZc /RzzkiiZ6gW44w9JgB3O8J1PP3Jd+Cf1XlBfIAg0YzhpBREObiLlEtj9YpXwO7XbDyWM pmpWWTJ22dp/FwoDEuKcMN3AX0brjnjT0kX2O5h2p7iq4drnwO/a/PKPTEpWUPKgYvKv 8HZP7kjGVQSpPGnMZwZd5xPQPKQ6mtLqjqisPeEIS/b+xUFzLiYGH8CqZNBnLDt5obu6 RmRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Co6dkypu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a12-20020a056512374c00b00494736b2f00si8327479lfs.432.2022.09.08.13.02.49; Thu, 08 Sep 2022 13:03:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Co6dkypu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229710AbiIHT51 (ORCPT + 99 others); Thu, 8 Sep 2022 15:57:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbiIHT5V (ORCPT ); Thu, 8 Sep 2022 15:57:21 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3986EC746 for ; Thu, 8 Sep 2022 12:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662667039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=N67gQ2stRWxvjqfXz9K3AlWY+C92r6fHBrkzUs9pLqs=; b=Co6dkypuTdSVukUFYt2C3Q28Onke/zFEl/M3GX9W2MDj3WmmRVS3L0kRnBfC0fmIC32W+A SgSB8HdPKK+KLBwy/yFvYJGXtYltMlUN6en+pFTzmUjp7k2Ln8AocHOr12WJgshEAODDpU adRYPGPZeFCpYaL87xbBi+pXdTMrpAo= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-554-sRHX6peHPD2Jw5Q--Fz5Ug-1; Thu, 08 Sep 2022 15:57:16 -0400 X-MC-Unique: sRHX6peHPD2Jw5Q--Fz5Ug-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5D3973C0CD54; Thu, 8 Sep 2022 19:57:16 +0000 (UTC) Received: from fuller.cnet (ovpn-112-2.gru2.redhat.com [10.97.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E0F2909FF; Thu, 8 Sep 2022 19:57:16 +0000 (UTC) Received: by fuller.cnet (Postfix, from userid 1000) id 230D9415CD60; Thu, 8 Sep 2022 16:54:07 -0300 (-03) Message-ID: <20220908195111.710559374@redhat.com> User-Agent: quilt/0.66 Date: Thu, 08 Sep 2022 16:29:01 -0300 From: Marcelo Tosatti To: linux-kernel@vger.kernel.org Cc: Frederic Weisbecker , Juri Lelli , Daniel Bristot de Oliveira , Prasad Pandit , Valentin Schneider , Yair Podemsky , Thomas Gleixner , Marcelo Tosatti Subject: [RFC PATCH 2/7] introduce smp_call_func_single_fail References: <20220908192859.546633738@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce smp_call_func_single_fail, which checks if the target CPU is tagged as a "block interference" CPU, and returns an error if so. Signed-off-by: Marcelo Tosatti Index: linux-2.6/include/linux/smp.h =================================================================== --- linux-2.6.orig/include/linux/smp.h +++ linux-2.6/include/linux/smp.h @@ -50,6 +50,9 @@ extern unsigned int total_cpus; int smp_call_function_single(int cpuid, smp_call_func_t func, void *info, int wait); +int smp_call_func_single_fail(int cpuid, smp_call_func_t func, void *info, + int wait); + void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func, void *info, bool wait, const struct cpumask *mask); Index: linux-2.6/kernel/smp.c =================================================================== --- linux-2.6.orig/kernel/smp.c +++ linux-2.6/kernel/smp.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "smpboot.h" #include "sched/smp.h" @@ -782,6 +783,30 @@ int smp_call_function_single(int cpu, sm } EXPORT_SYMBOL(smp_call_function_single); +/* + * smp_call_func_single_fail - Run a function on a specific CPU, + * failing if any target CPU is marked as "no ipi". + * @func: The function to run. This must be fast and non-blocking. + * @info: An arbitrary pointer to pass to the function. + * @wait: If true, wait until function has completed on other CPUs. + * + * Returns 0 on success, else a negative status code. + */ +int smp_call_func_single_fail(int cpu, smp_call_func_t func, void *info, + int wait) +{ + int err; + + block_interf_assert_held(); + if (block_interf_cpu(cpu)) + return -EPERM; + + err = smp_call_function_single(cpu, func, info, wait); + + return err; +} +EXPORT_SYMBOL(smp_call_func_single_fail); + /** * smp_call_function_single_async() - Run an asynchronous function on a * specific CPU.