Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5863092imm; Wed, 12 Sep 2018 12:17:35 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZM8yLM/iDGspeRzgso4GzYCOh54+tqnWJuJWgqUIUmQ64nfvUo4IU+WSsIoDYKOTCHpLMc X-Received: by 2002:a17:902:be08:: with SMTP id r8-v6mr3868902pls.265.1536779855638; Wed, 12 Sep 2018 12:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536779855; cv=none; d=google.com; s=arc-20160816; b=HUJO9mIvmT4w+NRwYKg9C4Q0+mY8fKxH7Rl7RupB7n6UaJCzuUEyWGzFiKx7gM9RrU O2SlrRvA1OS+T5fuBA85ck6zr37FfaaezN1YuavND1spJfcjhojYE5mno3nGg+3DxUPU NAMpikK++4YmVD6oTLIwPeLLLzogphJ+3AfXx/qzg3swaG2zVFf1Kj5xcxC9kIG/xnyl KwbEKcL8I/QCgswaDuTPdWTsk8V0D3UTZidkQWzg2I4zlEu4rFvc1IbLRw2KLyAfOinx +zsvoUQFUi6hWjrgpGqb+392Ezz4KowckgxhxFzWdbySe9NEkpKp2iaVZod6ax+I1cmz gvzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=FCn0NOYEqaD0Jegcew9l3iUqzv3OJTQmdXLNhTX7xbg=; b=dDZTQquDCv71ViJh1Wp7v+kaKhSZHbYvHSgQZqAq9Cl8+mM8IS4GGh3By2aDlSfEOs a0VxjIsanQTXvv4XsmvDa8v2q64BeJj9KxV2GOcQD4rUCNBw2xYLVyEU0ys9kcse0MMf C3KxYJCwMDGp0+TDqimnZMjWwMQMslumcs7phxw8bGYTU1sr26G4YO0sxJGZb2FaZ6U1 O8RYQVg6Ll+yBIw+w6Rw5pioCv+UhWrHNBYf+dL8aTCp66yfuLVTvEEyjPeTlHn0+ORb O7qP1lmLUf2HB8wArVes2wxTr07jV5soegYDgrDOwhHi4V1ZLT22M6C7iykgthn74uBV fy1g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g20-v6si1840864pgb.239.2018.09.12.12.17.19; Wed, 12 Sep 2018 12:17:35 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728147AbeIMAWt (ORCPT + 99 others); Wed, 12 Sep 2018 20:22:49 -0400 Received: from mx2.suse.de ([195.135.220.15]:58794 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728014AbeIMAWt (ORCPT ); Wed, 12 Sep 2018 20:22:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B16B9AFC4; Wed, 12 Sep 2018 19:16:52 +0000 (UTC) Date: Wed, 12 Sep 2018 21:16:51 +0200 (CEST) From: Jiri Kosina To: Thomas Gleixner cc: Ingo Molnar , Peter Zijlstra , Josh Poimboeuf , Andrea Arcangeli , "Woodhouse, David" , Andi Kleen , Tim Chen , "Schaufler, Casey" , linux-kernel@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v6 2/3] x86/speculation: Enable cross-hyperthread spectre v2 STIBP mitigation In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 12 Sep 2018, Thomas Gleixner wrote: > > case X86_BUG_SPECTRE_V2: > > - return sprintf(buf, "%s%s%s%s\n", spectre_v2_strings[spectre_v2_enabled], > > + mutex_lock(&spec_ctrl_mutex); > > + ret = sprintf(buf, "%s%s%s%s%s\n", spectre_v2_strings[spectre_v2_enabled], > > boot_cpu_has(X86_FEATURE_USE_IBPB) ? ", IBPB" : "", > > boot_cpu_has(X86_FEATURE_USE_IBRS_FW) ? ", IBRS_FW" : "", > > + (x86_spec_ctrl_base & SPEC_CTRL_STIBP) ? ", STIBP" : "", > > spectre_v2_module_string()); > > + mutex_unlock(&spec_ctrl_mutex); > > The mutex for this printing is overkill. It's a read after all and if there > is a concurrent SMT control fiddling going on then you have a chance of > getting the wrong information as well. Yeah; I was just happy to be able to stick second use of it there, with the first one being basically useless as well :) > I'll zap it. Absolutely feel free to. Thanks, -- Jiri Kosina SUSE Labs