Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp583498ybl; Fri, 30 Aug 2019 04:17:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/w+9SVbVO1+kg/xo8HFA6Xs9jmKRp8oKwlLdku6qPxqeX2Vpf4b7zok+/RHxYt91mpkfk X-Received: by 2002:a63:755e:: with SMTP id f30mr12697690pgn.246.1567163867334; Fri, 30 Aug 2019 04:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567163867; cv=none; d=google.com; s=arc-20160816; b=waZSg3XjshEPeKYs8LvTd/H8YJegmVeIK5TuS8EZbVCnwjz8IZaf0ZTA0CbMGV+Av9 KXxDcTxbQnOXBUXQ5oq6pjNIZ1B5k3u5LtL7NZkev51ADB0z7g+IZLUb1akMUNH8h/oV fQZczCh9ME0mvreZUJ6tiHYdFSanAYGSstqDKzYDSBddIS2yYITa4MeW1/sM9thM5lYr ayDiDTDZ97u9m4Immk56iwj7Fttt/89xgypBmyZB8YiaoVZkvE1yUXgAeKk/JOku88S/ 5QefA7vht8280ke9QgJj7Ub+fBgbE2YKngUjnmCcfd8qgpLxKtOJYUuyG1/elAs1K2Jb qyZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=8fggjW/Dqx40sKOA/YOm6/NlOBDbHA4viodRYq/8ERI=; b=CSW/oNje6ZINZtVYHc/bhnX3oMKtMe/j/68iAcvhCeQ9NbYc/O04oFFleF3PfB1Ncb rbDg2MG3Y6fb2KoVnCfoRp+IiX6YcVR+kKOT2rJoUcOTAdWspy40FGfIxU7m0JjmMCFz 4tW3FzR56iVVzRo1MLGuhK6NQTO5S5ZRG3F2XUp3vJlP0gy1Xan3vHkohH5Hy786+MPf XVozynfWrC3E8RtIMQF6DhgSTrn057jqtghWnyZMokFXHIdx3xz79+X/1i83OKmM68eE HVqVfzclggJsggM9R9pBj+uJ8b5ExOOMm1mR+7kfkPmMqPmlF5vXNsvuDMk1XgF5qeOy Tq6g== 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 m186si5765615pfm.141.2019.08.30.04.17.31; Fri, 30 Aug 2019 04:17:47 -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 S1727525AbfH3LQH (ORCPT + 99 others); Fri, 30 Aug 2019 07:16:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35064 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726969AbfH3LQG (ORCPT ); Fri, 30 Aug 2019 07:16:06 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A3353CA0C; Fri, 30 Aug 2019 11:16:06 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-95.ams2.redhat.com [10.36.116.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA4755C207; Fri, 30 Aug 2019 11:16:05 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1CE2217536; Fri, 30 Aug 2019 13:16:05 +0200 (CEST) Date: Fri, 30 Aug 2019 13:16:05 +0200 From: Gerd Hoffmann To: David Riley Cc: dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, David Airlie , Daniel Vetter , Gurchetan Singh , =?utf-8?B?U3TDqXBoYW5l?= Marchesin , linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations. Message-ID: <20190830111605.twzssycagmjhfa45@sirius.home.kraxel.org> References: <20190829212417.257397-1-davidriley@chromium.org> <20190830060857.tzrzgoi2hrmchdi5@sirius.home.kraxel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 30 Aug 2019 11:16:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > > > - kfree(vbuf->data_buf); > > > + kvfree(vbuf->data_buf); > > > > if (is_vmalloc_addr(vbuf->data_buf)) ... > > > > needed here I gues? > > > > kvfree() handles vmalloc/kmalloc/kvmalloc internally by doing that check. Ok. > - videobuf_vmalloc_to_sg in drivers/media/v4l2-core/videobuf-dma-sg.c, > assumes contiguous array of scatterlist and that the buffer being converted > is page aligned Well, vmalloc memory _is_ page aligned. sg_alloc_table_from_pages() does alot of what you need, you just need a small loop around vmalloc_to_page() create a struct page array beforehand. Completely different approach: use get_user_pages() and don't copy the execbuffer at all. cheers, Gerd