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=-5.8 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 1B74AC432BE for ; Tue, 10 Aug 2021 08:52:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0231260ED8 for ; Tue, 10 Aug 2021 08:52:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238308AbhHJIwV (ORCPT ); Tue, 10 Aug 2021 04:52:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238301AbhHJIwT (ORCPT ); Tue, 10 Aug 2021 04:52:19 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A55AC0613D3; Tue, 10 Aug 2021 01:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=5HFVU4zKvq7KOn2kbFJ3SlnKg42hr+xQZyP+w5iBMjs=; b=Pri6jt6Ntz8OhzO1q8kXc8wB4L NXgTPuNxkc4hPjCIQwUZeQjTZpQWGnLiEyhxYGL4To+pCTHiSupbU+UDbtdDcwgQCvK3VkulEbR92 cemTTqGqYHFLK8WfnnuoqLi1UNW37APPfY4dgiyFUueSS/HHm8MWCWMGBl1e6FUbFsvPM5BjSkJ4+ lXYDb5E5P9qNOuj0OIC6aCvG3qugYeUDODRNNvU1VQQQexSbIOLaZTOKv4Ejl/8QrYRyPojvlmzXe qpQWpvHKAMAXrC/xl0wcgZOQiow1HEBJwJxz4BuGC5212oDSWrwgc18Ci39e+Z0w586dHaJQWsVZK gP3OTwZQ==; Received: from hch by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDNTX-00Bukr-Pu; Tue, 10 Aug 2021 08:51:23 +0000 Date: Tue, 10 Aug 2021 09:51:07 +0100 From: Christoph Hellwig To: Alex Williamson Cc: Jason Gunthorpe , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, peterx@redhat.com Subject: Re: [PATCH 3/7] vfio/pci: Use vfio_device_unmap_mapping_range() Message-ID: References: <162818167535.1511194.6614962507750594786.stgit@omen> <162818325518.1511194.1243290800645603609.stgit@omen> <20210806010418.GF1672295@nvidia.com> <20210806141745.1d8c3e0a.alex.williamson@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210806141745.1d8c3e0a.alex.williamson@redhat.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 06, 2021 at 02:17:45PM -0600, Alex Williamson wrote: > > Now that this is simplified so much, I wonder if we can drop the > > memory_lock and just use the dev_set->lock? > > > > That avoids the whole down_write_trylock thing and makes it much more > > understandable? > > Hmm, that would make this case a lot easier, but using a mutex, > potentially shared across multiple devices, taken on every non-mmap > read/write doesn't really feel like a good trade-off when we're > currently using a per device rwsem to retain concurrency here. Thanks, Using a per-set percpu_rw_semaphore might be a good plan here. Probably makes sense to do that incrementally after this change, though.