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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0A21C7619A for ; Wed, 5 Apr 2023 12:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=P5HRlIRfBYptXFrZDXO+hOU2K/ukkiiXrmsvhPE7f/c=; b=Wta1TbGMMA5AuG leI8BJENEP+HtPd6p8I9kUzMIs/AC9+vDdIR09ZaMngsxY2LQjH2eBsR5HaCGSGk5aPmThsTzVtAE qK+OaU4Vgo7rl1HLy5/JNAychU7YuzCHcIjQicP0jR+y86Bs/gcoKbtW+DGXTJ8DRZ9BCe8jr22l9 9CBlyonMfFUiKGxR3O43BRQH++mt7XfRNSEVvSoYSnyXIr5edlr2lIBp53NPbyd0G4TBJG1T8nsHJ 9sjpZaO9i92F+7bxbsSH0cQwwp33HfsSH19GTkWu4UeVA+5OCeZCKvtqx2IJLb38zcqj6LBHIqikK FBOgSb5EAmN8c9xkAYRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pk2Vr-004R3x-0R; Wed, 05 Apr 2023 12:45:19 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pk2Vo-004R1w-0b for linux-arm-kernel@lists.infradead.org; Wed, 05 Apr 2023 12:45:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680698713; 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=rJlvbrDO3MZW25EtVUfp0HoO311UYJgGKtfX/KEqF/k=; b=SrJd9q5PEWnm5iJHOam8DsbY6dQ0mmC8NtVSLxqsn1x0TlAuplfYykVTC8IWb39ooMFORp zsgStR90N6Jro1gATcfstsitzbTA6rZI00nO81q6iPlg5fYxHia8DZQdbl4qNwffF8n69S O/Y3zECBjA8TqB+Y2g96Jyv4GZWkfE4= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-299-TIjBMGuoNKSlUSFTpEv4gg-1; Wed, 05 Apr 2023 08:45:10 -0400 X-MC-Unique: TIjBMGuoNKSlUSFTpEv4gg-1 Received: by mail-qk1-f199.google.com with SMTP id s190-20020ae9dec7000000b00746b7fae197so4834311qkf.12 for ; Wed, 05 Apr 2023 05:45:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680698709; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rJlvbrDO3MZW25EtVUfp0HoO311UYJgGKtfX/KEqF/k=; b=WgJ4Q/zj/MEGEWOG+hMl2mE1IcO8WBQ4xFmOOKkQRoHnbSjIKNeo5Nkti3K3/4tmO6 9f/TxUo7eQueT59hZ8QN7E1xXv1m70/3wHX/rL7n1JRNiSicFdpvOF+ZtSyX+I6OKOAA ppwpNZ2hAdjguzlEbYGJ4Xk75dD0sbrb09Sn+oIyt5l3G6YQwsNZ+Tjw4o/sWW2/7WNW LpMOUrSWL6FqccEKImmbhiVeIsZy5cA4ftCjz61rwTo5yeaKYXzHqP41EiB8Yp+xHjvw 4pcRkC9LQINs84aq51pxkZrWwBhkfLGQEg1AU4SR4H2y45tBsWh6mjX+qjwcHxkUOU7C fEzQ== X-Gm-Message-State: AAQBX9edz/eX9Q594I4BaLpNUV1HGTpXfQtKj7HPg21l4jpKPdtUtyOy Opy3f8nZMne/6EM47IOjCSpB9tTFCdmP9XXHUpgNKhpxUWIK9YEU5T257jV1N0HbfNCOH2absC/ 6DnRVIHI/iCdeFJ9eLDjRlkwGyZkcL4/0loY= X-Received: by 2002:a05:622a:1716:b0:3e4:eb03:687d with SMTP id h22-20020a05622a171600b003e4eb03687dmr4303566qtk.44.1680698709751; Wed, 05 Apr 2023 05:45:09 -0700 (PDT) X-Google-Smtp-Source: AKy350YM3193lIgKl2aWj9mqpkVtYuh0l9dX5dcxwgxaNjVBgfvhxy0L8/57jtC9NbW/iCG3sMx10Q== X-Received: by 2002:a05:622a:1716:b0:3e4:eb03:687d with SMTP id h22-20020a05622a171600b003e4eb03687dmr4303502qtk.44.1680698709447; Wed, 05 Apr 2023 05:45:09 -0700 (PDT) Received: from vschneid.remote.csb ([154.57.232.159]) by smtp.gmail.com with ESMTPSA id t186-20020a37aac3000000b00746b7372d62sm4415939qke.27.2023.04.05.05.45.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 05:45:08 -0700 (PDT) From: Valentin Schneider To: Frederic Weisbecker , Peter Zijlstra Cc: Yair Podemsky , linux@armlinux.org.uk, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, will@kernel.org, aneesh.kumar@linux.ibm.com, akpm@linux-foundation.org, arnd@arndb.de, keescook@chromium.org, paulmck@kernel.org, jpoimboe@kernel.org, samitolvanen@google.com, ardb@kernel.org, juerg.haefliger@canonical.com, rmk+kernel@armlinux.org.uk, geert+renesas@glider.be, tony@atomide.com, linus.walleij@linaro.org, sebastian.reichel@collabora.com, nick.hawkins@hpe.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, mtosatti@redhat.com, dhildenb@redhat.com, alougovs@redhat.com Subject: Re: [PATCH 3/3] mm/mmu_gather: send tlb_remove_table_smp_sync IPI only to CPUs in kernel mode In-Reply-To: References: <20230404134224.137038-1-ypodemsk@redhat.com> <20230404134224.137038-4-ypodemsk@redhat.com> <20230405114148.GA351571@hirez.programming.kicks-ass.net> Date: Wed, 05 Apr 2023 13:45:02 +0100 Message-ID: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230405_054516_325660_0928A2AC X-CRM114-Status: GOOD ( 14.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 05/04/23 14:05, Frederic Weisbecker wrote: > static void smp_call_function_many_cond(const struct cpumask *mask, > smp_call_func_t func, void *info, > @@ -946,10 +948,13 @@ static void smp_call_function_many_cond(const struct cpumask *mask, > #endif > cfd_seq_store(pcpu->seq_queue, this_cpu, cpu, CFD_SEQ_QUEUE); > if (llist_add(&csd->node.llist, &per_cpu(call_single_queue, cpu))) { > - __cpumask_set_cpu(cpu, cfd->cpumask_ipi); > - nr_cpus++; > - last_cpu = cpu; > - > + if (!(scf_flags & SCF_NO_USER) || > + !IS_ENABLED(CONFIG_GENERIC_ENTRY) || > + ct_state_cpu(cpu) != CONTEXT_USER) { > + __cpumask_set_cpu(cpu, cfd->cpumask_ipi); > + nr_cpus++; > + last_cpu = cpu; > + } I've been hacking on something like this (CSD deferral for NOHZ-full), and unfortunately this uses the CPU-local cfd_data storage thing, which means any further smp_call_function() from the same CPU to the same destination will spin on csd_lock_wait(), waiting for the target CPU to come out of userspace and flush the queue - and we've just spent extra effort into *not* disturbing it, so that'll take a while :( I don't have much that is in a shareable state yet (though I'm supposed to talk some more about it at OSPM in <2 weeks, so I'll have to get there), but ATM I'm playing with o a bitmask (like in [1]) for coalescable stuff such as do_sync_core() for x86 instruction patching o a CSD-like queue for things that need to pass data around, using statically-allocated storage (so with a limit on how much it can be used) - the alternative being allocating a struct on sending, since you don't have a bound on how much crap you can queue on an undisturbed NOHZ-full CPU... [1]: https://lore.kernel.org/all/20210929152429.067060646@infradead.org/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel