From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751354AbdGNFbn (ORCPT ); Fri, 14 Jul 2017 01:31:43 -0400 Received: from mail-pg0-f46.google.com ([74.125.83.46]:33196 "EHLO mail-pg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750763AbdGNFbm (ORCPT ); Fri, 14 Jul 2017 01:31:42 -0400 Subject: Re: [PATCH] usb: gadget: functions: add ftrace export over USB To: Felipe Balbi , Alexander Shishkin , Steven Rostedt , Ingo Molnar References: <20170609061327.17899-1-felipe.balbi@linux.intel.com> Cc: Linux USB , linux-kernel@vger.kernel.org, Chunyan Zhang From: Pratyush Anand Message-ID: <16a6940d-d071-cd2d-5911-dad427a13cb0@redhat.com> Date: Fri, 14 Jul 2017 11:01:35 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170609061327.17899-1-felipe.balbi@linux.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Felipe, On Friday 09 June 2017 11:43 AM, Felipe Balbi wrote: > +static void notrace ftrace_write(struct trace_export *ftrace, const void *buf, > + unsigned int len) > +{ > + struct usb_ftrace *trace = ftrace_to_trace(ftrace); > + struct usb_request *req = next_request(&trace->list); > + > + if (!req) > + return; > + > + if (!trace->in->enabled) > + return; > + > + req->buf = kmemdup(buf, len, GFP_ATOMIC); Probably we can avoid the copy of trace data. We can make write() call of "struct trace_export" as posted. Can have a write_complete() callback function implemented in struct trace_export,which can be called from your ftrace_complete(). We need to execute __buffer_unlock_commit() only in write_complete() in case of ftrace_export is enabled. > + req->length = len; > + req->context = trace; > + req->complete = ftrace_complete; > + list_move_tail(&req->list, &trace->pending); > + > + schedule_work(&trace->queue_work); > +} > + -- Pratyush