Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp145972pxk; Thu, 24 Sep 2020 01:44:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUNolZTTM8avOf0mjg+lLw1p3v645gq1JiE6Z/hCPUAHwpCAOvf/baPSr8OlMQUkVG/t4e X-Received: by 2002:a05:6402:184d:: with SMTP id v13mr3578957edy.240.1600937061818; Thu, 24 Sep 2020 01:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600937061; cv=none; d=google.com; s=arc-20160816; b=MIfuvY9LjYesWZm9VeDdIrRX2pafZngjqoMWm9nuQq7pNfeRaeMLN2lsC5dp24BiX2 jNHZRq8+AAsvT/dRllerNjpp8Eh1cBdHk+ziuX3WB7qRKX2HWsDhPzP4Ylmvz8GsBV/k GATOIVGrQCLNkBqQ0pAdqU4mwiueq422uzwUY1eww75txvOQoBdCwDbustKvKGn8heNy OJBYvO9M2oyEFECpPDFV63Z4MbZmNKZVyyZ0okalxw5EZvnejJoTmmXYm/SA5BTFzl4E WAtVxqGaQtmrA6qADwVF0csrp7SXEhIye4Ydfalre5GPNn7U0mWzBE9eufHNhcA27ae3 6lEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=AmLdOkb/yCyJ7hMIvjfhSvkdGbRLKyfV9cffahTR+Ss=; b=Ud4jkl6BW3Xq07Fn2tKkS6icIouWJwm3Cpk9GDppJYKA0tpl0nByxS//5g/RjeiVDK 19lfFP6+r12tlbh4CjRyOxPNRgqUgSRbaa/nDSMo9R5EanjXQIcvOGKDjhVz/cjHysvu Sr8ddtNq1rKAa0WClqNImb69MDO0V2WZjpHYd3qz80S0TO59zmRqWd91z3K2A0+IdhW1 /+FF45r/sffeA8WYwpdSZOE0ghUhCfy8ojZTBOEFc4opeQWdE43XsA/KxTx0ftXcJVOx 6aUzlcP85go8H6R5S0XZ0r9KpJwnXeuwzYi5m3kBawsk4ILU1uRNS3XlxAFjnBw7FkhC FdLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=HL3wO9Ut; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si1535308ejt.59.2020.09.24.01.43.58; Thu, 24 Sep 2020 01:44:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=HL3wO9Ut; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbgIXIm1 (ORCPT + 99 others); Thu, 24 Sep 2020 04:42:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726799AbgIXIm1 (ORCPT ); Thu, 24 Sep 2020 04:42:27 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7888C0613CE for ; Thu, 24 Sep 2020 01:42:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=AmLdOkb/yCyJ7hMIvjfhSvkdGbRLKyfV9cffahTR+Ss=; b=HL3wO9Ut0OmkoOnmfnuEWboDNI VRzaAYwD3oypZ2IxtTbnxHHSnpa8YrXFatpkfE+kbqo4qALDN4vcwnd0Kb+G/3ECC4WEWVEJUMae7 ofOsekkZt576zrw0WdWrV+f5ihkhC7FE6GwJ/RqTd5RZqBFtcNXSnPjIA39FwWs80k2oalABb/VP4 wE+YBDxqZ6IY6O9pBam/HfqFExk3DMYbTP76G7iNmdba+CS2DE7GbNacRsTuDR/53nPNpDwYcXel3 ZYcQEEE7Ve0oi9aweTlIrQEWS0vVDViHT2XmdNMuqcav2hq8zhLMyxB2MGlU8uLJr0WGp2USlyok9 7uMjfRNw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLMpU-0008Bt-Cr; Thu, 24 Sep 2020 08:42:16 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id DB41C303DA0; Thu, 24 Sep 2020 10:42:15 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B6F142BC141E8; Thu, 24 Sep 2020 10:42:15 +0200 (CEST) Date: Thu, 24 Sep 2020 10:42:15 +0200 From: peterz@infradead.org To: George Prekas Cc: Ingo Molnar , Thomas Gleixner , Sebastian Andrzej Siewior , Peter Xu , Kaitao Cheng , Subject: Re: [PATCH] latency improvement in __smp_call_single_queue Message-ID: <20200924084215.GD1362448@hirez.programming.kicks-ass.net> References: <281da382-4511-e1df-6917-154a5914dd43@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <281da382-4511-e1df-6917-154a5914dd43@amazon.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 23, 2020 at 10:00:41AM -0500, George Prekas wrote: > If an interrupt arrives between llist_add and > send_call_function_single_ipi in the following code snippet, then the > remote CPU will not receive the IPI in a timely manner and subsequent > SMP calls even from other CPUs for other functions will be delayed: > > ??? if (llist_add(node, &per_cpu(call_single_queue, cpu))) > ??????? send_call_function_single_ipi(cpu); > > Note: llist_add returns 1 if it was empty before the operation. > > CPU 0?????????????????????????? | CPU 1???????????????????? | CPU 2 > __smp_call_single_q(2,f1)?????? | __smp_call_single_q(2,f2) | > ? llist_add returns 1?????????? |?????????????????????????? | > ? interrupted?????????????????? |?? llist_add returns 0???? | > ????? ...?????????????????????? |?? branch not taken??????? | > ????? ...?????????????????????? |?????????????????????????? | > ? resumed?????????????????????? |?????????????????????????? | > ? send_call_function_single_ipi |?????????????????????????? | > ??????????????????????????????? |?????????????????????????? | f1 > ??????????????????????????????? |?????????????????????????? | f2 > > The call from CPU 1 for function f2 will be delayed because CPU 0 was > interrupted. Do you happen to have any actual numbers and a use-case where this was relevant?