Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp949208ybl; Fri, 30 Aug 2019 09:26:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPr8uBduWxPGSYbaKTzf4YkKX3aYq0EANXBVCnTIM+RaD3A3W0PsOVBND5vauUOHKg+1bV X-Received: by 2002:a63:6fc9:: with SMTP id k192mr13508907pgc.20.1567182373311; Fri, 30 Aug 2019 09:26:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567182373; cv=none; d=google.com; s=arc-20160816; b=YCLFkheJneHPTH1UH6HMtqaLQd3y14KItIoaWoDpPvBCmw4Q+NWdhHwniHH/j1seVb 8V3sbmYEPkqxAL6GtOwMoPE1DWs1e3+rIValuZGNU5Mn7rAeWZCLVm4n0FQblj7OkFQv 4Au63J4VcNRPi9Gdhy8Nz0ushw7ZKTHV8DohuBE6/8KXxPw8WN04hSIQpzQUuErOS43D HHruyfXsq/KUspSc0WLu/OIpN2QHP9mbtxIAVfzbId3ON10Bu6mKeit+FymFXljDJyi3 jZIdawTabwzOqI+Jhr9WeBGDag0JEn2mjqi9/c0tfe3S/5+r4PkLMMxuY5oNBKPjw3rr RqKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=RHySHF2uwEhmKQaEHe0OPL8GmZZ5+dREwVbeFYlqd3c=; b=keCjZDxNT+uv1jEzuyChgNjOFuJipHvuAzH1CPiNJjL6uDCcm/OCxHqoy5lr5dakuf 2OfdLo/3L23/zj5oINMHONudeVYHUB2l1700UiMZUeVu8diyEo6581AEGpjaVFakZMgp Zr0OvqsCFIsVLru9/g+8K6daloNe8D28l43iNMYnnjtJz2vF0ccCPvuhv/vcqrf62Jni 3HAMaDa9OfBMmPMS9/+HfPxd0sL2Aj10z46qLldfApb/fVRZOUSeK/otJGlmF51hEwYN 5lzcB9TgzwZw79YGi7ZnqUL9cPaapakNC7DuyjywnU2Sgf0uAvRRagTrZAEkbKMjnPAV r9mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dwn0RWHZ; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20si4552251pgg.565.2019.08.30.09.25.57; Fri, 30 Aug 2019 09:26:13 -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 header.i=@gmail.com header.s=20161025 header.b=dwn0RWHZ; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728271AbfH3QYu (ORCPT + 99 others); Fri, 30 Aug 2019 12:24:50 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:38008 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727883AbfH3QYt (ORCPT ); Fri, 30 Aug 2019 12:24:49 -0400 Received: by mail-io1-f65.google.com with SMTP id p12so15216742iog.5 for ; Fri, 30 Aug 2019 09:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RHySHF2uwEhmKQaEHe0OPL8GmZZ5+dREwVbeFYlqd3c=; b=dwn0RWHZ+Um+l/0l8KxAVtK9/XCUY5drIfMskunEhTk7upC2I0w2tmibG77Ds/21/4 JJoGM8HWSM3DCAtH8AYBZ/LmZvoJJq0x1jKREkrFnk7jfkKC2BJRP3GFMnR6ic9Jffd0 sVC0h7v9o6ui5kdqEwP0wwyIEkuJIVTh0SNgDPCZEdEajFrRJZ4SXg8ivCSGaTHeVhYn wm3/6YbtHhrI9Gq5JRL9k0wJZSUi7JTiSLGn5xb+NLTOkKT9BS73IUko0kK/Fd71nOj1 joRjzfXCPtV8W9B/esh4Ea2p3xu9AEEt2gvLMkGyYH6BCRhnEKilZRSt3SHab1J21YR3 8ihA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RHySHF2uwEhmKQaEHe0OPL8GmZZ5+dREwVbeFYlqd3c=; b=fucCNJtar0ewbZYeMWbcqJ9vj5hS5wBai81c1jDXZpH1mhjZFdfebJ8MNNrkfZ1BW+ VXjMtw0iuTvsN6Nou24pQv0OmdxmZPJR5IbmXenoBbC1SJvKbiLdC/4DpESMfjw3h/0p 8Vm1V7KD/0x3LBvzhQbAko31DrXTw+82NW7mXjuIoTnRVSi2egxX+JFkMn3WvsE5RnRl vqjAzcvGsmW32syYvRKOIZw8PHQQRjdy1N7okprabU9CTa8zVDdIkQkkbdhGzR6u9vc3 0LjEYA6zNdnlFNzLIr+A9rf4ZGCG2YWnj9rGNEs8lkhv34Q7YVe0pXCpy6oKuboLJtQO SGfQ== X-Gm-Message-State: APjAAAW/meAiuFj8KliWf/VNTDpIVwN4RKPWtYkilthjUwyRBc9KDWEK 5KEeb1MJxtp2ugAJRKpTPVjyL/6UMErBJ16BdTafnoHN X-Received: by 2002:a5d:96cb:: with SMTP id r11mr19355270iol.200.1567182288772; Fri, 30 Aug 2019 09:24:48 -0700 (PDT) MIME-Version: 1.0 References: <20190829212417.257397-1-davidriley@chromium.org> <20190830060857.tzrzgoi2hrmchdi5@sirius.home.kraxel.org> <20190830111605.twzssycagmjhfa45@sirius.home.kraxel.org> In-Reply-To: <20190830111605.twzssycagmjhfa45@sirius.home.kraxel.org> From: Chia-I Wu Date: Fri, 30 Aug 2019 09:24:37 -0700 Message-ID: Subject: Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations. To: Gerd Hoffmann Cc: David Riley , David Airlie , open list , ML dri-devel , Gurchetan Singh , =?UTF-8?Q?St=C3=A9phane_Marchesin?= , "open list:VIRTIO CORE, NET AND BLOCK DRIVERS" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 30, 2019 at 4:16 AM Gerd Hoffmann wrote: > > 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. It would be really nice if execbuffer does not copy. The user space owns the buffer and may overwrite the contents immediately after the ioctl. We also need a flag to indicate that the ownership of the buffer is transferred to the kernel. > > cheers, > Gerd > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel