Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1361264pxb; Thu, 14 Apr 2022 04:38:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwd/hIw38EPAY9BRI5+W4H4NYX51CPtcV8zOI3tmMXqNxirIV+WOtpI1WJsGW7DHXPJr2UF X-Received: by 2002:a17:90a:db08:b0:1c9:7cf3:6363 with SMTP id g8-20020a17090adb0800b001c97cf36363mr3259992pjv.35.1649936335262; Thu, 14 Apr 2022 04:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649936335; cv=none; d=google.com; s=arc-20160816; b=L7h+ZO6geIU4v2i0lAnFE1bwCA867XUF90Fyb68Hcktt6+PPgL0EAQB+9vrF9eiKIP Zpvi4d9L37LQs/qbBRZ9MhCHk9YlpMk/+CmO6+8627lOobkbg+lujN5Jst4I/tDpffSz +1rCuymszM7V+9FdiNiNG62OD75DsR2RrCP44Qb0gk3iLqKjUIQjRZ03JAD84O20jYF5 J0PYyXLP1nhQkWhYUh+7ab1MqawpxHIRJF3K5BCLUMfjZy60ZJ7iLQC3PEtkACpODGyE wFTwh5VidldcEabDS0WG4CP7jMGMZupRm/njetJjtQBqyYN3kL4sq7J5BJ5PL674X468 6FAA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1gnVKcslmL9jjdvWv9rXEVHSWDeQjeOFVmI2MFK5p+k=; b=plfMlMbG6gWTAhZZJjvzSSvXr+fKcPxp03Lv6/G65Z6+VNzRZpfOpS4rQG5Icg++kZ rep+qaGkWrFT/FLi5ThqeVWNFLNLwuDSapr/rsnccCi3ERFe6XxFZj5qTfQMqNGQZZ3x A1tolzWecEeJlgUhd2jAfOBp5TurkWfojsxwQ3VbsjTuRq1T3U+ejhQ+jiyrf+gqK/GJ ZnUOtpckWIryIg7DturV3F8PRXnlOpAcBfQkrCVVqSWdW8rTICsb/JfNAJvw0RLNamKF aRoa5qiC9Jh8q3e72mrH2vJoLv29OafBThsKtO13A8plek93nSxlOjX2coUj9xEBhWh3 MW9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=D6crr4sO; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q10-20020a170902f78a00b001569d19531fsi16221030pln.588.2022.04.14.04.38.42; Thu, 14 Apr 2022 04:38:55 -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=@infradead.org header.s=desiato.20200630 header.b=D6crr4sO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239829AbiDNJeg (ORCPT + 99 others); Thu, 14 Apr 2022 05:34:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233401AbiDNJef (ORCPT ); Thu, 14 Apr 2022 05:34:35 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AE6C6E574 for ; Thu, 14 Apr 2022 02:32:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=1gnVKcslmL9jjdvWv9rXEVHSWDeQjeOFVmI2MFK5p+k=; b=D6crr4sOv+1HkELGgdRMFLXlIZ Q8yOUQtUVuePMl/TeHNBnmfoRJV2cGP06LHk6I5P4ybDda2tSABoTvdB8drghMfFtqIyRxPc8xhQs RMWWYKuR+q3HkiJBVeNyrAyGeyhsRROAwdLnR0TalQRH5vMDuBzHB4DvFwW3t9SCKDkuJ0/InhJT3 faLjB6i4cS+mlAT0sG1WL/LY47a8Y72jIp3DPej8Hcj5kVYUtFz41ZbaZEsPeiHKprGyLNKgY1Ogd AKZWF+ImWpxpOb+nJdj6YorxvNI06YiR2DE/4C6yBqc823Q+UkZCkJgfdlmsHW8V+rZch1QBFORtI XgECsyLQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nevpe-004yVm-Cz; Thu, 14 Apr 2022 09:32:06 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (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) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 59E1230031E; Thu, 14 Apr 2022 11:32:04 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 1723C2B3A873C; Thu, 14 Apr 2022 11:32:04 +0200 (CEST) Date: Thu, 14 Apr 2022 11:32:04 +0200 From: Peter Zijlstra To: Zqiang Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] irq_work: Add event-tracing points for irq_work Message-ID: References: <20220414063829.2472251-1-qiang1.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220414063829.2472251-1-qiang1.zhang@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 On Thu, Apr 14, 2022 at 02:38:29PM +0800, Zqiang wrote: > Add irq_work_queue_on tracepoints allow tracing when and how > a irq-work is queued, irq_work_execute_start/end tracepoints > allow know when a irq-work is executed and the executed time. Yeah, but why? > diff --git a/kernel/irq_work.c b/kernel/irq_work.c > index 7afa40fe5cc4..edad992556d0 100644 > --- a/kernel/irq_work.c > +++ b/kernel/irq_work.c > @@ -22,6 +22,9 @@ > #include > #include > > +#define CREATE_TRACE_POINTS > +#include > + > static DEFINE_PER_CPU(struct llist_head, raised_list); > static DEFINE_PER_CPU(struct llist_head, lazy_list); > static DEFINE_PER_CPU(struct task_struct *, irq_workd); > @@ -81,7 +84,9 @@ static void __irq_work_queue_local(struct irq_work *work) > bool rt_lazy_work = false; > bool lazy_work = false; > int work_flags; > + int cpu = smp_processor_id(); > > + trace_irq_work_queue_on(cpu, work); That's not very nice, you made this function more expensive for no reason. And you violated coding style while doing it :/ > work_flags = atomic_read(&work->node.a_flags); > if (work_flags & IRQ_WORK_LAZY) > lazy_work = true; > @@ -143,7 +148,7 @@ bool irq_work_queue_on(struct irq_work *work, int cpu) > if (cpu != smp_processor_id()) { > /* Arch remote IPI send/receive backend aren't NMI safe */ > WARN_ON_ONCE(in_nmi()); > - > + trace_irq_work_queue_on(cpu, work); > /* > * On PREEMPT_RT the items which are not marked as > * IRQ_WORK_HARD_IRQ are added to the lazy list and a HARD work > @@ -208,7 +213,9 @@ void irq_work_single(void *arg) > smp_mb(); > > lockdep_irq_work_enter(flags); > + trace_irq_work_execute_start(work); > work->func(work); > + trace_irq_work_execute_end(work); > lockdep_irq_work_exit(flags); > > /*