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=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 5B645C4361B for ; Wed, 16 Dec 2020 16:38:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0865E233EB for ; Wed, 16 Dec 2020 16:38:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726674AbgLPQiO (ORCPT ); Wed, 16 Dec 2020 11:38:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55422 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726364AbgLPQiN (ORCPT ); Wed, 16 Dec 2020 11:38:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608136607; 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=vs7gwDTNiuwyvUIyecGawTbsNjvRWskX1WlIMx8cvWU=; b=IOoe6aFmEIxdXuL/c9RJs5iaNRiG43MiXogzcriE/BKy5ZH5bKlOSrAFFIKoJ7NygaT+hK MxKzZItPaPSJEIrLlOARtmEnYZnQsRtp/ID9ZuOM2iE5tuJaGz0PrTxIruODWpC7Gv35TI +3wXzTDnCSGbsdZynoa7UIKEnaL4a+g= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-51-610QQ1eFNniERGSAVVuv9w-1; Wed, 16 Dec 2020 11:36:44 -0500 X-MC-Unique: 610QQ1eFNniERGSAVVuv9w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFA2F8B7E7C; Wed, 16 Dec 2020 16:36:15 +0000 (UTC) Received: from treble (ovpn-112-170.rdu2.redhat.com [10.10.112.170]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F26B3100AE3E; Wed, 16 Dec 2020 16:36:14 +0000 (UTC) Date: Wed, 16 Dec 2020 10:36:13 -0600 From: Josh Poimboeuf To: Peter Zijlstra Cc: Dexuan Cui , Ingo Molnar , Daniel Bristot de Oliveira , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , jeyu@kernel.org, ardb@kernel.org Subject: Re: [PATCH] jump_label: Fix usage in module __init Message-ID: <20201216163613.nyrd25vakui2tdiy@treble> References: <20201216092649.GM3040@hirez.programming.kicks-ass.net> <20201216105926.GS3092@hirez.programming.kicks-ass.net> <20201216135435.GV3092@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201216135435.GV3092@hirez.programming.kicks-ass.net> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 16, 2020 at 02:54:35PM +0100, Peter Zijlstra wrote: > Subject: jump_label: Fix usage in module __init > From: Peter Zijlstra > Date: Wed Dec 16 12:21:36 CET 2020 > > When the static_key is part of the module, and the module calls > static_key_inc/enable() from it's __init section *AND* has a > static_branch_*() user in that very same __init section, things go > wobbly. > > If the static_key lives outside the module, jump_label_add_module() > would append this module's sites to the key and jump_label_update() > would take the static_key_linked() branch and all would be fine. > > If all the sites are outside of __init, then everything will be fine > too. > > However, when all is aligned just as described above, > jump_label_update() calls __jump_label_update(.init = false) and we'll > not update sites in __init text. > > Fixes: 19483677684b ("jump_label: Annotate entries that operate on __init code earlier") > Reported-by: Dexuan Cui > Signed-off-by: Peter Zijlstra (Intel) > Tested-by: Jessica Yu Acked-by: Josh Poimboeuf -- Josh