Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp169002iof; Mon, 6 Jun 2022 00:27:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3Eh2ujYA3HpbatvBd13UE/LWrVDXw03WhBb+OuS0KDTp9T/5M6RWqM6ZYbdM3QC4u0zDa X-Received: by 2002:a17:902:eccd:b0:166:3e34:4d05 with SMTP id a13-20020a170902eccd00b001663e344d05mr21722488plh.75.1654500471941; Mon, 06 Jun 2022 00:27:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654500471; cv=none; d=google.com; s=arc-20160816; b=E4cG6IbeTRRRnJ7AhKCZiYSLET88GS+K+0/SScJN+cxRFELb5QYCjc21cwqFwYat2o vIcuVaObglp+0OShbDq1rVGNWJ7W9ATpt6M6e2Ur9sShOqZyKz0CLZRh0xFl4xqinEdr 1342lReA+ei5HIhx1vKiqSp1H4zOCeeluQCb6aokCO3xaVp9pe72uDpUjQJf431HPS4h +9s+ZztLdK6nMdPdvCG60voDxujGPC5QDtJSAwM99HdasW9aIrcaB7SuXgh46pFWvUch zQ+/iE3GYEqP10naDwOBVI3FfGuxHojD3Ay5WXtVGUghtFXFFaWePwIdh7PjByYni3Dd j7tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=gOtzSuAWugs2jYxku/paVOt/7+PibxrDQ20HWjPBIW0=; b=QzU5B4XK4u9Nl88Q5OGGKz+yWLYSuVt/1uVR4QRSAj9q+UuVHdq0MZZuo89guTz+Qq j+bHgvD4jN5xvDjmKJeE7ZFUqF/QYNW+Jq9wWFgd2mJ2BkDxF1fUU7b4nsBjNhVEsTTU Gv5cQeFIYvZWWwTyPtHhguc8GqXS6RbUup/u8wrjcVpLC98BnQCYx6Q3FWU+Cb5dLSw4 mZ2bYbAwjbSR2h3YiRaQoqJgUwd0XIsxTMhlaQdv7TagVgcmEs/duD2KjWnnN6uxvJtS IA9eHGrS/kHnm6n2iZ3l4pGUGB76Ig4ehvCoyS+/7nfmap4VvNBXFg6aui40FmWjznIF 9+5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WnV4AnJa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q44-20020a17090a17af00b001e270ae2c0dsi23889476pja.62.2022.06.06.00.27.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 00:27:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WnV4AnJa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 45922BC97; Mon, 6 Jun 2022 00:01:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230248AbiFFHAK (ORCPT + 99 others); Mon, 6 Jun 2022 03:00:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbiFFG7y (ORCPT ); Mon, 6 Jun 2022 02:59:54 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 429B21163 for ; Sun, 5 Jun 2022 23:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654498792; 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=gOtzSuAWugs2jYxku/paVOt/7+PibxrDQ20HWjPBIW0=; b=WnV4AnJaCPf3NSm66W44mYCiJTp7qOqkS6qmKj5prxl0okt2sBzglihBxlhCnn3gN1nN0Z mP2E0bqsFZBfXotbEUTJ/uPEXqLmtpOCj29I6XmJnPrmxIEZy51QWmdPSGWZqnb6hNbEpl 9Age7RGUzP0tvSs3206NbFze4aqlPgQ= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-352-tOiRYh6UPtWBJEPaIbYfFA-1; Mon, 06 Jun 2022 02:59:50 -0400 X-MC-Unique: tOiRYh6UPtWBJEPaIbYfFA-1 Received: by mail-wr1-f69.google.com with SMTP id y2-20020adff142000000b0021581245fa1so1329914wro.7 for ; Sun, 05 Jun 2022 23:59:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=gOtzSuAWugs2jYxku/paVOt/7+PibxrDQ20HWjPBIW0=; b=VeJrtdBeOc7HoAXJLWRfcOO5GQYHmGTAuLRONY34U24BYggSOvZIBhYf0rUOmnBtiI bFa7Pwfgp5vrDGK/8C4SabNzGrEna7mi+eLUZOjUH4RNsCSwsxK3xkSoMOf08/blgovt thLbsVZOUesdJfKvvaeQz2c4vRZFMuCXEj2a0RE59Rm7vzbHZhwI9/L6DILGo7DW27y/ dpTTZy66+eUN81CTAQpz+BetA7Bxe7azpTxftGD06POOyf9Ge3r+HeE4sCS2qFMJvFqr WWpHsvO0JCUwfw5pZmK9nEfx4/MtCx2GE4ORX2KOxZdktCfUbZisjuDrUQe68KgKEncf PZgQ== X-Gm-Message-State: AOAM530ioFrDtROEshSN4KuJsq12Nkj5a8wkFgnvU2y8XCYarSkBxJ/6 MAWTZ4MvXCI4EJP7Jhu08/U3BmHz0VvEIYWXUNcgMUodGBZuLyxU1/1J0P3VIkcTte4M1sGP3d0 Td8F2v1+oObFWkuu1EZ401hFM X-Received: by 2002:a05:6000:1250:b0:210:3385:1c8b with SMTP id j16-20020a056000125000b0021033851c8bmr20109073wrx.623.1654498789650; Sun, 05 Jun 2022 23:59:49 -0700 (PDT) X-Received: by 2002:a05:6000:1250:b0:210:3385:1c8b with SMTP id j16-20020a056000125000b0021033851c8bmr20109059wrx.623.1654498789452; Sun, 05 Jun 2022 23:59:49 -0700 (PDT) Received: from fedora (nat-2.ign.cz. [91.219.240.2]) by smtp.gmail.com with ESMTPSA id j3-20020adfea43000000b0020d02262664sm14195815wrn.25.2022.06.05.23.59.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 23:59:48 -0700 (PDT) From: Vitaly Kuznetsov To: Masahiro Yamada Cc: Stephen Rothwell , Daniel Lezcano , Michael Kelley , Thomas Gleixner , linux-kernel@vger.kernel.org, "K . Y . Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , linux-hyperv@vger.kernel.org Subject: Re: [PATCH] clocksource: hyper-v: unexport __init-annotated hv_init_clocksource() In-Reply-To: <20220606050238.4162200-1-masahiroy@kernel.org> References: <20220606050238.4162200-1-masahiroy@kernel.org> Date: Mon, 06 Jun 2022 08:59:48 +0200 Message-ID: <87bkv6nuor.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Masahiro Yamada writes: > EXPORT_SYMBOL and __init is a bad combination because the .init.text > section is freed up after the initialization. Hence, modules cannot > use symbols annotated __init. The access to a freed symbol may end up > with kernel panic. > > modpost used to detect it, but it has been broken for a decade. > > Recently, I fixed modpost so it started to warn it again, then this > showed up in linux-next builds. > > There are two ways to fix it: > > - Remove __init > - Remove EXPORT_SYMBOL > > I chose the latter for this case because the only in-tree call-site, > arch/x86/kernel/cpu/mshyperv.c is never compiled as modular. > (CONFIG_HYPERVISOR_GUEST is boolean) > > Fixes: dd2cb348613b ("clocksource/drivers: Continue making Hyper-V clocksource ISA agnostic") > Reported-by: Stephen Rothwell > Signed-off-by: Masahiro Yamada > --- > > drivers/clocksource/hyperv_timer.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c > index ff188ab68496..bb47610bbd1c 100644 > --- a/drivers/clocksource/hyperv_timer.c > +++ b/drivers/clocksource/hyperv_timer.c > @@ -565,4 +565,3 @@ void __init hv_init_clocksource(void) > hv_sched_clock_offset = hv_read_reference_counter(); > hv_setup_sched_clock(read_hv_sched_clock_msr); > } > -EXPORT_SYMBOL_GPL(hv_init_clocksource); hv_init_clocksource() is not called from modules indeed, Reviewed-by: Vitaly Kuznetsov -- Vitaly