Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3688146pxb; Mon, 24 Jan 2022 15:24:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJyP14Kb9H4Tt5NqEqE887iKh7xeHdUyFwgQC17YbMBWF22okHA9hsis8Q3vHgUdEn7Uslwp X-Received: by 2002:a17:903:1209:b0:149:a428:19ef with SMTP id l9-20020a170903120900b00149a42819efmr16260836plh.47.1643066647110; Mon, 24 Jan 2022 15:24:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643066647; cv=none; d=google.com; s=arc-20160816; b=A0azPInstAtPYuUEPefJeodLGI/G3MzMd1kqfEFLkYJvAfUD41fCXf0uTvX1Xg+cYs qjJoSDK6RAURQ1dT4JMf7N+e8nv1HR5u9uuV9wyt6CWT/t7rdLeCWpWrX2Pl+Zjx251n 3oBI2T8iDo3kNCmtV3JyS2Cbc+tSjt5BHQuELdJzQW3Rwt06Gi64n4M7YwtUtcCWDljT Act5AngKYsnsRrIOaHC8+B5MNS2bgC1L+T6wd5QXA6LhjAF2QSSDKbBsOmsTtKldk22+ XLzuqK9gzOAPleHHB0RBsKMn23QZd8B3jixdpxZaz/Xy4mQ4w7rRs948TTOzUu3H01tB 1+1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Dq82rTxhxBvlr65w2A2LxY6QpISYac4cCUON/cmECxM=; b=Ldvdx8ESPg4+QJlavDjX6rmQV+BrAd4wTsIEB+g6ldMRAxGjtCsne6jnLw0cGb4MTn ov5sev8KHwhMusYsZsU86ygqYSvm9hz7o1VYMOLiQyzoFQatuJXVvjlIqmOvXpNupMYW VKj+ho1iWYUzQ8Hi06Y2QXhkh98fIeJjhDI09mrq8KlC92wyi6TvFV9+8XhhW+iB8ZON JZGhqqc0Lxl6m0SgB/XrTufJMTaY6+gXasXxvusTNu/GO6kdPUFGj5CDpgQVAtdP0xgT MwPIy3PQTKzQJzpehDudLQGdjie/FgbUilI5yQBpm4aQvzQN5pSPy7NuB0Bp4V7qwqNk 60hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BKwlTzCf; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si1667507pgi.719.2022.01.24.15.23.45; Mon, 24 Jan 2022 15:24:07 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=BKwlTzCf; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1847073AbiAXXSZ (ORCPT + 99 others); Mon, 24 Jan 2022 18:18:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1585996AbiAXWZb (ORCPT ); Mon, 24 Jan 2022 17:25:31 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F30DC08C5DA; Mon, 24 Jan 2022 12:54:15 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id j23so53695316edp.5; Mon, 24 Jan 2022 12:54:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Dq82rTxhxBvlr65w2A2LxY6QpISYac4cCUON/cmECxM=; b=BKwlTzCftZwPf6j/zl1A5IP6JA/uv6iAJ245F7MdeRr53EcaA58eHLhNWC2fEK4KE/ aa7mm4s9YlBHAb2/gxhtizia/ONBaQHnhqZts6FCR+S3k0ZwLd/STZR0P37Eevplq/PY xK3knjKKrSAxGkbWH6ZiECl4cDe0TIh1LV9boZPVyVDrzm4bLPevoYNgWzV6osoPDMl6 eBIeumWpiR56Bw6IHhndLVgqhaz2dzWqHvCfq1SD4nHJOOeneP/PWDHpwcqMIb6VH9Sb OAfAWnKxTtCxjg/umTgwEdIzyucc2fxMoPvsFfXqCFEYG759Bz12biGyXBY+p2BMgrQ7 nzWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Dq82rTxhxBvlr65w2A2LxY6QpISYac4cCUON/cmECxM=; b=z9aSUCSBL0Ny5mXnvQxupA1yucyC6BA9AK9RlfTSlk9zIBzLMc7B59FHHcLfs25URZ p2kW+IlpOBUfW91XSvyfi9uPLioLZs9mDKMkvKmTQKnE6CbpsqU5HyEj4gsa+E9x2RH9 pSwLxRDmFI+zs4JfLxOjFDYoooxVkwj3HiqBs1jf/0ITXpeLtPbn+rjBjUYLMJ0/Ob2H Yd4B9XMljbKbCnkOmlLaiySSIeKhzAJK7DitVgclt3a8jDu6ANreJMCbcOvAhx7UNnKi 3CkBIpiqEZfX5zdBhRch0TjpimfE7RLUuoDGkprc9Nm4qdCYTm0v8r9VT+kbJkms9rVF wMlQ== X-Gm-Message-State: AOAM533oMlygrh48Lq4v9y69y0X0LrTWwRu7Hko+POPRgiVyG2B6CxnR bkh28Ol3AoCpV6sEQTIwUQICO35qszSgJMuV7UE= X-Received: by 2002:a50:cf86:: with SMTP id h6mr17934469edk.82.1643057653792; Mon, 24 Jan 2022 12:54:13 -0800 (PST) MIME-Version: 1.0 References: <20200203053650.8923-1-xiyou.wangcong@gmail.com> In-Reply-To: <20200203053650.8923-1-xiyou.wangcong@gmail.com> From: Yang Shi Date: Mon, 24 Jan 2022 12:54:01 -0800 Message-ID: Subject: Re: [Patch v3] block: introduce block_rq_error tracepoint To: Cong Wang Cc: linux-block@vger.kernel.org, Linux Kernel Mailing List , Jens Axboe , Steven Rostedt Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi folks, I think the problems fixed by this patch still exist and we do need this patch to make disk error handling in rasdaemon easier. I saw Steven already gave his reviewed-by, I'm wondering why this patch was not merged to upstream? I didn't see any unsolved comments. If it looks fine, would Jens (I guess it should go with block tree) please merge this patch upstream? The latest kernel moved blk_update_request() to blk-mq.c, if it is ok to move forward, I could prepare a new version. Thanks, Yang On Sun, Feb 2, 2020 at 11:15 PM Cong Wang wrote: > > Currently, rasdaemon uses the existing tracepoint block_rq_complete > and filters out non-error cases in order to capture block disk errors. > > But there are a few problems with this approach: > > 1. Even kernel trace filter could do the filtering work, there is > still some overhead after we enable this tracepoint. > > 2. The filter is merely based on errno, which does not align with kernel > logic to check the errors for print_req_error(). > > 3. block_rq_complete only provides dev major and minor to identify > the block device, it is not convenient to use in user-space. > > So introduce a new tracepoint block_rq_error just for the error case > and provides the device name for convenience too. With this patch, > rasdaemon could switch to block_rq_error. > > Cc: Jens Axboe > Cc: Steven Rostedt > Signed-off-by: Cong Wang > --- > block/blk-core.c | 4 +++- > include/trace/events/block.h | 41 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 44 insertions(+), 1 deletion(-) > > diff --git a/block/blk-core.c b/block/blk-core.c > index 089e890ab208..0c7ad70d06be 100644 > --- a/block/blk-core.c > +++ b/block/blk-core.c > @@ -1450,8 +1450,10 @@ bool blk_update_request(struct request *req, blk_status_t error, > #endif > > if (unlikely(error && !blk_rq_is_passthrough(req) && > - !(req->rq_flags & RQF_QUIET))) > + !(req->rq_flags & RQF_QUIET))) { > + trace_block_rq_error(req, blk_status_to_errno(error), nr_bytes); > print_req_error(req, error, __func__); > + } > > blk_account_io_completion(req, nr_bytes); > > diff --git a/include/trace/events/block.h b/include/trace/events/block.h > index 81b43f5bdf23..575054e7cfa0 100644 > --- a/include/trace/events/block.h > +++ b/include/trace/events/block.h > @@ -145,6 +145,47 @@ TRACE_EVENT(block_rq_complete, > __entry->nr_sector, __entry->error) > ); > > +/** > + * block_rq_error - block IO operation error reported by device driver > + * @rq: block operations request > + * @error: status code > + * @nr_bytes: number of completed bytes > + * > + * The block_rq_error tracepoint event indicates that some portion > + * of operation request has failed as reported by the device driver. > + */ > +TRACE_EVENT(block_rq_error, > + > + TP_PROTO(struct request *rq, int error, unsigned int nr_bytes), > + > + TP_ARGS(rq, error, nr_bytes), > + > + TP_STRUCT__entry( > + __field( dev_t, dev ) > + __string( name, rq->rq_disk ? rq->rq_disk->disk_name : "?") > + __field( sector_t, sector ) > + __field( unsigned int, nr_sector ) > + __field( int, error ) > + __array( char, rwbs, RWBS_LEN ) > + ), > + > + TP_fast_assign( > + __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; > + __assign_str(name, rq->rq_disk ? rq->rq_disk->disk_name : "?"); > + __entry->sector = blk_rq_pos(rq); > + __entry->nr_sector = nr_bytes >> 9; > + __entry->error = error; > + > + blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, nr_bytes); > + ), > + > + TP_printk("%d,%d %s %s %llu + %u [%d]", > + MAJOR(__entry->dev), MINOR(__entry->dev), > + __get_str(name), __entry->rwbs, > + (unsigned long long)__entry->sector, > + __entry->nr_sector, __entry->error) > +); > + > DECLARE_EVENT_CLASS(block_rq, > > TP_PROTO(struct request_queue *q, struct request *rq), > -- > 2.21.1 >