Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2268421rwb; Thu, 27 Jul 2023 05:00:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlETCf9a3fEIGQ8DzmWj/+fGhcaDMzIpZ7Px/wWMOGkEnu4kwEUT6+mheN0sLGupW4Jkm2Qf X-Received: by 2002:a17:902:bf45:b0:1b8:6e2e:78cd with SMTP id u5-20020a170902bf4500b001b86e2e78cdmr3165054pls.40.1690459255176; Thu, 27 Jul 2023 05:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690459255; cv=none; d=google.com; s=arc-20160816; b=mEq0YZ52SZ/Nwa/TjItAusaPq09XrBudNh9oskdtpFs3q1mzpx2ZQt+x5GM7LSakSV jYFDv9kqmig54Wxtui0EUuiktpPdazHXUKpuOhBU1QLaVyvm1cN64EUPzgNlHjWMLczy Ko7+K5Cq4zDTWzkOVgxPE76ErsIDcOIkMKxALV5KCa0Ks9v/fEI+utI8VvXpqYVljOm9 eScSUZK6QUkS+Boj5qIif0NIVJX6teE+Dt4eD1N1BW/aXAT4FbD5eUvwBXKQFWS0c1Ig c5GxCHMICn6Is8BXbZrnOPrm2alWCNpqMGS9rgX9jVHyLYqh+T6VG/q3i8Va7dYcTV6/ ykFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=/Sv0p192pOwoxkdwbAGwv7t6rgbD45OZwJxFUyZq/2I=; fh=xirjYJ0ONrj7Vx+svmCKD9xlGq+asENfsUsRcqAgKcw=; b=erMzjCQqG0ubdc6950Or2pVbKgjKWHegERFR4qkKfScs0Qds/mmdIPtU1NBOPWb7jg aOUq8YXeaRn2G6lemevdc9HXsmFgwWK+ilv1FWpFWvg//hBNI3dl++UeqpOxwgqCSchi ZmJetHr8wKaH0ut4p732lPHeOgULdOmzmWRtkwqqYzMvOIJhgh5NSrYuhpyE3OkP9ZH7 vhyZBV4tsiCaxYSj4d/0XcHfnlmX60sD+abtx5uZSTplTpQ8XoTDLpx+JyfSDpSo5yi1 0JX8wRb1d7OzNykFR338QH5g4D+CPGuzON5XyMccXp7xUhIsMBY9fWkL65561rWnLAh2 Ma7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Kgu7lcFf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kn16-20020a170903079000b001bbd81eaabasi1195322plb.57.2023.07.27.05.00.40; Thu, 27 Jul 2023 05:00:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Kgu7lcFf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232196AbjG0LcH (ORCPT + 99 others); Thu, 27 Jul 2023 07:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231829AbjG0LcE (ORCPT ); Thu, 27 Jul 2023 07:32:04 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC5D92D73; Thu, 27 Jul 2023 04:31:36 -0700 (PDT) Received: from [192.168.100.7] (unknown [59.103.218.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madras.collabora.co.uk (Postfix) with ESMTPSA id 95FF26607057; Thu, 27 Jul 2023 12:31:22 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1690457490; bh=QwGbrEQGGJI024TRKlZTazP2ydOrrqpiaW+jd0PA/0w=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=Kgu7lcFf3EpvlQmYW1IE3cyUf7qJnscHff1xjQoubuXKbU4ExNtRkW8Z8IHZDJqOs IXxru92rni9lSRWKvjObLgbWHUKMItwvi0xD5QSeHZPszFamTsoC4CNTYwU2mpx0B/ v28NqlvfD9ExtM+xDMnT0dbhwn29t/VQiujMYC2MI6BM6rifPilvU0HAiW2YKQJBUE 22SLiSUpW7dW0hwiw1a+niUbHy2W7Wlvx7k9HzaJY+q9S0ORwYH1U1AIxHV8KdCKiR BAxmXvTC/3WUHaYejcNER4w+b0xXgBo2BYfgOKoaqYubsKWC6kw4R49gcbkdHe7QYZ RI96tQJYcvr2w== Message-ID: Date: Thu, 27 Jul 2023 16:31:18 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: Muhammad Usama Anjum , "Kirill A. Shutemov" , =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Andrei Vagin , Danylo Mocherniuk , Alex Sierra , Alexander Viro , Andrew Morton , Axel Rasmussen , Christian Brauner , Cyrill Gorcunov , Dan Williams , David Hildenbrand , Greg KH , "Gustavo A . R . Silva" , "Liam R . Howlett" , Matthew Wilcox , Mike Rapoport , Nadav Amit , Pasha Tatashin , Paul Gofman , Peter Xu , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , Yang Shi , Yun Zhou , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, kernel@collabora.com Subject: Re: [v3] fs/proc/task_mmu: Implement IOCTL for efficient page table scanning Content-Language: en-US To: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= References: <20230713101415.108875-6-usama.anjum@collabora.com> <7eedf953-7cf6-c342-8fa8-b7626d69ab63@collabora.com> <382f4435-2088-08ce-20e9-bc1a15050861@collabora.com> <44eddc7d-fd68-1595-7e4f-e196abe37311@collabora.com> <1afedab8-5929-61e5-b0da-9c70dc01c254@collabora.com> <89c09085-19ab-462b-e3be-b4e492a85899@collabora.com> From: Muhammad Usama Anjum In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/27/23 4:26 PM, Michał Mirosław wrote: > On Thu, 27 Jul 2023 at 10:03, Muhammad Usama Anjum > wrote: >> On 7/27/23 2:10 AM, Michał Mirosław wrote: >>> On Wed, 26 Jul 2023 at 10:34, Muhammad Usama Anjum >>> wrote: >>>> On 7/25/23 11:05 PM, Michał Mirosław wrote: >>>>> On Tue, 25 Jul 2023 at 11:11, Muhammad Usama Anjum >>>>> wrote: > [...] >>>>> 2. For the address tagging part I'd prefer someone who knows how this >>>>> is used take a look. We're ignoring the tag (but clear it on return in >>>>> ->start) - so it doesn't matter for the ioctl() itself. >>>> I've added Kirill if he can give his thoughts about tagged memory. >>>> >>>> Right now we are removing the tags from all 3 pointers (start, end, vec) >>>> before using the pointers on kernel side. But we are overwriting and >>>> writing the walk ending address in start which user can read/use. >>>> >>>> I think we shouldn't over-write the start (and its tag) and instead return >>>> the ending walk address in new variable, walk_end. >>> >>> The overwrite of `start` is making the ioctl restart (continuation) >>> easier to handle. I prefer the current way, but it's not a strong >>> opinion. >> We shouldn't overwrite the start if we aren't gonna put the correct tag. So >> I've resorted to adding another variable `walk_end` to return the walk >> ending address. > > Yes. We have two options: > > 1. add new field and have the userspace check it and update start > itself to continue the scan, I've selected this option and sent v26 already: https://lore.kernel.org/all/20230727093637.1262110-1-usama.anjum@collabora.com > or: > 2. reconstruct the tag from either orignal `start` or `end` and have > the userspace re-set `start` if it wants to restart the scan instead > of continuing. In some case, compiler can put integrity checking metadata in the pointer's upper byte. So copying start or end's meta data would be wrong. > > (the second one, using `end`'s tag, might be the easiest for > userspace, as it can check `start` == `end` when deciding to continue > or restart). > > Best Regards > Michał Mirosław -- BR, Muhammad Usama Anjum