Received: by 10.213.65.68 with SMTP id h4csp479061imn; Tue, 27 Mar 2018 03:08:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELscOesv5SSnop041PENKCpUkFa0ZC+0xG/pyidT9xNZfh4R3wOmuH5n1USua6Wdmx3mJybG X-Received: by 2002:a17:902:6001:: with SMTP id r1-v6mr44327651plj.330.1522145315933; Tue, 27 Mar 2018 03:08:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522145315; cv=none; d=google.com; s=arc-20160816; b=0y4vBQ/zT4CypFaYWe2I9ZU+rNR+UuFNSZnIe25SIJb5fcEAPGzdUfTMftBG5rVTOy +pgj53/AMoea3XFm+CyTQ9EeoYNnLnfL/FB69Fb7spixooYZ8TZpqLBwYU1Ok3DuOyuH +cO62tw7h6peXyBHA4tZPiGcVFofmy8liLVdrPM/b9mz1Dn8dIPtZrLBHiPY5UC0OhoM UhH91wUpXK6h/8n1sY8GI/01HCmu8bfkR3ha5CeT5NpXQ1x5RvAXjHVv/P5ij1xAIqMu LoVRZT9zKxbEY6gRUHdt4x/rqZdw2BD+CLmhwQ/TbOGFHpDhJO9uYejDqeJFob1fSQuD zDKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=tfWAlQyDwD+hqs3mv+5O64l3m3ATAvqaeZ3klhNuEhs=; b=UqUoqfGqnT50xwu4ZV99DnsuJcIrdugiR5XkQUx+5B6KszFJrcD6OiLNe1igIDMMa0 u0TMx+/nPUCM9shqQOFM3u1L5qhx1vGJHtbpUONhYUdq39IaddN8UNxDidjkJw6qrwRk fxhWTkDq4Nw+F50/AtfAi0GSKKsK6evsfH60iDtb+ZC1+3nQ9Hg6sYn+a0sjtbE3e6Zn EkP7dCuT7COQU0a+wkW50NplPmyt0UwTMbBj/l/iXPh79WJMAbfYJYZTDkk7uXXx5Xv9 jK3yBrMXarVBxNEs6Z1tx3TXIcs1shYs9YjZ/qgBC32ey5+dZI7vvfOF23mptGf00BdY 49yg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a91-v6si967321pla.524.2018.03.27.03.08.21; Tue, 27 Mar 2018 03:08:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752190AbeC0KHa (ORCPT + 99 others); Tue, 27 Mar 2018 06:07:30 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34908 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750978AbeC0KH1 (ORCPT ); Tue, 27 Mar 2018 06:07:27 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id 46B737705F; Tue, 27 Mar 2018 10:07:26 +0000 (UTC) Received: from gondolin (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DC2D6353E; Tue, 27 Mar 2018 10:07:25 +0000 (UTC) Date: Tue, 27 Mar 2018 12:07:23 +0200 From: Cornelia Huck To: Dong Jia Shi Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, borntraeger@de.ibm.com, pasic@linux.vnet.ibm.com, pmorel@linux.vnet.ibm.com Subject: Re: [PATCH 4/4] vfio: ccw: add traceponits for interesting error paths Message-ID: <20180327120723.192f7577.cohuck@redhat.com> In-Reply-To: <20180327075114.GK12194@bjsdjshi@linux.vnet.ibm.com> References: <20180321020822.86255-1-bjsdjshi@linux.vnet.ibm.com> <20180321020822.86255-5-bjsdjshi@linux.vnet.ibm.com> <20180326155902.12bed785.cohuck@redhat.com> <20180327075114.GK12194@bjsdjshi@linux.vnet.ibm.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 27 Mar 2018 10:07:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 27 Mar 2018 10:07:26 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 27 Mar 2018 15:51:14 +0800 Dong Jia Shi wrote: > * Cornelia Huck [2018-03-26 15:59:02 +0200]: > > [...] > > > > @@ -131,6 +138,8 @@ static void fsm_io_request(struct vfio_ccw_private *private, > > > > > > io_region->ret_code = cp_prefetch(&private->cp); > > > if (io_region->ret_code) { > > > + trace_vfio_ccw_cp_prefetch_failed(get_schid(private), > > > + io_region->ret_code); > > > cp_free(&private->cp); > > > goto err_out; > > > } > > > @@ -138,6 +147,8 @@ static void fsm_io_request(struct vfio_ccw_private *private, > > > /* Start channel program and wait for I/O interrupt. */ > > > io_region->ret_code = fsm_io_helper(private); > > > if (io_region->ret_code) { > > > + trace_vfio_ccw_ssch_failed(get_schid(private), > > > + io_region->ret_code); > > > cp_free(&private->cp); > > > goto err_out; > > > } > > > @@ -145,10 +156,12 @@ static void fsm_io_request(struct vfio_ccw_private *private, > > > } else if (scsw->cmd.fctl & SCSW_FCTL_HALT_FUNC) { > > > /* XXX: Handle halt. */ > > > io_region->ret_code = -EOPNOTSUPP; > > > + trace_vfio_ccw_halt(get_schid(private)); > > > goto err_out; > > > } else if (scsw->cmd.fctl & SCSW_FCTL_CLEAR_FUNC) { > > > /* XXX: Handle clear. */ > > > io_region->ret_code = -EOPNOTSUPP; > > > + trace_vfio_ccw_clear(get_schid(private)); > > > goto err_out; > > > > Hmmm.... perhaps better to just trace the function (start/halt/clear) > > in any case? > > > I agree trace the function in any case is good. @Halil, opinion? > > But the traces for cp_prefetch() and fsm_io_helper() should also be > kept, since they are helpful to debug problem. So I tend to trace the > following in any case: > - cp_prefetch() > - fsm_io_helper() > - start > - halt > - clear OK, I was unclear :) I'd argue to keep the others, just replace the halt/clear tracing with tracing the function. > > > > } > > > > > > diff --git a/drivers/s390/cio/vfio_ccw_trace.h b/drivers/s390/cio/vfio_ccw_trace.h > > > new file mode 100644 > > > index 000000000000..edd3321cd919 > > > --- /dev/null > > > +++ b/drivers/s390/cio/vfio_ccw_trace.h > > > @@ -0,0 +1,86 @@ > > > +/* SPDX-License-Identifier: GPL-2.0 > > > + * Tracepoints for vfio_ccw driver > > > + * > > > + * Copyright IBM Corp. 2018 > > > + * > > > + * Author(s): Dong Jia Shi > > > + * Halil Pasic > > > + */ > > > + > > > + > > > +#undef TRACE_SYSTEM > > > +#define TRACE_SYSTEM vfio_ccw > > > + > > > +#if !defined(_VFIO_CCW_TRACE_) || defined(TRACE_HEADER_MULTI_READ) > > > +#define _VFIO_CCW_TRACE_ > > > + > > > +#include > > > + > > > +TRACE_EVENT(vfio_ccw_cp_prefetch_failed, > > > + TP_PROTO(struct subchannel_id schid, int errno), > > > + TP_ARGS(schid, errno), > > > + > > > + TP_STRUCT__entry( > > > + __field_struct(struct subchannel_id, schid) > > > + __field(int, errno) > > > + ), > > > + > > > + TP_fast_assign( > > > + __entry->schid = schid; > > > + __entry->errno = errno; > > > + ), > > > + > > > + TP_printk("(schid 0.%x.%04X) translation failed (errno: %d)", > > > + __entry->schid.ssid, __entry->schid.sch_no, __entry->errno) > > > +); > > > + > > > +TRACE_EVENT(vfio_ccw_ssch_failed, > > > + TP_PROTO(struct subchannel_id schid, int errno), > > > + TP_ARGS(schid, errno), > > > + > > > + TP_STRUCT__entry( > > > + __field_struct(struct subchannel_id, schid) > > > + __field(int, errno) > > > + ), > > > + > > > + TP_fast_assign( > > > + __entry->schid = schid; > > > + __entry->errno = errno; > > > + ), > > > + > > > + TP_printk("(schid 0.%x.%04X) ssch failed (errno: %d)", > > > + __entry->schid.ssid, __entry->schid.sch_no, __entry->errno) > > > +); > > > + > > > +DECLARE_EVENT_CLASS(vfio_ccw_notsupp, > > > + TP_PROTO(struct subchannel_id schid), > > > + TP_ARGS(schid), > > > + > > > + TP_STRUCT__entry( > > > + __field_struct(struct subchannel_id, schid) > > > + ), > > > + > > > + TP_fast_assign( > > > + __entry->schid = schid; > > > + ), > > > + > > > + TP_printk("(schid 0.%x.%04X) request not supported", > > > + __entry->schid.ssid, __entry->schid.sch_no) > > > +); > > > > Especially as I don't plan to leave this unsupported for too long :) > > > > Just tracing the function is useful now and will stay useful in the > > future. > If we agree with ideas given above, we could: > 1. DECLARE_EVENT_CLASS as vfio_ccw_schid_errno > 2. DEFINE_EVENT: > vfio_ccw_fam_io_helper > vfio_ccw_cp_prefetch > vfio_ccw_io_start > vfio_ccw_io_clear > vfio_ccw_io_halt Use a vfio_ccw_io_fctl tracepoint instead? > 3. add trace points in coresponding places > > > > > Another idea: Trace the fsm state transitions. Probably something for > > an additional patch. > Considering Pierre is refactoring the fsm, we can add trace points in > that series (or as following on patch). Yes, while poking around I also wondered whether we should tweak the fsm in places. So adding tracepoints there looks like a good idea. > > > > > > > > + > > > +DEFINE_EVENT(vfio_ccw_notsupp, vfio_ccw_clear, > > > + TP_PROTO(struct subchannel_id schid), TP_ARGS(schid)); > > > + > > > +DEFINE_EVENT(vfio_ccw_notsupp, vfio_ccw_halt, > > > + TP_PROTO(struct subchannel_id schid), TP_ARGS(schid)); > > > + > > > +#endif /* _VFIO_CCW_TRACE_ */ > > > + > > > +/* This part must be outside protection */ > > > + > > > +#undef TRACE_INCLUDE_PATH > > > +#define TRACE_INCLUDE_PATH . > > > +#undef TRACE_INCLUDE_FILE > > > +#define TRACE_INCLUDE_FILE vfio_ccw_trace > > > + > > > +#include > > >