Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3549948imm; Mon, 4 Jun 2018 05:36:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKykFXjsBrMTSm4TnDOhMADa1AO9QKOMi9LvUtaVJsPt6FSs2V2y1LXl2yFUYU1mZFJmFIV X-Received: by 2002:a63:61d6:: with SMTP id v205-v6mr17125901pgb.432.1528115767189; Mon, 04 Jun 2018 05:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528115767; cv=none; d=google.com; s=arc-20160816; b=wmovGUvHpk1FO7HCrJ4t8zUk8ERDEqrfo/Pqvr4Rl3SDfZNNUl3XF8Dk21/rNMaeT6 7UMldC0PSTZoaxM/EaH624xjoF5P/+NVIY+hB++2vmeZEMap8KpCdeONwtTIJ2sBqVoU SiqpGPpc2bcReNrI87Sy1VXmrTre+kI1e9JC3ac/20VZ3crnxi9beCdpILWdsGSfyaKT 8MnMAtGGwocZt5+uE3b+76uOPdHFMQFZBRV+GMJGltHZ2wW5vintuudKwGsua5FRLvLl K+DFDEMjbuvOkZbrUM6WGEMxmPM6IRfTmo2LNoo/HMT+vLLftuZrx7irtlVkwkrr01en qyFA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:autocrypt:openpgp:from:references:cc:to :subject:dkim-signature:arc-authentication-results; bh=S7cVGv3uFOFg8YZ0PXo1WljqJSBWFHCPlLNy3svtSvQ=; b=fSMGqsibXTOlcNaIKR0+RXI2YB2l7jhyDtyFwLYHvO2CMnSRrYDQc6PZTmlWzcm4jV axdCGphfcJLu1hUgJZVDpEg3JVXC6JxA9LLUvBvagHAerweT/d2TLDNCGRHO98T88HNk k6msWI8K2TevYFVEY5obkRkYcTfpuso1nBWIncYcAdaAg1uxURmB6RaGkOX7MxQK3tMB +nfwmVtMMa3hJfdEt29jLOvklAgzfKKPM5sxjbhwpJELw8PbJKKeEjBFTyeivaoOGKcX CHbZR99b7AiIBuuM0mkOr0/jH4tKkkvuAvFlTqaahfrgbJT2jQOUnGB8GSgwGe7cV96D aA9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=PjzIwwzj; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3-v6si10446335pfa.38.2018.06.04.05.35.53; Mon, 04 Jun 2018 05:36:07 -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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=PjzIwwzj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752757AbeFDMe2 (ORCPT + 99 others); Mon, 4 Jun 2018 08:34:28 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:50740 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752569AbeFDMeZ (ORCPT ); Mon, 4 Jun 2018 08:34:25 -0400 Received: from [192.168.0.20] (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B0EAF1A87; Mon, 4 Jun 2018 14:34:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1528115661; bh=f0gvxKefBignqnxrgQgww3tzylSYw3Wu7JFnwi5r42I=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=PjzIwwzjPbNjv3Ci66vUx7CXCjH94BHquI4PKqZV28K8aSk0C5RlZsFJntX6zXcd5 74vGgCFQicJ4+SOEhYKNr3F5vzld4anO6NTw1p9eq328nGPEkmp6kE9I4fNM/mBun8 qs9D7tPNwWbXgoqZKBHmXLFOIeIAsyk9bRG2GjcE= Subject: Re: [PATCH v4 6/6] media: uvcvideo: Move decode processing to process context To: Guennadi Liakhovetski Cc: Laurent Pinchart , linux-media@vger.kernel.org, Olivier BRAUN , Troy Kisky , Randy Dunlap , Philipp Zabel , Mauro Carvalho Chehab , open list References: From: Kieran Bingham Openpgp: preference=signencrypt Autocrypt: addr=kieran.bingham@ideasonboard.com; prefer-encrypt=mutual; keydata= xsFNBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat V/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC rRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO95ewJGgLm+idg1Kb3C potzWkXc1xmPzcQ1fvQMOfMwdS+4SNw4rY9f07Xb2K99rjMwZVDgESKIzhsDB5GY465sCsiQ cSAZRxqE49RTBq2+EQsbrQpIc8XiffAB8qexh5/QPzCmR4kJgCGeHIXBtgRj+nIkCJPZvZtf Kr2EAbc6tgg6DkAEHJb+1okosV09+0+TXywYvtEop/WUOWQ+zo+Y/OBd+8Ptgt1pDRyOBzL8 RXa8ZqRf0Mwg75D+dKntZeJHzPRJyrlfQokngAAs4PaFt6UfS+ypMAF37T6CeDArQC41V3ko lPn1yMsVD0p+6i3DPvA/GPIksDC4owjnzVX9kM8Zc5Cx+XoAN0w5Eqo4t6qEVbuettxx55gq 8K8FieAjgjMSxngo/HST8TpFeqI5nVeq0/lqtBRQKumuIqDg+Bkr4L1V/PSB6XgQcOdhtd36 Oe9X9dXB8YSNt7VjOcO7BTmFn/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f4U0z7eJv2NeF8xHMuiU RCIzqxX1GVYaNkKTnb/Qja8hnYnkUzY1Lc+OtwiGmXTwYsPZjjAaDX35J/RSKAoy5wGo/YFA JxB1gWThL4kOTbsqqXj9GLcyOImkW0lJGGR3o/fV91Zh63S5TKnf2YGGGzxki+ADdxVQAm+Q sbsRB8KNNvVXBOVNwko86rQqF9drZuw= Organization: Ideas on Board Message-ID: <3af3db58-6764-ae75-0138-ab7f1a085d1f@ideasonboard.com> Date: Mon, 4 Jun 2018 13:34:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Guennadi, Thank you for reviewing / taking a look through the series. On 04/06/18 13:09, Guennadi Liakhovetski wrote: > Hi Kieran, > > I've got a question: > > On Tue, 27 Mar 2018, Kieran Bingham wrote: > >> Newer high definition cameras, and cameras with multiple lenses such as >> the range of stereo-vision cameras now available have ever increasing >> data rates. >> >> The inclusion of a variable length packet header in URB packets mean >> that we must memcpy the frame data out to our destination 'manually'. >> This can result in data rates of up to 2 gigabits per second being >> processed. >> >> To improve efficiency, and maximise throughput, handle the URB decode >> processing through a work queue to move it from interrupt context, and >> allow multiple processors to work on URBs in parallel. >> >> Signed-off-by: Kieran Bingham >> >> --- >> v2: >> - Lock full critical section of usb_submit_urb() >> >> v3: >> - Fix race on submitting uvc_video_decode_data_work() to work queue. >> - Rename uvc_decode_op -> uvc_copy_op (Generic to encode/decode) >> - Rename decodes -> copy_operations >> - Don't queue work if there is no async task >> - obtain copy op structure directly in uvc_video_decode_data() >> - uvc_video_decode_data_work() -> uvc_video_copy_data_work() >> >> v4: >> - Provide for_each_uvc_urb() >> - Simplify fix for shutdown race to flush queue before freeing URBs >> - Rebase to v4.16-rc4 (linux-media/master) adjusting for metadata >> conflicts. >> >> drivers/media/usb/uvc/uvc_video.c | 107 ++++++++++++++++++++++++------- >> drivers/media/usb/uvc/uvcvideo.h | 28 ++++++++- >> 2 files changed, 111 insertions(+), 24 deletions(-) >> >> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c >> index 7dd0dcb457f3..a62e8caf367c 100644 >> --- a/drivers/media/usb/uvc/uvc_video.c >> +++ b/drivers/media/usb/uvc/uvc_video.c >> @@ -1042,21 +1042,54 @@ static int uvc_video_decode_start(struct uvc_streaming *stream, >> return data[0]; >> } >> >> -static void uvc_video_decode_data(struct uvc_streaming *stream, >> +/* >> + * uvc_video_decode_data_work: Asynchronous memcpy processing >> + * >> + * Perform memcpy tasks in process context, with completion handlers >> + * to return the URB, and buffer handles. >> + */ >> +static void uvc_video_copy_data_work(struct work_struct *work) >> +{ >> + struct uvc_urb *uvc_urb = container_of(work, struct uvc_urb, work); >> + unsigned int i; >> + int ret; >> + >> + for (i = 0; i < uvc_urb->async_operations; i++) { >> + struct uvc_copy_op *op = &uvc_urb->copy_operations[i]; >> + >> + memcpy(op->dst, op->src, op->len); >> + >> + /* Release reference taken on this buffer */ >> + uvc_queue_buffer_release(op->buf); >> + } >> + >> + ret = usb_submit_urb(uvc_urb->urb, GFP_ATOMIC); > > Does this still have to be ATOMIC now that it's called from a work queue > context? I think you're right. This could very likely be changed to GFP_KERNEL. Does this series impact anything on your async-controls series ? -- Kieran > >> + if (ret < 0) >> + uvc_printk(KERN_ERR, "Failed to resubmit video URB (%d).\n", >> + ret); >> +} > > [snip] > > Thannks > Guennadi >