Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3084319pxk; Tue, 15 Sep 2020 09:38:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBFualQzTGZNhsRgL5+F3PqtLwWXDKcl0RCiN1skhVLnRkE6eroOptqqMTMn5InNMYn7KR X-Received: by 2002:a17:906:f43:: with SMTP id h3mr20411173ejj.338.1600187914140; Tue, 15 Sep 2020 09:38:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600187914; cv=none; d=google.com; s=arc-20160816; b=R0Pug3a6t29N4bYoux/ySkt1qVwPI39IdbPMhrn5dKQbFx8LM7r37vGsbGeQN8TvuC ri70BHNXk5DBMYzvKqzQlF85eo07IimJzEY0nuCFpirSvLTCHJxTcuxC+YeHtei5h38E yYwcsQf6Vt1QSJdxIhcHwMlo8mA9oeS2nwrHngVM9uzRPsbS0vWp3J0JQhtyvWTQmHWn d7Fu5jNkvAb0QYvG7ilsOsrawN8O0SMhauLA9Ah8cN6wGNKz9PHGB/nBDrzlaBeIsPll gZHgoq2fc5VieQ/ExU1m2jfQbD9esVbrsONQnqN8tdyjjjo3jGsaRcdKBPtSVLnPun8Q MUdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=CVAqHaHH33AZ+oBegMlU0v54kTGf0Fk88db9aLUGWW8=; b=aGO3DrpeG0pisR6Bz7a1gbG493bFqLd7oDbP6PmSOa/nIgI2pBk1xUConXk9WofY7f esfLsGiU1XjTNKfh8eqJx8aHyS3MTg5dJOXAbkgG6Wl6ql/tICABYg5irxC8Txobqpiu 1annOXslYUL1lnnNFknsWJMvW6d62AfyCKRWXYWV6du6ZDVkwnGIvQgagjNOocqY6r36 G+z9GcYCXuw+whvpsplsuT7d+EfKdn6cpjKt5Mz/qQ6AVZdNwm1K5XX2RNXC78ntvYLP xFuNzE9VLHhZfMpNZNKJDfeOEm6MKr4qjEn8p6eKklg6LMRlsJmHx4VhjRrK53OUQdJR PvxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=MD6yoZC5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si10416026eds.533.2020.09.15.09.38.11; Tue, 15 Sep 2020 09:38:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=MD6yoZC5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727668AbgIOQaq (ORCPT + 99 others); Tue, 15 Sep 2020 12:30:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727428AbgIOPxm (ORCPT ); Tue, 15 Sep 2020 11:53:42 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AAA6C06174A; Tue, 15 Sep 2020 08:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=CVAqHaHH33AZ+oBegMlU0v54kTGf0Fk88db9aLUGWW8=; b=MD6yoZC5JuFe13k0gswTa+6VHc g4JTWT6rT+8BAoHMIwKX++SkP98aCnLln4FDdwZpuelKE6Mb75hag72Jv5qUIe6TU2v3XRnbz9JQZ CriqRQt6lzqrj6q6AVplZ8AmGuIn7zrecAU/xn/ExmwUDdtbeaHSuTXbGEujWok75m78moty6Jlmj IAOVWmMX5Pf/BoY+H/XZnj39rsMuxreF+uItJMApilsxH070/Mgt/GkgMgtNtauLAD79gzusZndl3 WJceNNOMVa5z/bB5EEYVcnx/6BY36K1IGK7uK0GeYkmC93Qa2JyT8n123mOIBWrybwbc5yKQFGwNQ 0RWfhsHg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIDFK-0006B8-RR; Tue, 15 Sep 2020 15:51:55 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id D7B9E3006D0; Tue, 15 Sep 2020 17:51:50 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B9CAB203EB17D; Tue, 15 Sep 2020 17:51:50 +0200 (CEST) Date: Tue, 15 Sep 2020 17:51:50 +0200 From: peterz@infradead.org To: Oleg Nesterov Cc: Hou Tao , Ingo Molnar , Will Deacon , Dennis Zhou , Tejun Heo , Christoph Lameter , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [RFC PATCH] locking/percpu-rwsem: use this_cpu_{inc|dec}() for read_count Message-ID: <20200915155150.GD2674@hirez.programming.kicks-ass.net> References: <20200915140750.137881-1-houtao1@huawei.com> <20200915150610.GC2674@hirez.programming.kicks-ass.net> <20200915153113.GA6881@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200915153113.GA6881@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 15, 2020 at 05:31:14PM +0200, Oleg Nesterov wrote: > > So yeah, fs/super totally abuses percpu_rwsem, and yes, using it from > > IRQ context is totally out of spec. That said, we've (grudgingly) > > accomodated them before. > > Yes, I didn't expect percpu_up_ can be called from IRQ :/ Yeah, me neither. That's well out of spec for a blocking primitive in general. > > This seems to be a fairly long standing issue, and certainly not unique > > to ARM64 either (Power, and anyone else using asm-gemeric/percpu.h, > > should be similarly affected I think). The issue seems to stem from > > Oleg's original rewrite: > > > > a1fd3e24d8a4 ("percpu_rw_semaphore: reimplement to not block the readers unnecessarily") > > Not really... I think it was 70fe2f48152e ("aio: fix freeze protection of aio writes"). Ah, that came later? Fair enough, I'll change the Fixes line. > And iiuc io_uring does the same. Indeed, I just went through a bunch of the file_end_write() callers. > > and is certainly an understandable mistake. > > > > I'm torn on what to do, using this_cpu over __this_cpu is going to > > adversely affect code-gen (and possibly performance) for all the > > percpu-rwsem users that are not quite so 'creative'. > > Yes, but what else can we do? Well, I just talked about it with Will, there's a bunch of things we could do, but they're all quite ugly. My leading alternative was adding: percpu_down_read_irqsafe() / percpu_up_read_irqsafe(), which use local_irq_save() instead of preempt_disable(). But blergh.. Will also argued that by going with this patch, we'll get an affected workload when someone reports a performance regression, which I suppose is a bonus. Anyway, I'll rewrite the Changelog and stuff it in locking/urgent.