Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4566143imm; Mon, 17 Sep 2018 16:44:26 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYUfpe1w8ShvYBOLUdfqdduuTEuMec34s086mvbdzbaxfBpdxEGk2FBtBcVsseujKtsBG0T X-Received: by 2002:a17:902:b68d:: with SMTP id c13-v6mr26673845pls.139.1537227866645; Mon, 17 Sep 2018 16:44:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537227866; cv=none; d=google.com; s=arc-20160816; b=M3JpiSvkLHIH6OPZtfC9pF/FzAXLovIxebKO+Q/Vr1IzgRwVCLYpprgNHpBdD9lj7K RabixSV6l0vHM3Q4ZCAvc0NwgC/UYzLeZPh8hlOMZgTdFs0+lTZ0cBZO9qTSGpdRR4hi MBdH4zN8ZC7dFeE1inZoh6P+jLHyZVWlmLPO5ArLXqJlU0X9GjZUbVcpE6XvzhmjeMXN B+h2zzem+miwoP7WStZUpkdfLsOiWgKYHPHkE6cEZvwEjZZzBBuA9OlMSeZekLUmVyPL KJTwJRYS6X9/W5P7yXw+mq3uW3OKxesWxjwOzufXlVsoFu0KDzqVhAxMT6eD4l/Qwxpd RMdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=wNDjIwP5itxgfriEtEmggE/dklly17J93UY94fgR/Vg=; b=zcQ+mL7Uca3rQq3SFNmWxkbZItKng4knwQwZQv2UXZonU4nH8OMwAsyzLJZdLJih0r zZW95OEMbSkD6skKlxWMbTYBt8NPt/2cUplngXA9cz+wFX+84v2722spfIdvHOziPLRy zfejpf7rBhAbPAxTs4wTWYzvIq+aTnwgB20KGK4ZFYsWL+1KYZppzdMrKTZfP0PvI8QR thn0xpzlbXn+IigMw9t0t269nmuJqmnHcpkzNpMKPb6XCj260ecmuaYyjbTTAnC3nVyL VLgtuSnW/t6V324012VN3YKz5/iX2XGUSPE9bCbO3jkqGSgVz3IYMu1CrAaA/DdRG65c iJpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HyX5ccqZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6-v6si15537769pgp.591.2018.09.17.16.44.11; Mon, 17 Sep 2018 16:44:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HyX5ccqZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727252AbeIRFNp (ORCPT + 99 others); Tue, 18 Sep 2018 01:13:45 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:33951 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725849AbeIRFNp (ORCPT ); Tue, 18 Sep 2018 01:13:45 -0400 Received: by mail-pg1-f193.google.com with SMTP id d19-v6so56783pgv.1 for ; Mon, 17 Sep 2018 16:44:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wNDjIwP5itxgfriEtEmggE/dklly17J93UY94fgR/Vg=; b=HyX5ccqZe3nApkJeLuwFSfbflqVhLs3X7d25Rglq7AfAhs8/NCEMex9Z6jx5EuOe/v INWDUHRRyBRnqHstCMQkZoJ+ojbacAFsktcP7cJiEJXr8JCeFfYMYBDj+90QuPdaZATn 5QTfXXN/7BGdkDU0omRnoDlJOz8xNbXbtYkag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=wNDjIwP5itxgfriEtEmggE/dklly17J93UY94fgR/Vg=; b=N1SPxJnDhwEr9IKIquQdrAwJoobDY9dPBpKIY0AiFsirCG5utIaN4TQv50E65GOqN7 iPXFnW2rXPcmJ5F599Eed73MDJe5R2uxjSlfTDdUNzsK1OhVHPoDuZQM2a4uhwrQeTTY DlkV4pFP9QsKCVtWMdqgAlNGk4/IkN+Bih4Xkrc+Yee4L4taZxf0UZuKw5WGFisb9nkN 76egU+6VdjEUlz1A+iuvnnkksERyYJjFO82CnpjToWP9O7JjmXogeykpFHz/OExpdz0q R1vCK5FN9TnyTSUNSdes3rYEP4j8qeaMxqVrL9ZVJvVRBrfoaaqpfvBlfZDtGzhxSiLs rajQ== X-Gm-Message-State: APzg51CUCdn4rhtJib2EDZ/01G0uEB3p4vGl7ArUGhmWTsbKp9R7zeaq cuXoXu9FzFBzir1b0MT+aMhyyA== X-Received: by 2002:a62:c60e:: with SMTP id m14-v6mr28238935pfg.40.1537227844915; Mon, 17 Sep 2018 16:44:04 -0700 (PDT) Received: from holly.lan ([209.121.128.187]) by smtp.gmail.com with ESMTPSA id w72-v6sm38471672pfa.26.2018.09.17.16.44.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Sep 2018 16:44:03 -0700 (PDT) Date: Mon, 17 Sep 2018 16:44:00 -0700 From: Daniel Thompson To: Julien Thierry Cc: James Morse , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, joel@joelfernandes.org, marc.zyngier@arm.com, mark.rutland@arm.com, christoffer.dall@arm.com, catalin.marinas@arm.com, will.deacon@arm.com Subject: Re: [PATCH v5 03/27] arm64: alternative: Apply alternatives early in boot process Message-ID: <20180917234400.ctq3w2u6fi5s5coj@holly.lan> References: <1535471497-38854-1-git-send-email-julien.thierry@arm.com> <1535471497-38854-4-git-send-email-julien.thierry@arm.com> <3becf020-b230-beb8-b304-d8097377f234@arm.com> <78781d82-e5c4-c590-6c0c-e7d2db456bf9@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <78781d82-e5c4-c590-6c0c-e7d2db456bf9@arm.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 12, 2018 at 05:49:09PM +0100, Julien Thierry wrote: > > > + __apply_alternatives(®ion, false, boot_capabilities); > > > +} > > > + > > > #ifdef CONFIG_MODULES > > > void apply_alternatives_module(void *start, size_t length) > > > { > > > > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > > > index 3bc1c8b..0d1e41e 100644 > > > --- a/arch/arm64/kernel/cpufeature.c > > > +++ b/arch/arm64/kernel/cpufeature.c > > > @@ -52,6 +52,8 @@ > > > DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS); > > > EXPORT_SYMBOL(cpu_hwcaps); > > > +unsigned long boot_capabilities; > > > + > > > /* > > > * Flag to indicate if we have computed the system wide > > > * capabilities based on the boot time active CPUs. This > > > @@ -1375,6 +1377,9 @@ static void __update_cpu_capabilities(const struct arm64_cpu_capabilities *caps, > > > if (!cpus_have_cap(caps->capability) && caps->desc) > > > pr_info("%s %s\n", info, caps->desc); > > > cpus_set_cap(caps->capability); > > > > Hmm, the bitmap behind cpus_set_cap() is what cpus_have_cap() in > > __apply_alternatives() looks at. If you had a call to __apply_alternatives after > > update_cpu_capabilities(SCOPE_BOOT_CPU), but before any others, it would only > > apply those alternatives... > > > > (I don't think there is a problem re-applying the same alternative, but I > > haven't checked). > > > > Interesting idea. If someone can confirm that patching alternatives twice is > safe, I think it would make things simpler. Early versions of this patch applied the alternatives twice. I never noticed any problems with double patching (second time round it will write out code that is identical to what is already there so it is merely inefficient rather than unsafe. Daniel.