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=-6.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 66E9CC433B4 for ; Wed, 19 May 2021 14:04:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4BE3B611AD for ; Wed, 19 May 2021 14:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346915AbhESOF7 (ORCPT ); Wed, 19 May 2021 10:05:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56135 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240179AbhESOF4 (ORCPT ); Wed, 19 May 2021 10:05:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621433076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=q0X6ufyJH5fadmIknxn4nGcWs1xnqbL6wQGkTAtdW1c=; b=Tw8RKgQRCXH+fmkXIrxv+lnkjg+Y1aqhfdZycLors3SXtB9ey72H2FSEA15QtBFt/+IlF3 R1XyJO7Cp3tReLJlLHbQCHo5Agiw0KsQ8CaUrG4VXnHM8sn8Z3wJ29NKAFT3e1Xgs7DlU2 hUOR2RpO1DWbuVpTmx1jVrMrIRr/Cm4= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-397-xIAkG71hPs6wsS98J4OlYQ-1; Wed, 19 May 2021 10:04:34 -0400 X-MC-Unique: xIAkG71hPs6wsS98J4OlYQ-1 Received: by mail-qt1-f197.google.com with SMTP id o15-20020a05622a138fb02901e0ac29f6b2so9873143qtk.11 for ; Wed, 19 May 2021 07:04:34 -0700 (PDT) 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; bh=q0X6ufyJH5fadmIknxn4nGcWs1xnqbL6wQGkTAtdW1c=; b=ku4+pjaIHuV/JoTkfAuCAexG2rcWTCpAd1CBB3k6GVlH1SyvzAv/L0KbjeN7GYtFQS lDWmVB5fyGuKESM9INVeMruuIAXI4dT5OWrq8Q8GuHmC7HamuUDya2AkBBExkVCqYhBF DxlbuUox/V3uckTkaWcUqGh6De861B2Zkv9EWOqn9UQMXPR1eZApG8iVokbHXFSVWwpF XI2I9Z9SgZz3C/aDzZodm2ZFU+/jAIeWLPsWvVkwhpgec4BwDf1XbS8eW2DPUGD7cta0 g1fRKEAE3vIj0Q+FID8iUqWWA06TbvG/IO7GcKKNeeDXD2SOus7bcbWrPIQbOoVOVFL9 3O6g== X-Gm-Message-State: AOAM533xM+vYRHPev2rJ7/UmHSujzPezahWyW30UTcwU+pp7m+a4fnVW uPXqgjaVHJS/Fv6rcf7rm8HvRWa44Z9CD/7PfHHsJsSuRcr9z84MffW/8wntSU8lcC2dDkW6ybN F9PLTJm63xGFiVR4PXemJCX72 X-Received: by 2002:a05:6214:d87:: with SMTP id e7mr13037374qve.53.1621433074137; Wed, 19 May 2021 07:04:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6J2iQWttFbTggjwn9zrUjjmVN+9VOim38VY5Z448bl6PpUs3xqQHJcSoYTLuhDbSvYY+iNA== X-Received: by 2002:a05:6214:d87:: with SMTP id e7mr13037337qve.53.1621433073770; Wed, 19 May 2021 07:04:33 -0700 (PDT) Received: from t490s (bras-base-toroon474qw-grc-72-184-145-4-219.dsl.bell.ca. [184.145.4.219]) by smtp.gmail.com with ESMTPSA id b13sm802748qkl.16.2021.05.19.07.04.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 May 2021 07:04:33 -0700 (PDT) Date: Wed, 19 May 2021 10:04:32 -0400 From: Peter Xu To: Alistair Popple Cc: Jason Gunthorpe , linux-mm@kvack.org, nouveau@lists.freedesktop.org, bskeggs@redhat.com, akpm@linux-foundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, jhubbard@nvidia.com, rcampbell@nvidia.com, jglisse@redhat.com, hch@infradead.org, daniel@ffwll.ch, willy@infradead.org, bsingharora@gmail.com, Christoph Hellwig Subject: Re: [PATCH v8 5/8] mm: Device exclusive memory access Message-ID: References: <20210407084238.20443-1-apopple@nvidia.com> <2235357.HsqDk0zIjc@nvdebian> <2569629.VzlulnA7BY@nvdebian> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <2569629.VzlulnA7BY@nvdebian> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 19, 2021 at 11:11:55PM +1000, Alistair Popple wrote: > On Wednesday, 19 May 2021 10:15:41 PM AEST Peter Xu wrote: > > External email: Use caution opening links or attachments > > > > On Wed, May 19, 2021 at 09:04:53PM +1000, Alistair Popple wrote: > > > Failing fork() because we couldn't take a lock doesn't seem like the right > > > approach though, especially as there is already existing code that > > > retries. I get this adds complexity though, so would be happy to take a > > > look at cleaning copy_pte_range() up in future. > > > > Yes, I proposed that as this one won't affect any existing applications > > (unlike the existing ones) but only new userspace driver apps that will use > > this new atomic feature. > > > > IMHO it'll be a pity to add extra complexity and maintainance burden into > > fork() if only for keeping the "logical correctness of fork()" however the > > code never triggers. If we start with trylock we'll know whether people > > will use it, since people will complain with a reason when needed; however > > I still doubt whether a sane userspace device driver should fork() within > > busy interaction with the device underneath.. > > I will refrain from commenting on the sanity or otherwise of doing that :-) > > Agree such a scenario seems unlikely in practice (and possibly unreasonable). > Keeping the "logical correctness of fork()" still seems worthwhile to me, but > if the added complexity/maintenance burden for an admittedly fairly specific > feature is going to stop progress here I am happy to take the fail fork > approach. I could then possibly fix it up as a future clean up to > copy_pte_range(). Perhaps others have thoughts? Yes, it's more about making this series easier to be accepted, and it'll be great to have others' input. Btw, just to mention that I don't even think fail fork() on failed trylock() is against "logical correctness of fork()": IMHO it's still 100% correct just like most syscalls can return with -EAGAIN, that suggests the userspace to try again the syscall, and I hope that also works for fork(). I'd be more than glad to be corrected too. -- Peter Xu 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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 020B4C43460 for ; Wed, 19 May 2021 16:29:21 +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 C2DEE60241 for ; Wed, 19 May 2021 16:29:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2DEE60241 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=nouveau-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D0D26EE29; Wed, 19 May 2021 16:29:12 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 114206E1CE for ; Wed, 19 May 2021 14:04:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621433077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=q0X6ufyJH5fadmIknxn4nGcWs1xnqbL6wQGkTAtdW1c=; b=ailDZ4T5yH9yzP/6nWW8SEhnrD3t5BI3WDTv1DRsPkeyuVKdVHqh0FFgEJGJHo5yM+RuHG 6NY302fJ3dEFy7/N2ZzKjD1DDzM448teII4/BiNFGYZIEoNRMTUIpzgHoLX+DOX1rBsThF LF99FAjeGc01GXSTmJVkR8Y+FCWUqco= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-312-UpEAdZoAOPKyZft8naCkZA-1; Wed, 19 May 2021 10:04:34 -0400 X-MC-Unique: UpEAdZoAOPKyZft8naCkZA-1 Received: by mail-qt1-f198.google.com with SMTP id g13-20020ac8580d0000b02901e117526d0fso9905318qtg.5 for ; Wed, 19 May 2021 07:04:34 -0700 (PDT) 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; bh=q0X6ufyJH5fadmIknxn4nGcWs1xnqbL6wQGkTAtdW1c=; b=k/ME4V+CRQsquT9vt2lG8hn3ZrPfwsCEUK1vC1kmWg+2gE1mlTc5Ai3XeoqD3HrHrQ xvgQ0yi7WFzG33hXQs/MZoTpE0pQfo7seWPcRk8YMW+uRFgWLlTmOG7mojz7cbkEXX1V tfwlYEDC1xzaPFrRG6hib1cOeCkeO+z16DPQW9e93xzXHXJaYCNkIwXf6ZjMjaBklP7i sh7SJCmI+LnO7wsvd8PABHz1HaHk7Zz+kvqIB9twlRIgLXx0EbhQmlTCbM6Ajzh9B6wZ JACF6P4qf9YXa6n+p+8qAR2OkkyG0ob54v3d6W7LGZYvnNfym1j1folGNkW6hWDzIgV5 XX5Q== X-Gm-Message-State: AOAM530d28sK3w2LLmE8wLvw0F+BKHzuQlQUWr3Pi/exjofTtfljIelQ GJ26o4cfeJqsfBpQkU1QndXgIEBu9aOjbf/SxNlNAKRbpOSmdMyRID/G6SNhaPjHyslU9D53RwD 43AFpgFw/PjlkSgJxeOzYXwpm6A== X-Received: by 2002:a05:6214:d87:: with SMTP id e7mr13037365qve.53.1621433074135; Wed, 19 May 2021 07:04:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6J2iQWttFbTggjwn9zrUjjmVN+9VOim38VY5Z448bl6PpUs3xqQHJcSoYTLuhDbSvYY+iNA== X-Received: by 2002:a05:6214:d87:: with SMTP id e7mr13037337qve.53.1621433073770; Wed, 19 May 2021 07:04:33 -0700 (PDT) Received: from t490s (bras-base-toroon474qw-grc-72-184-145-4-219.dsl.bell.ca. [184.145.4.219]) by smtp.gmail.com with ESMTPSA id b13sm802748qkl.16.2021.05.19.07.04.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 May 2021 07:04:33 -0700 (PDT) Date: Wed, 19 May 2021 10:04:32 -0400 From: Peter Xu To: Alistair Popple Message-ID: References: <20210407084238.20443-1-apopple@nvidia.com> <2235357.HsqDk0zIjc@nvdebian> <2569629.VzlulnA7BY@nvdebian> MIME-Version: 1.0 In-Reply-To: <2569629.VzlulnA7BY@nvdebian> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Mailman-Approved-At: Wed, 19 May 2021 16:29:11 +0000 Subject: Re: [Nouveau] [PATCH v8 5/8] mm: Device exclusive memory access X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: rcampbell@nvidia.com, willy@infradead.org, daniel@ffwll.ch, linux-doc@vger.kernel.org, nouveau@lists.freedesktop.org, bsingharora@gmail.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, hch@infradead.org, linux-mm@kvack.org, bskeggs@redhat.com, Jason Gunthorpe , akpm@linux-foundation.org, Christoph Hellwig Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" On Wed, May 19, 2021 at 11:11:55PM +1000, Alistair Popple wrote: > On Wednesday, 19 May 2021 10:15:41 PM AEST Peter Xu wrote: > > External email: Use caution opening links or attachments > > > > On Wed, May 19, 2021 at 09:04:53PM +1000, Alistair Popple wrote: > > > Failing fork() because we couldn't take a lock doesn't seem like the right > > > approach though, especially as there is already existing code that > > > retries. I get this adds complexity though, so would be happy to take a > > > look at cleaning copy_pte_range() up in future. > > > > Yes, I proposed that as this one won't affect any existing applications > > (unlike the existing ones) but only new userspace driver apps that will use > > this new atomic feature. > > > > IMHO it'll be a pity to add extra complexity and maintainance burden into > > fork() if only for keeping the "logical correctness of fork()" however the > > code never triggers. If we start with trylock we'll know whether people > > will use it, since people will complain with a reason when needed; however > > I still doubt whether a sane userspace device driver should fork() within > > busy interaction with the device underneath.. > > I will refrain from commenting on the sanity or otherwise of doing that :-) > > Agree such a scenario seems unlikely in practice (and possibly unreasonable). > Keeping the "logical correctness of fork()" still seems worthwhile to me, but > if the added complexity/maintenance burden for an admittedly fairly specific > feature is going to stop progress here I am happy to take the fail fork > approach. I could then possibly fix it up as a future clean up to > copy_pte_range(). Perhaps others have thoughts? Yes, it's more about making this series easier to be accepted, and it'll be great to have others' input. Btw, just to mention that I don't even think fail fork() on failed trylock() is against "logical correctness of fork()": IMHO it's still 100% correct just like most syscalls can return with -EAGAIN, that suggests the userspace to try again the syscall, and I hope that also works for fork(). I'd be more than glad to be corrected too. -- Peter Xu _______________________________________________ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau 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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 B4A2EC433B4 for ; Wed, 19 May 2021 14:04:52 +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 74CF161074 for ; Wed, 19 May 2021 14:04:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74CF161074 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.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 CA8436E1CE; Wed, 19 May 2021 14:04:51 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 355296E1CE for ; Wed, 19 May 2021 14:04:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621433089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=q0X6ufyJH5fadmIknxn4nGcWs1xnqbL6wQGkTAtdW1c=; b=YJ9Sl+UpqDhjLciNBRI3ns8McCD2kWDjznAOgNh1Zr7HeAjoLj2REOkLLmsVAXAIcReH+L 23Oygl8Ahgdt5OI2riy467QCWxoEDJi+6dddMhwiQCpf/dYFuWK3yMwfyhCLdfFiC1l2JZ LDxSQ27MewB2MRLysdCr8IaM+RFt3i0= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-9-2Nj8MUucN0aUFV8s0v2Ytw-1; Wed, 19 May 2021 10:04:34 -0400 X-MC-Unique: 2Nj8MUucN0aUFV8s0v2Ytw-1 Received: by mail-qv1-f71.google.com with SMTP id fi6-20020a0562141a46b02901f064172b74so5522587qvb.3 for ; Wed, 19 May 2021 07:04:34 -0700 (PDT) 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; bh=q0X6ufyJH5fadmIknxn4nGcWs1xnqbL6wQGkTAtdW1c=; b=Nu5QhcugeII1Ea+uxm+3an+Hyozkg4Ane1VBDgrcX/3zCp13No+UbMva+Mb7DXA20y ZTpEDI7bmZSVBG1R5bb6jDXEnKh57aC5dqAjZr6w4B9Gs3cxgtMa+IGaU+OB0yNI3p8M 9c2AEm11u4d2yFGmC+xd5C87Byml/rHW1d2P4ORTvTbQ7Ws4J2Fl3hRMBMa5A9Bq3+zr M6HtF2ED5TkVA4JHooy/b4vt1CCHBTDaSznoyvR72OzBnPOFYvno1n67AhgEu0/0KX+J 9INmaffiJti8CFA8L6cGo28A1Pb2GazGKgRUQhQXPpd4nBc93SVy0j3AQ77wJZJsH65f XVCw== X-Gm-Message-State: AOAM532QVdz06LDO+cm9lpwpOcyWH72Gd/puUfLs1khwghnIUrEiM92p WlJiZyUau+WqZPEdrvb5odY5Y3Il+NK6L8Zmir18f8mpTdHjrdKnfFKuj4+Z6sqa6JhrDSsX6Z0 1PbqXmrKf8Ip0iSgyUoafrz+cFTgw X-Received: by 2002:a05:6214:d87:: with SMTP id e7mr13037375qve.53.1621433074137; Wed, 19 May 2021 07:04:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6J2iQWttFbTggjwn9zrUjjmVN+9VOim38VY5Z448bl6PpUs3xqQHJcSoYTLuhDbSvYY+iNA== X-Received: by 2002:a05:6214:d87:: with SMTP id e7mr13037337qve.53.1621433073770; Wed, 19 May 2021 07:04:33 -0700 (PDT) Received: from t490s (bras-base-toroon474qw-grc-72-184-145-4-219.dsl.bell.ca. [184.145.4.219]) by smtp.gmail.com with ESMTPSA id b13sm802748qkl.16.2021.05.19.07.04.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 May 2021 07:04:33 -0700 (PDT) Date: Wed, 19 May 2021 10:04:32 -0400 From: Peter Xu To: Alistair Popple Subject: Re: [PATCH v8 5/8] mm: Device exclusive memory access Message-ID: References: <20210407084238.20443-1-apopple@nvidia.com> <2235357.HsqDk0zIjc@nvdebian> <2569629.VzlulnA7BY@nvdebian> MIME-Version: 1.0 In-Reply-To: <2569629.VzlulnA7BY@nvdebian> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline 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: rcampbell@nvidia.com, willy@infradead.org, linux-doc@vger.kernel.org, nouveau@lists.freedesktop.org, bsingharora@gmail.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, hch@infradead.org, linux-mm@kvack.org, jglisse@redhat.com, bskeggs@redhat.com, Jason Gunthorpe , jhubbard@nvidia.com, akpm@linux-foundation.org, Christoph Hellwig Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed, May 19, 2021 at 11:11:55PM +1000, Alistair Popple wrote: > On Wednesday, 19 May 2021 10:15:41 PM AEST Peter Xu wrote: > > External email: Use caution opening links or attachments > > > > On Wed, May 19, 2021 at 09:04:53PM +1000, Alistair Popple wrote: > > > Failing fork() because we couldn't take a lock doesn't seem like the right > > > approach though, especially as there is already existing code that > > > retries. I get this adds complexity though, so would be happy to take a > > > look at cleaning copy_pte_range() up in future. > > > > Yes, I proposed that as this one won't affect any existing applications > > (unlike the existing ones) but only new userspace driver apps that will use > > this new atomic feature. > > > > IMHO it'll be a pity to add extra complexity and maintainance burden into > > fork() if only for keeping the "logical correctness of fork()" however the > > code never triggers. If we start with trylock we'll know whether people > > will use it, since people will complain with a reason when needed; however > > I still doubt whether a sane userspace device driver should fork() within > > busy interaction with the device underneath.. > > I will refrain from commenting on the sanity or otherwise of doing that :-) > > Agree such a scenario seems unlikely in practice (and possibly unreasonable). > Keeping the "logical correctness of fork()" still seems worthwhile to me, but > if the added complexity/maintenance burden for an admittedly fairly specific > feature is going to stop progress here I am happy to take the fail fork > approach. I could then possibly fix it up as a future clean up to > copy_pte_range(). Perhaps others have thoughts? Yes, it's more about making this series easier to be accepted, and it'll be great to have others' input. Btw, just to mention that I don't even think fail fork() on failed trylock() is against "logical correctness of fork()": IMHO it's still 100% correct just like most syscalls can return with -EAGAIN, that suggests the userspace to try again the syscall, and I hope that also works for fork(). I'd be more than glad to be corrected too. -- Peter Xu