Received: by 2002:a05:6359:322:b0:b3:69d0:12d8 with SMTP id ef34csp486247rwb; Wed, 10 Aug 2022 11:29:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR6S5TtYFy32PXjhvSH/QIFTtJUVY3sdeKMGJEl3obZqXPMZWw0epxRytZTOyzyMOc4041Eb X-Received: by 2002:a17:902:a982:b0:170:d646:5851 with SMTP id bh2-20020a170902a98200b00170d6465851mr10510404plb.134.1660156141308; Wed, 10 Aug 2022 11:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660156141; cv=none; d=google.com; s=arc-20160816; b=E2smXg7PTx5QkAK4ADIN2jfP2iOe96x7k9g15aQhQjAQis7Si4bAZeQ4nG93v/Rtb+ P0oRWFEI/oElf3/EuHo2KVRQ7grAALGdOugQrpg7jAFjIK0o/OYnDH3OmHLB5SNYnA0L KXD4xPxi5ILNVIEkVx9y0myReky9RCBebjTzWBpi2jEAAPKADg+zltYU/Mr6FUAY5kSO gEN8VJOF0yTZVhvMEAz65cKFdlLqSSIucGc+yPIFyIkE+YiExIB8pPSiOvfV1iDkrGZ8 JIgJC618ckgVtxEsbjGBK+dQ5toOtZ4YCJFcNJ1RbFDLzi2JJJGLSVFr1RQpTyG9A6rn qPHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=3mPL2qUYzvfUqO6W4u/JE5PLLnPkmQWsGUIQpFeA8qs=; b=rlcdk3RkcJdkKOjcCmlHPwAQRm3TY20zyEpbY2svqNShcFLGpfI4ArfVocQCQImMdz 1P6A+Y8G3lT43U/80HSfYgtbWdBOQmAZiRcQBzXMliof6oP+wClIMWnLrY8u/gGIy7BR w/EZJMVNJzo5U/NyiqQV7kWmQY/Ts73qLqWU7gNDncs5pMZj2g8Sle6obXZUuZ1uVtOM +Mam5jkX0+VuQi0zLzdRTNSW66CyIOgpb53bExmMkZQjsH3U4hwNAC7IqJZzU8F8IybW d92tSGNHOroPvqQkD0Ka2AoXfY6vc/HWv51imz6Lz4alQ6aEUaK6+LJy6lRCbHuExDIk pSdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=T3LUdJuY; 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=NONE sp=NONE 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 w10-20020a65694a000000b0041c2c1c661esi3202974pgq.90.2022.08.10.11.28.47; Wed, 10 Aug 2022 11:29:01 -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=T3LUdJuY; 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=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232515AbiHJQxS (ORCPT + 99 others); Wed, 10 Aug 2022 12:53:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231707AbiHJQxQ (ORCPT ); Wed, 10 Aug 2022 12:53:16 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7292F1758F; Wed, 10 Aug 2022 09:53:15 -0700 (PDT) Received: from localhost (modemcable141.102-20-96.mc.videotron.ca [96.20.102.141]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: krisman) by madras.collabora.co.uk (Postfix) with ESMTPSA id 4E2A966019C1; Wed, 10 Aug 2022 17:53:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1660150394; bh=Dxlub/En694B1OVwDjJc8t0TX0eJ/thQHwv6ZgyAFss=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=T3LUdJuYm6pho9zz3V+Hu1Z+mBuq56NgJIlemP6tGh4klBENeaYswfS6PYiFv9Yv+ LupLBkAsxaJBuY6G+ziP1qBdhiUC0YejOfT99UGZZas8pKf9alnvLGekY4mXkP+PH/ 6H3EyQ7pR/zqWSbrksq4JXrmQ2G3HL6vXbOpp8XjblylzhMdD2rJsBs+UbOEoYDUH9 Q7P2oiY6Ic+dbTYxWxf3dFkwa143H2ke5lfFqYuH8GOmLDxdBOHzvnoz8CPezYwMYz coHlw2dK0qd118LITxpwIQRxH2tkJCSlF0FMS7NnjzLHJ5ExL9oJdpfaNfA2djr4Bk tTO5BA1GQZuPg== From: Gabriel Krisman Bertazi To: Peter.Enderborg@sony.com Cc: Muhammad Usama Anjum , Jonathan Corbet , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , Arnd Bergmann , Andrew Morton , Peter Zijlstra , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Shuah Khan , "open list:DOCUMENTATION" , open list , "open list:PROC FILESYSTEM" , "open list:ABI/API" , "open list:GENERIC INCLUDE/ASM HEADER FILES" , "open list:MEMORY MANAGEMENT" , "open list:PERFORMANCE EVENTS SUBSYSTEM" , "open list:KERNEL SELFTEST FRAMEWORK" , "kernel@collabora.com" Subject: Re: [PATCH 0/5] Add process_memwatch syscall References: <20220726161854.276359-1-usama.anjum@collabora.com> <456a8052-dfd2-e00c-6da7-fb5aa0c35f2c@sony.com> Date: Wed, 10 Aug 2022 12:53:07 -0400 In-Reply-To: <456a8052-dfd2-e00c-6da7-fb5aa0c35f2c@sony.com> (Peter's message of "Wed, 10 Aug 2022 09:22:02 +0000") Message-ID: <87tu6kghvw.fsf@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 "Peter.Enderborg@sony.com" writes: >> >> This syscall can be used by the CRIU project and other applications which >> require soft-dirty PTE bit information. The following operations are >> supported in this syscall: >> - Get the pages that are soft-dirty. >> - Clear the pages which are soft-dirty. >> - The optional flag to ignore the VM_SOFTDIRTY and only track per page >> soft-dirty PTE bit >> Hi Peter, (For context, I wrote a previous version of this patch and have been working with Usama on the current patch). > Why can it not be done as a IOCTL? Considering an ioctl is basically a namespaced syscall with extra-steps, surely we can do it :) There are a few reasons we haven't, though: 1) ioctl auditing/controling is much harder than syscall 2) There is a concern for performance, since this might be executed frequently by windows applications running over wine. There is an extra cost with unnecessary copy_[from/to]_user that we wanted to avoid, even though we haven't measured. 3) I originally wrote this at the time process_memadvise was merged. I felt it fits the same kind of interface exposed by process_memadvise/process_mrelease, recently merged. 4) Not obvious whether the ioctl would be against pagemap/clear_refs. Neither file name describes both input and output semantics. Obviously, all of those reasons can be worked around, and we can turn this into an ioctl. Thanks, -- Gabriel Krisman Bertazi