Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5728290ybl; Tue, 27 Aug 2019 08:51:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwid1KaiHurpLYWcOfgixoXghEJ1vI5Bkqg1oiMfmZud46H4vw+TSJIz5AgBY63nBS6djAb X-Received: by 2002:a65:6859:: with SMTP id q25mr21447912pgt.181.1566921069029; Tue, 27 Aug 2019 08:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566921069; cv=none; d=google.com; s=arc-20160816; b=spOLFpkgmKKy4pdn4HZ35oBKF/WHRurk4DPaP0znN6Xk8RQ4n7/fjTK50rXgkzJS8G JSUD2FzhvHqHHVhJJmD/LXz7VTGHEG6F7iabRrINtSH3qKhK59L2uKg/B5GpX4B+k5Oj oSQ8Va4eZtFzdRZAh7jqprtcp6Yr5g9ogF5RqxIbHVisVCnbNyCCbBuVHq2eO9KWkeWK rkU+mpVfGfsQB/EKRkWjNkZNRhzHEOEcpIDoV/0+JP8nGM0GvIJIuBnivrvLN5LXL10W 4PEDsuSmBPNwBpIWgk5dzcnNSXzcqNTznZ3mtPBxuUxoln1iMrGnFQYYajU6Ju+SQy7w IWjg== 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:dkim-signature; bh=6pvvgSgM9CbdJfaBulsERf+5+2yHIplcG96TA5AmISw=; b=TRKRFiEeSBZ1ZxOPbLWUB79y18AjrWnOv7524u4SaZeKqZlyRCkqeh0VnVoONz9+H2 VWRlg0LqttDga3S+5JbLwG9xYYJxv+QueenXJC2XDdUxthvp07STdbpwsMRtYE66hEaQ nWenAI42sFar96GG2iHoOrriWi4le8Zku+vfN7bNg9n5+15aqJB333UUs45rvUz75MUQ X8XOPn5BWXykd03G21+J+ERKulb7/MPfbM2H/RqaWYFsRK2xX2bfHjy0DpXEpnpneBr1 xqJnbB/27tYkA48mZ1Hp50oDUNDyaT2JqfIuyUFf/e5Z7thO3fwemuZkTgeuiYIw4cm9 zMCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=eV1MNaGv; 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 j190si11982379pge.92.2019.08.27.08.50.53; Tue, 27 Aug 2019 08:51:09 -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=@ziepe.ca header.s=google header.b=eV1MNaGv; 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 S1729813AbfH0Pti (ORCPT + 99 others); Tue, 27 Aug 2019 11:49:38 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:42974 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726621AbfH0Pti (ORCPT ); Tue, 27 Aug 2019 11:49:38 -0400 Received: by mail-qt1-f194.google.com with SMTP id t12so21763699qtp.9 for ; Tue, 27 Aug 2019 08:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=6pvvgSgM9CbdJfaBulsERf+5+2yHIplcG96TA5AmISw=; b=eV1MNaGvP7HxNr2esjzckKmVddzEK3y7o8MIrme4Sno04F5ZbnmCDdt1jLLqed8T5x v8iKIaKUtUSGNbnyxxGyzJTxXIdBzWKlSZ43Rq/9Pf/2vqnR7w6zd5p2saeIKtEBqatg 7QPDCEirLtYTsISXIpTvmiTHySnITzmN4dNvB8krvT5hS/7nNJZ3v7+QmSq5Pibvohgm CpMRJRA0VPZalQ50kXT4KXcDPiaXdp4FPv+qqHfIy7wCv4kbh8HHCgg1Usu2Wrn9CtEo XlaAy3fyNDYxZWCkeR6goHFSLQNbXq93U3RQhpcIcV7vri4KHtCVJoVOtjwHjAOFcsfK 10kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=6pvvgSgM9CbdJfaBulsERf+5+2yHIplcG96TA5AmISw=; b=Vr/3j88gl02/XJp271TepIX9DTYn+emit7FWhEPZHeRlwn5ZKejQ9yByyGIENU93Tz P5rsvAafUZpdhQggfczH9aZFQahswU5nCjZxKoUC0K5MFEDyT+0hkNxy7vkIJhtpF1j7 IsQHl3P5fGs3r5ldnV+9AQhsk4pEnQvajVq+JSzde5GXqRWUfuPKRbHNO8GkA1pcGgKM mL8shIxk09jdTG6iIqbu9GMWVimEHK21vFMwdF3NqQvIA7jovgJynKMLT5Wkj5M3sZ8u 5GB4HtZcFFHY3stACtLLJAZcdLRWgh0vXsccesFXO5OmLeeE0ZLyGGsZEPA2+OkIIpy4 N2zg== X-Gm-Message-State: APjAAAVLlWv2hw8AFqFS3j13h/aaIyhvnXb5ndKhDTfvQIVcYDuBg25x skIbDeocmnfnavKxNXu+fidoCA== X-Received: by 2002:ac8:24ce:: with SMTP id t14mr24042841qtt.246.1566920977057; Tue, 27 Aug 2019 08:49:37 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-167-216-168.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.167.216.168]) by smtp.gmail.com with ESMTPSA id u187sm8745056qkh.110.2019.08.27.08.49.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Aug 2019 08:49:36 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1i2dix-0003vR-SQ; Tue, 27 Aug 2019 12:49:35 -0300 Date: Tue, 27 Aug 2019 12:49:35 -0300 From: Jason Gunthorpe To: Souptick Joarder Cc: leon@kernel.org, Doug Ledford , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Matthew Wilcox Subject: Re: [PATCH] IB/mlx5: Convert to use vm_map_pages_zero() Message-ID: <20190827154935.GD7149@ziepe.ca> References: <1566713247-23873-1-git-send-email-jrdr.linux@gmail.com> <20190825194354.GC21239@ziepe.ca> <20190826122055.GA27349@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 27, 2019 at 01:48:57AM +0530, Souptick Joarder wrote: > On Mon, Aug 26, 2019 at 5:50 PM Jason Gunthorpe wrote: > > > > On Mon, Aug 26, 2019 at 01:32:09AM +0530, Souptick Joarder wrote: > > > On Mon, Aug 26, 2019 at 1:13 AM Jason Gunthorpe wrote: > > > > > > > > On Sun, Aug 25, 2019 at 11:37:27AM +0530, Souptick Joarder wrote: > > > > > First, length passed to mmap is checked explicitly against > > > > > PAGE_SIZE. > > > > > > > > > > Second, if vma->vm_pgoff is passed as non zero, it would return > > > > > error. It appears like driver is expecting vma->vm_pgoff to > > > > > be passed as 0 always. > > > > > > > > ? pg_off is not zero > > > > > > Sorry, I mean, driver has a check against non zero to return error -EOPNOTSUPP > > > which means in true scenario driver is expecting vma->vm_pgoff should be passed > > > as 0. > > > > get_index is masking vm_pgoff, it is not 0 > > Sorry, I missed this part. Further looking into code, > in mlx5_ib_mmap(), vma_vm_pgoff is used to get command and > inside mlx5_ib_mmap_clock_info_page() entire *dev->mdev->clock_info* > is mapped. > > Consider that, the below modification will only take care of vma length > error check inside vm_map_pages_zero() and an extra check for vma > length is not needed. What is the point of vm_map_pages_zero() Is there some reason we should prefer it for mapping a single page? Jason