From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B23D1C433E0 for ; Fri, 12 Feb 2021 14:08:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 881F964E6C for ; Fri, 12 Feb 2021 14:08:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231627AbhBLOI1 (ORCPT ); Fri, 12 Feb 2021 09:08:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230174AbhBLOIQ (ORCPT ); Fri, 12 Feb 2021 09:08:16 -0500 Received: from mail-ua1-x92f.google.com (mail-ua1-x92f.google.com [IPv6:2607:f8b0:4864:20::92f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28972C061574; Fri, 12 Feb 2021 06:07:36 -0800 (PST) Received: by mail-ua1-x92f.google.com with SMTP id 67so2919022uao.1; Fri, 12 Feb 2021 06:07:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZZgcR0GXQOuQH7akp/dBCCzUPB9l3DB+PduIt221Fus=; b=LwSJnQ9Rf7hYrkwVZMRDzruVm0i2SDp4GtwQaF5CkTY3sHxUJlqfaTiUG7vBZXAysI WOoNc4c7DZJ90E9NDXYemZqoZftzw8SueDOMpxFaprmEeIWxuupOI48xua7PFgZI8TS2 MuCOrmK594Wcb0qTFn9LPw7GwTDNCwh9ncvLk+z6UtHWdktN5PfbBC/eqFOXGzQgSFRX 6mL3Xf0H7pWjn/qdsrKfrV6cCXfXLaCFmLaPkchfA9iTlodzvz2zBkByjRw0CbCAg6C2 v4D6aUG3BvdFwACvMlf+yXZRTcYmAiy+DnflKtJ+Lel3IL+BqQIuvkeYDunVhLXs8/TL 78+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZZgcR0GXQOuQH7akp/dBCCzUPB9l3DB+PduIt221Fus=; b=RyTUMBqqRIyEooJbQzYse8B8ZLYEyk7BhiabW6fyVxtChtaH/fzT2PrlwFY44JpBHO DxsPf8jEdXUFH+E6nQgxXLC6+JyO0ybPtrRdBZWp/kTE2PAVMmvtnY+vPmiCXHrHA9T8 w62EcOBeEzMds5sqqwB/475YE9HN81kQhZn7A8JhwbdJcG5/Si3DAuzoxu6XN3r+UCAe NQalUkTO5QqIjEpftJf4WiIQThWos78TA3VS14UXOvu1OnmNqRTMwZmEC3VDTxjtMpt8 LE32kRq6eLMQYZtg5csHYK2LNBdrxTQ2ssHuyE5U/TigyVxQUYZ4aYRBqHvTADiQhlcM HW1A== X-Gm-Message-State: AOAM531tynFG4FL6PfeGy583hzRdiBEZlacKVv+l2qe6qogdgo2gAj6T vK+yV92usjV8UfXUbfE8TUWcoJoaFFhPrKcJ9wpboVRByxNCtQ== X-Google-Smtp-Source: ABdhPJx92cVtlR8nyOwrnpqoQUY5gXSHyY10cEr8vAqdJP/vf9c/d7G1G7CJoeOQjImt0yesSCuQ+D8ttFlZsja+xBE= X-Received: by 2002:ab0:338d:: with SMTP id y13mr1550050uap.64.1613138855360; Fri, 12 Feb 2021 06:07:35 -0800 (PST) MIME-Version: 1.0 References: <20210205163752.11932-1-chris@chris-wilson.co.uk> <20210205220012.1983-1-chris@chris-wilson.co.uk> In-Reply-To: From: Emil Velikov Date: Fri, 12 Feb 2021 14:07:23 +0000 Message-ID: Subject: Re: [PATCH v3] kcmp: Support selection of SYS_kcmp without CHECKPOINT_RESTORE To: Simon Ser Cc: Chris Wilson , Will Drewry , Kees Cook , Daniel Vetter , Intel Graphics Development , Rasmus Villemoes , "Linux-Kernel@Vger. Kernel. Org" , ML dri-devel , Andy Lutomirski , Cyrill Gorcunov , "# 3.13+" , Andrew Morton Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 12 Feb 2021 at 13:14, Simon Ser wrote: > > On Friday, February 12th, 2021 at 1:57 PM, Emil Velikov wrote: > > > On Fri, 5 Feb 2021 at 22:01, Chris Wilson wrote: > > > > > > Userspace has discovered the functionality offered by SYS_kcmp and has > > > started to depend upon it. In particular, Mesa uses SYS_kcmp for > > > os_same_file_description() in order to identify when two fd (e.g. device > > > or dmabuf) > > > > As you rightfully point out, SYS_kcmp is a bit of a two edged sword. > > While you mention the CONFIG issue, there is also a portability aspect > > (mesa runs on more than just linux) and as well as sandbox filtering > > of the extra syscall. > > > > Last time I looked, the latter was still an issue and mesa was using > > SYS_kcmp to compare device node fds. > > A far shorter and more portable solution is possible, so let me > > prepare a Mesa patch. > > Comparing two DMA-BUFs can be done with their inode number, I think. > > Comparing two device FDs is more subtle, because of GEM handle > ref'counting. You sometimes really want to check whether two FDs are > backed by the same file *description*. See [1] for details. > Thanks for the correction and the reference. Seems like I've short circuited file description table vs file descriptor. Emil From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A055C433E6 for ; Fri, 12 Feb 2021 14:07:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3A0F464E6C for ; Fri, 12 Feb 2021 14:07:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A0F464E6C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AE5026E17C; Fri, 12 Feb 2021 14:07:37 +0000 (UTC) Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C5E56E17C; Fri, 12 Feb 2021 14:07:36 +0000 (UTC) Received: by mail-ua1-x931.google.com with SMTP id 30so2909990uac.7; Fri, 12 Feb 2021 06:07:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZZgcR0GXQOuQH7akp/dBCCzUPB9l3DB+PduIt221Fus=; b=LwSJnQ9Rf7hYrkwVZMRDzruVm0i2SDp4GtwQaF5CkTY3sHxUJlqfaTiUG7vBZXAysI WOoNc4c7DZJ90E9NDXYemZqoZftzw8SueDOMpxFaprmEeIWxuupOI48xua7PFgZI8TS2 MuCOrmK594Wcb0qTFn9LPw7GwTDNCwh9ncvLk+z6UtHWdktN5PfbBC/eqFOXGzQgSFRX 6mL3Xf0H7pWjn/qdsrKfrV6cCXfXLaCFmLaPkchfA9iTlodzvz2zBkByjRw0CbCAg6C2 v4D6aUG3BvdFwACvMlf+yXZRTcYmAiy+DnflKtJ+Lel3IL+BqQIuvkeYDunVhLXs8/TL 78+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZZgcR0GXQOuQH7akp/dBCCzUPB9l3DB+PduIt221Fus=; b=RVXru1YL0RHJl6ukUNLvbbwTTFv7QQ8SMnEvZKmM9aka6yBnygcG/D5go2VQtzgBR6 sfggL2BU97jc50aiEA/42+eNiaAWKer48wi9LnYso0JOAox32Qq5UIjCOwsQpvLD4UcK 0BbRCUd18rbqsJH14iSQdw+mLRJWhcBUv9LVc/2a3TFtG1kyJY0bxHvnqF71VxH5UEAC ji26QRf5kamkkE4pq+ggDnNklRdZsQTTqQFkzKwnqp2KGlNyP9gKp51C3RqZ0tbnNNyA mvMP92tsyEltx9RuBDDK1WZCVce2ZmaHsyq1o/HqOZk3/1sS+EEhOGTf3fXYCF7Cxjz/ +oWA== X-Gm-Message-State: AOAM530wEP5PQpeL3jUzWrnF4AFOvWnDHxap10S5F94e2SSVWAtyUQ1E 6wVT+mA7IQQPuCUrz8dWtz/Gfw6t7N5VvnJidEI= X-Google-Smtp-Source: ABdhPJx92cVtlR8nyOwrnpqoQUY5gXSHyY10cEr8vAqdJP/vf9c/d7G1G7CJoeOQjImt0yesSCuQ+D8ttFlZsja+xBE= X-Received: by 2002:ab0:338d:: with SMTP id y13mr1550050uap.64.1613138855360; Fri, 12 Feb 2021 06:07:35 -0800 (PST) MIME-Version: 1.0 References: <20210205163752.11932-1-chris@chris-wilson.co.uk> <20210205220012.1983-1-chris@chris-wilson.co.uk> In-Reply-To: From: Emil Velikov Date: Fri, 12 Feb 2021 14:07:23 +0000 Message-ID: Subject: Re: [PATCH v3] kcmp: Support selection of SYS_kcmp without CHECKPOINT_RESTORE To: Simon Ser X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Drewry , Kees Cook , Daniel Vetter , Intel Graphics Development , Rasmus Villemoes , "Linux-Kernel@Vger. Kernel. Org" , ML dri-devel , Chris Wilson , Cyrill Gorcunov , "# 3.13+" , Andrew Morton , Andy Lutomirski Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, 12 Feb 2021 at 13:14, Simon Ser wrote: > > On Friday, February 12th, 2021 at 1:57 PM, Emil Velikov wrote: > > > On Fri, 5 Feb 2021 at 22:01, Chris Wilson wrote: > > > > > > Userspace has discovered the functionality offered by SYS_kcmp and has > > > started to depend upon it. In particular, Mesa uses SYS_kcmp for > > > os_same_file_description() in order to identify when two fd (e.g. device > > > or dmabuf) > > > > As you rightfully point out, SYS_kcmp is a bit of a two edged sword. > > While you mention the CONFIG issue, there is also a portability aspect > > (mesa runs on more than just linux) and as well as sandbox filtering > > of the extra syscall. > > > > Last time I looked, the latter was still an issue and mesa was using > > SYS_kcmp to compare device node fds. > > A far shorter and more portable solution is possible, so let me > > prepare a Mesa patch. > > Comparing two DMA-BUFs can be done with their inode number, I think. > > Comparing two device FDs is more subtle, because of GEM handle > ref'counting. You sometimes really want to check whether two FDs are > backed by the same file *description*. See [1] for details. > Thanks for the correction and the reference. Seems like I've short circuited file description table vs file descriptor. Emil _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FD72C433DB for ; Fri, 12 Feb 2021 14:07:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D196D64E77 for ; Fri, 12 Feb 2021 14:07:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D196D64E77 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0BFFC6E5BF; Fri, 12 Feb 2021 14:07:38 +0000 (UTC) Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C5E56E17C; Fri, 12 Feb 2021 14:07:36 +0000 (UTC) Received: by mail-ua1-x931.google.com with SMTP id 30so2909990uac.7; Fri, 12 Feb 2021 06:07:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZZgcR0GXQOuQH7akp/dBCCzUPB9l3DB+PduIt221Fus=; b=LwSJnQ9Rf7hYrkwVZMRDzruVm0i2SDp4GtwQaF5CkTY3sHxUJlqfaTiUG7vBZXAysI WOoNc4c7DZJ90E9NDXYemZqoZftzw8SueDOMpxFaprmEeIWxuupOI48xua7PFgZI8TS2 MuCOrmK594Wcb0qTFn9LPw7GwTDNCwh9ncvLk+z6UtHWdktN5PfbBC/eqFOXGzQgSFRX 6mL3Xf0H7pWjn/qdsrKfrV6cCXfXLaCFmLaPkchfA9iTlodzvz2zBkByjRw0CbCAg6C2 v4D6aUG3BvdFwACvMlf+yXZRTcYmAiy+DnflKtJ+Lel3IL+BqQIuvkeYDunVhLXs8/TL 78+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZZgcR0GXQOuQH7akp/dBCCzUPB9l3DB+PduIt221Fus=; b=RVXru1YL0RHJl6ukUNLvbbwTTFv7QQ8SMnEvZKmM9aka6yBnygcG/D5go2VQtzgBR6 sfggL2BU97jc50aiEA/42+eNiaAWKer48wi9LnYso0JOAox32Qq5UIjCOwsQpvLD4UcK 0BbRCUd18rbqsJH14iSQdw+mLRJWhcBUv9LVc/2a3TFtG1kyJY0bxHvnqF71VxH5UEAC ji26QRf5kamkkE4pq+ggDnNklRdZsQTTqQFkzKwnqp2KGlNyP9gKp51C3RqZ0tbnNNyA mvMP92tsyEltx9RuBDDK1WZCVce2ZmaHsyq1o/HqOZk3/1sS+EEhOGTf3fXYCF7Cxjz/ +oWA== X-Gm-Message-State: AOAM530wEP5PQpeL3jUzWrnF4AFOvWnDHxap10S5F94e2SSVWAtyUQ1E 6wVT+mA7IQQPuCUrz8dWtz/Gfw6t7N5VvnJidEI= X-Google-Smtp-Source: ABdhPJx92cVtlR8nyOwrnpqoQUY5gXSHyY10cEr8vAqdJP/vf9c/d7G1G7CJoeOQjImt0yesSCuQ+D8ttFlZsja+xBE= X-Received: by 2002:ab0:338d:: with SMTP id y13mr1550050uap.64.1613138855360; Fri, 12 Feb 2021 06:07:35 -0800 (PST) MIME-Version: 1.0 References: <20210205163752.11932-1-chris@chris-wilson.co.uk> <20210205220012.1983-1-chris@chris-wilson.co.uk> In-Reply-To: From: Emil Velikov Date: Fri, 12 Feb 2021 14:07:23 +0000 Message-ID: To: Simon Ser Subject: Re: [Intel-gfx] [PATCH v3] kcmp: Support selection of SYS_kcmp without CHECKPOINT_RESTORE X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Drewry , Kees Cook , Daniel Vetter , Intel Graphics Development , Rasmus Villemoes , "Linux-Kernel@Vger. Kernel. Org" , ML dri-devel , Chris Wilson , Cyrill Gorcunov , "# 3.13+" , Andrew Morton , Andy Lutomirski Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Fri, 12 Feb 2021 at 13:14, Simon Ser wrote: > > On Friday, February 12th, 2021 at 1:57 PM, Emil Velikov wrote: > > > On Fri, 5 Feb 2021 at 22:01, Chris Wilson wrote: > > > > > > Userspace has discovered the functionality offered by SYS_kcmp and has > > > started to depend upon it. In particular, Mesa uses SYS_kcmp for > > > os_same_file_description() in order to identify when two fd (e.g. device > > > or dmabuf) > > > > As you rightfully point out, SYS_kcmp is a bit of a two edged sword. > > While you mention the CONFIG issue, there is also a portability aspect > > (mesa runs on more than just linux) and as well as sandbox filtering > > of the extra syscall. > > > > Last time I looked, the latter was still an issue and mesa was using > > SYS_kcmp to compare device node fds. > > A far shorter and more portable solution is possible, so let me > > prepare a Mesa patch. > > Comparing two DMA-BUFs can be done with their inode number, I think. > > Comparing two device FDs is more subtle, because of GEM handle > ref'counting. You sometimes really want to check whether two FDs are > backed by the same file *description*. See [1] for details. > Thanks for the correction and the reference. Seems like I've short circuited file description table vs file descriptor. Emil _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx