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.9 required=3.0 tests=BAYES_00,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 DE29FC388F7 for ; Tue, 3 Nov 2020 06:52:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 65FB82227F for ; Tue, 3 Nov 2020 06:52:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="HJveoUgD"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="F4hKjsgL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 65FB82227F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 998F76B005C; Tue, 3 Nov 2020 01:52:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 947936B005D; Tue, 3 Nov 2020 01:52:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8100F6B0068; Tue, 3 Nov 2020 01:52:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0204.hostedemail.com [216.40.44.204]) by kanga.kvack.org (Postfix) with ESMTP id 5171F6B005C for ; Tue, 3 Nov 2020 01:52:30 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D7B09181AC9CB for ; Tue, 3 Nov 2020 06:52:29 +0000 (UTC) X-FDA: 77442188418.08.band01_4f119f5272b6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id B01A21819E76B for ; Tue, 3 Nov 2020 06:52:29 +0000 (UTC) X-HE-Tag: band01_4f119f5272b6 X-Filterd-Recvd-Size: 6625 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Nov 2020 06:52:28 +0000 (UTC) Date: Tue, 3 Nov 2020 07:52:25 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1604386347; 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=B/Cg7gELMzS7/FP4DlaM4mCIkHjMZOQ5NVP/5BMfjis=; b=HJveoUgDl8SjSD3w/jn8yikeAX1ydnR7Vfz+2ZFXt0j+VaBPcvg4vka5ZQY98nLbbqVKDy 19Wonz+AYgAsHiexZPt9EJGY0rWzfFMLM27SV1MOfvHVK1AQ5NNRKNtuSgqXb+fp28X2X6 8FtFMAHnjg74meDW0VxTsinqCh4iti3jYg0h9h/0hggtdVqb/wsJ/x9wiZcFoYYfmar++Q 7XDhJO2Q5GSyxn68+n12punHrHBtfr5Kl7oNO7v7gu4WXqwpwgQoH6jBA3fdsYf/yXfM6P PF+i94YyWQb+f5wErcY9ItFp9EiZX2vVnKS5nMSxkGAXTFlm8HmDEQdzQoo2Pg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1604386347; 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=B/Cg7gELMzS7/FP4DlaM4mCIkHjMZOQ5NVP/5BMfjis=; b=F4hKjsgLXyfQhgMhIbM7JHGHVdQ1PvHGX8WQJiT1RM9hd5QeSabL5hDt+DyK8xM9V4S22G gUHESrBbLNaQU9BA== From: "Ahmed S. Darwish" To: John Hubbard Cc: Jason Gunthorpe , Peter Xu , linux-kernel@vger.kernel.org, Linus Torvalds , Andrea Arcangeli , Andrew Morton , "Aneesh Kumar K.V" , Christoph Hellwig , Hugh Dickins , Jan Kara , Jann Horn , Kirill Shutemov , Kirill Tkhai , Leon Romanovsky , Linux-MM , Michal Hocko , Oleg Nesterov , Peter Zijlstra , Ingo Molnar , Will Deacon , Thomas Gleixner , Sebastian Siewior Subject: Re: [PATCH v2 2/2] mm: prevent gup_fast from racing with COW during fork Message-ID: <20201103065225.GA63301@lx-t490> References: <0-v2-dfe9ecdb6c74+2066-gup_fork_jgg@nvidia.com> <2-v2-dfe9ecdb6c74+2066-gup_fork_jgg@nvidia.com> <20201030225250.GB6357@xz-x1> <20201030235121.GQ2620339@nvidia.com> <20201103001712.GB52235@lx-t490> <20201103002532.GL2620339@nvidia.com> <20201103004133.GD52235@lx-t490> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Nov 02, 2020 at 06:20:45PM -0800, John Hubbard wrote: > On 11/2/20 4:41 PM, Ahmed S. Darwish wrote: > > On Mon, Nov 02, 2020 at 08:25:32PM -0400, Jason Gunthorpe wrote: > > > On Tue, Nov 03, 2020 at 01:17:12AM +0100, Ahmed S. Darwish wrote: > > > > > > > Please stick with the official exported API: raw_write_seqcount_begin(). > > > > > > How did you know this was 'offical exported API' ?? > > > > > > > All the official exported seqlock.h APIs are marked with verbose > > kernel-doc annotations on top. The rest are internal... > > > > OK, but no one here was able to deduce that, probably because there is not > enough consistency throughout the kernel to be able to assume such things--even > though your seqlock project is internally consistent. It's just not *quite* > enough communication. > > I think if we added the following it would be very nice: > The problem is, I've already documented seqlock.h to death.... There are more comments than code in there, and there is "seqlock.rst" under Documentation/ to further describe the big picture. There comes a point where you decide what level of documentation to add, and what level to skip. Because in the end, you don't want to confuse "Joe, the general driver developer" with too much details that's not relevant to their task at hand. (I work in the Embedded domain, and I've seen so much ugly code from embedded drivers/SoC developers already, sorry) See for example my reply to Linus, where any talk about the lockdep-free and barrier-free parts of the API was explicitly not mentioned in seqlock.rst. This was done on purpose: 1) you want to keep the generic case simple, but the special case do-able, 2) you want to encourage people to use the standard entry/exit points as much as possible. > a) Short comments to the "unofficial and internal" routines, identifying them as > such, and > > b) Short comments to the "official API for general use", also identifying > those as such. > I really think the already added kernel-doc is sufficient... See for example __read_seqcount_begin() and __read_seqcount_retry(). They begin with "__", but they are semi-external seqlock.h API that are used by VFS to avoid barriers. And these APIs are then polymorphised according to the write serialization lock type, and so on. So the most consistent way for seqlock.h was to use kernel-doc as *the* marker for exported functions. This is not unique to seqlock.h by the way. The same pattern is heavily used by the DRM folks. Yes, of course, we can add even more comments to seqlock.h, but then, I honestly think it would be too much that maybe people will just skip reading the whole thing altogether... > c) A comment about what makes "raw" actually raw, for seqlock. > That's already documented. What more can really be written than what's in seqlock.h below?? /** * raw_read_seqcount_begin() - begin a seqcount_t read section w/o lockdep /** * raw_seqcount_begin() - begin a seqcount_t read critical section w/o * lockdep and w/o counter stabilization /** * raw_write_seqcount_begin() - start a seqcount_t write section w/o lockdep /** * raw_write_seqcount_end() - end a seqcount_t write section w/o lockdep > > Since I'm proposing new work, I'll also offer to help, perhaps by putting together > a small patch to get it kicked off, if you approve of the idea. > Patches are always welcome of course, and please put me in Cc. I don't approve or deny anything though, that's the locking maintainers job :) Kind regards, > John Hubbard > NVIDIA -- Ahmed S. Darwish Linutronix GmbH