Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp349247imm; Thu, 11 Oct 2018 22:23:32 -0700 (PDT) X-Google-Smtp-Source: ACcGV60H/t++OcnFnktkwZga+VUGzOeo89/NGV3+hHzhvOTmy5buCPfJOmCFb+UnLf3AQ/C0bYfq X-Received: by 2002:a62:42d4:: with SMTP id h81-v6mr4731614pfd.0.1539321812852; Thu, 11 Oct 2018 22:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539321812; cv=none; d=google.com; s=arc-20160816; b=F5TXBJDSmVeoPxGhOB7kG0I8TRJhTjIR/Fln7fcc9oH75f17XNDe5KpxUlK5LtZNg3 P5AXDd+4zGGQEJKCTj06wtk/hkMEL0iykAympJ98C1bgkmxDsA3L7mwKCTKeqWgEUoOA 8ziOeS2LjiVSSngPiy48Ya+xR4y+loaLXW7GJAH6Iuqov/jZ7b1aoBPwo5NEMJR6LSBY sRPbYKq5n6Yai+GvtJ96aJrbRF/v2ghS4TgWFr6LKFaAcJwMpFZ/+S6Na/9tophttbwx dGELwg5IC1ZWrqAQ9n0TuhCuHn/Z59vou2hep2NtI3SC/Vk+h4r5LrWsP8OdtRq9BYTZ IyGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:content-language :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:to:from:dmarc-filter:dkim-signature :dkim-signature; bh=02R/wgXXFKPBzfbZSUW/sKJd5/TG/jXmzH+PH/RGPyo=; b=aUAazNjffMwAIihA4Q5EXIBh7nJwKOScUKiEM0I2V/Ct2BDM+6v1tU9qvR5SvgcezW v+bqaK3NGr3blWRDBRNf/yJzCA4cUtFAg61s+1eF1N8VZZ+RLDsHMkILhujiZBseJOBa EXYi9lN9/2SCqwla8UipevAS6N2v2iM2wBjAuvpeE4f3LAqSf2Led3T3pCKx9Jxc24f6 E+AwXYJXa9tI9+HasMjtvGpT/PydVP4JuZ39Pn9LqO+//9royV15pHK6lDVoPX5KFsSz 2iXB/uWZFxUXK6C62lfJhNZjRW3OC63fagRV84FapQF1EFinNWSnCBisGrkR9LtKAx1j OiTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=iCzfxxlE; dkim=pass header.i=@codeaurora.org header.s=default header.b=AJSSxy67; 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 y23-v6si140716plr.83.2018.10.11.22.23.18; Thu, 11 Oct 2018 22:23:32 -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=@codeaurora.org header.s=default header.b=iCzfxxlE; dkim=pass header.i=@codeaurora.org header.s=default header.b=AJSSxy67; 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 S1727375AbeJLMxi (ORCPT + 99 others); Fri, 12 Oct 2018 08:53:38 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45454 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726731AbeJLMxi (ORCPT ); Fri, 12 Oct 2018 08:53:38 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1CF6160B7A; Fri, 12 Oct 2018 05:22:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539321777; bh=PQk4ghll7M2SlTQ8n/VNfrOZYpnVO76DMikfP4DLB9I=; h=From:To:References:In-Reply-To:Subject:Date:From; b=iCzfxxlEE9Vy+J1NWZbzpFA4bX8SD78p81pqg5pZCG6swxm3THUxac+ybB2sDvlTW VI9gut+miIFHyRMmb9SbS1KwZqDNSZBWfnYnVDLqNXLsNpcTOrYJ9bfIB/NgiGgOxm kUPEQj43MA0ILPBxf8HKHCi+wKUzFiebYYgXm5M0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from tbhardwa (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: tbhardwa@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 55EF260316; Fri, 12 Oct 2018 05:22:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539321776; bh=PQk4ghll7M2SlTQ8n/VNfrOZYpnVO76DMikfP4DLB9I=; h=From:To:References:In-Reply-To:Subject:Date:From; b=AJSSxy679V7gS11r/wPLkz8TV9fgmt8lG6TL3Zgmv0k7c/pKpwwZE2YXpYQwxDy4c MUBIZRx5vP98ab1U5Zr9mBUH6W7LAJiAI8D/bZaShck73WWgwyLFo960t382qrLrfK oApev25vqE4JLsQlH2/EWLnoPD9+jGTyBp+hmRVg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 55EF260316 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=tbhardwa@codeaurora.org From: To: "'Zhang, Ning A'" , , References: <1539313441.21249.3.camel@intel.com> <1539318782.21249.7.camel@intel.com> In-Reply-To: <1539318782.21249.7.camel@intel.com> Subject: RE: question about V4L2_MEMORY_USERPTR on 64bit applications Date: Fri, 12 Oct 2018 10:52:51 +0530 Message-ID: <000601d461eb$a1f7afc0$e5e70f40$@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: en-us Thread-Index: AQIZOT1Qp2mifVHgqOiMlO5tZ7T4WgG2r2gYpIOuUQA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 64 bit kernel have 64 bit long(not 32 bit), which is not the case with = userspace (in 64 bit userspace long is 32-bit). Probably thig got you = confused. -----Original Message----- From: linux-media-owner@vger.kernel.org = On Behalf Of Zhang, Ning A Sent: Friday, October 12, 2018 10:03 AM To: linux-kernel@vger.kernel.org; linux-media@vger.kernel.org Subject: Re: question about V4L2_MEMORY_USERPTR on 64bit applications sorry for wrong question, I really meet memory address truncated issue, = when use V4L2 kernel APIs. in a kernel thread created by kernel_thread() I vm_mmap a shmem_file to = addr: 00007ffff7fa8000 and queue it to V4L2, after dequeue it, and I = find the address is truncated to 00000000f7fa8000 I use __u64 {aka long long unsigned int} to save address, and I find = userptr is unsigned long, wrongly think it as "data truncated" and a lot of __u32 in this structure. everything works fine, but I still don't understand why high 32bit be = 0.. BR. Ning. =E5=9C=A8 2018-10-12=E4=BA=94=E7=9A=84 11:04 +0800=EF=BC=8CZhang = Ning=E5=86=99=E9=81=93=EF=BC=9A > Hi, >=20 > I have question about V4L2_MEMORY_USERPTR on 64bit applications. >=20 > struct v4l2_buffer { > __u32 index; > __u32 type; > __u32 bytesused; > __u32 flags; > __u32 field; > struct timeval timestamp; > struct v4l2_timecode timecode; > __u32 sequence; >=20 > /* memory location */ > __u32 memory; > union { > __u32 offset; > unsigned long userptr; <<<--- this is a 32bit addr. > struct v4l2_plane *planes; > __s32 fd; > } m; > __u32 length; > __u32 reserved2; > __u32 reserved; > }; >=20 > when use a 64bit application, memory from malloc is 64bit address. > memory from GPU (eg, intel i915) are also 64bit address. >=20 > when use these kind of memory as V4L2_MEMORY_USERPTR, address will be=20 > truncated into 32bit. >=20 > this would be error, but actually not. I really don't understand. >=20 > BR. > Ning.