Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp989607imu; Fri, 11 Jan 2019 12:49:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN4gm/WUYl1qwXNsaNj2Dx7OwhhUQClTf84ymoeyPpefuc7p0W3tZs6jw3sJGpq6dAk2gMFV X-Received: by 2002:a62:4e83:: with SMTP id c125mr16185739pfb.101.1547239769658; Fri, 11 Jan 2019 12:49:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547239769; cv=none; d=google.com; s=arc-20160816; b=NtTdE5atFPCQVyi92fOhvCpgsMQkNuuu9Mja3KKCaTW1OsDDL7gdJJLB/kaEW6SFVD CSqyamHLUCQqyr0r3UOIQr0SzgIT0c+k+TnYSmrsint0MVHw7d741nhA/EfJO1pOU8FN E5hg8YT2S8HbB5tmFxpqrA1mePQajD9ELDT5MDKAbkjtTwAH9C9gQDf3jVfGagNRiis2 vvauSH6HcmlfS0CvhVTr251/k9AM2iLLIlZ0GLYWK6moqdtBP0N11UtOXZ2L+2ZGLaLO 2wCfqqFJ7gOzZ7ERq3ZQTZQrznsUj9Chxxsn3a2Wm1HqEOqStKLP789Y6okBSzpHr54/ JeAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ayka7Sh3aQlBgO/wDrEiHMv9aQQ0JWeEDtgdlGLEXKQ=; b=MXkiaV/PEgQu811ME3J2eSvPUhT6pAXawtxCNcwF9kUkhIk+m7JIBEKj5HvepeQqVh igdbIWho5VImu/p3hXU7sah5hRG4ddusJ/Ootf0aZeMsrkkiR8BFRcWgvGUFMs/V6Is9 J5f9uJ2ZGWfdBjRFuW8KoTQwLD/O794Lo9vHorCOjTs3ZdFju/I6YsFwtibl5bXrdJlN mwD/vuAXsgPl61WuXlxVG+P5L7aDm0+mSJFi8o8K0b0Le2Qh8dJ70MLF9ljUeytkloVe G6BwBMzNUpOU6MLi/l5PcLxuouRmxRD39uWRfQJTpj8jv+0cVunadrBj0fGnqMY67yqO Qg5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fyUdRY77; 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 c6si73536250plr.414.2019.01.11.12.49.14; Fri, 11 Jan 2019 12:49:29 -0800 (PST) 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=fyUdRY77; 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 S2388603AbfAKPKI (ORCPT + 99 others); Fri, 11 Jan 2019 10:10:08 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:41780 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731910AbfAKPKG (ORCPT ); Fri, 11 Jan 2019 10:10:06 -0500 Received: by mail-lj1-f196.google.com with SMTP id k15-v6so13197800ljc.8 for ; Fri, 11 Jan 2019 07:10:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=ayka7Sh3aQlBgO/wDrEiHMv9aQQ0JWeEDtgdlGLEXKQ=; b=fyUdRY77N1/CFuA54mNf9PsA8YNDmorB9kqtctzsXuCQXNYltn2bl5oULAhUFMkt4R 3uDlw9VIrP/rL9CKNIGhV7stgWqJhzxnCa0Q8B46WL2rAeaCb356GkSVdWbJWUq0zJyz S3j7IxOG+n1CJHQWXCOFT2aunZJ87gkDWJREu9l4tuEBJREGRPxk06tN5TGIU2Eaqsh6 QiWqD6RZG505P087/cS17lPOyCneNu8aOxFsWTtftfRw6zNXD4xX/rmR0juXA/NT6PS5 FQjGb8yVq9YTlNqxFqE8VIdARK+zHwPWx0FR2Rr/q9D3VGxUjONDlhXMqRuA9b+1sTCY +1oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=ayka7Sh3aQlBgO/wDrEiHMv9aQQ0JWeEDtgdlGLEXKQ=; b=Ah1+w+bZJtIe7GxP98xoLazkAxiEVuOTRds+y8zUPeoMu+xXgzfjAXGV7WdMdNGDKE bI13koNAQU2V9RHESu26uK+6Vn1fWYXogphRCfV7+cmehOR8ajfRoM7hiBydW3GcvQhP iD4jxbgxGvZur8qygPuGACYFLEd7Q9Oha/FiF3EaGLe6a1frMY7aL487WLH/T4yCxBqI K9egATMZWU8BQx/bWROieKO/Os74QXkCfG2Pq7ei5vjyAr2KEB/687vAA4xQOj2KeEAG DbreyfIn+h7G4e0ZMukwJCBrXuDXqXOfZFtREqUWD6AdGr0HSbIUf0oXslgk98ehoi2H b+3Q== X-Gm-Message-State: AJcUukdC1lCVZZX7sLNtLwIm+MXlQ3xzoKiNh4FRHL5C/iU1eRNlqH+p 7SqFAqVkgX+eI6Ku9Z/KXRxL0ojK X-Received: by 2002:a2e:8045:: with SMTP id p5-v6mr8525037ljg.87.1547219403389; Fri, 11 Jan 2019 07:10:03 -0800 (PST) Received: from [10.17.182.20] (ll-22.209.223.85.sovam.net.ua. [85.223.209.22]) by smtp.gmail.com with ESMTPSA id s3-v6sm16010590lje.73.2019.01.11.07.10.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Jan 2019 07:10:02 -0800 (PST) Subject: Re: [PATCH 5/9] drm/xen/xen_drm_front_gem.c: Convert to use vm_insert_range To: Souptick Joarder , akpm@linux-foundation.org, willy@infradead.org, mhocko@suse.com, airlied@linux.ie, linux@armlinux.org.uk, robin.murphy@arm.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org, xen-devel@lists.xen.org, "Oleksandr_Andrushchenko@epam.com" References: <20190111151037.GA2781@jordon-HP-15-Notebook-PC> From: Oleksandr Andrushchenko Message-ID: <1ce5287f-22d1-3704-1e81-a44b2c63cbd8@gmail.com> Date: Fri, 11 Jan 2019 17:10:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190111151037.GA2781@jordon-HP-15-Notebook-PC> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/11/19 5:10 PM, Souptick Joarder wrote: > Convert to use vm_insert_range() to map range of kernel > memory to user vma. > > Signed-off-by: Souptick Joarder Reviewed-by: Oleksandr Andrushchenko > --- > drivers/gpu/drm/xen/xen_drm_front_gem.c | 18 +++++------------- > 1 file changed, 5 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/xen_drm_front_gem.c > index 47ff019..9990c2f 100644 > --- a/drivers/gpu/drm/xen/xen_drm_front_gem.c > +++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c > @@ -225,8 +225,7 @@ struct drm_gem_object * > static int gem_mmap_obj(struct xen_gem_object *xen_obj, > struct vm_area_struct *vma) > { > - unsigned long addr = vma->vm_start; > - int i; > + int ret; > > /* > * clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the > @@ -247,18 +246,11 @@ static int gem_mmap_obj(struct xen_gem_object *xen_obj, > * FIXME: as we insert all the pages now then no .fault handler must > * be called, so don't provide one > */ > - for (i = 0; i < xen_obj->num_pages; i++) { > - int ret; > - > - ret = vm_insert_page(vma, addr, xen_obj->pages[i]); > - if (ret < 0) { > - DRM_ERROR("Failed to insert pages into vma: %d\n", ret); > - return ret; > - } > + ret = vm_insert_range(vma, xen_obj->pages, xen_obj->num_pages); > + if (ret < 0) > + DRM_ERROR("Failed to insert pages into vma: %d\n", ret); > > - addr += PAGE_SIZE; > - } > - return 0; > + return ret; > } > > int xen_drm_front_gem_mmap(struct file *filp, struct vm_area_struct *vma)