Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1934251ybl; Sat, 25 Jan 2020 12:13:43 -0800 (PST) X-Google-Smtp-Source: APXvYqwdex4oC+SEZ+TpC2ojjtrxLEa9z2SSQRDMo4FObPYon4E7tQR9diLEMF5efNa7/wA/WLRr X-Received: by 2002:aca:dd87:: with SMTP id u129mr3144244oig.14.1579983223760; Sat, 25 Jan 2020 12:13:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579983223; cv=none; d=google.com; s=arc-20160816; b=pbxSOXR/xb4r7m7fPrvgebpkIjRMgtzxzs6fUsSATx7QbP07N10ihwIgHn8j6rm7fa bnnoPnNxrVbe8Yu7arBU6HSyKJ+OQrSo0vIYLA9jk1R42K5eEL+7BRcn/7M/3v1td3hV 3ehSsey/UA3/S7oNWK5LPZOBkurpU4QVDTO/gsdbNAqZytvuCQrBeaK/tnx6NYcmJxz8 qOii/GgH60klZIk9YKC01bKKC4QyRMwXy7XtGmNcq7ICiDsSucIgrivjbk/4pchuvzgD TbuXYtI0pq1mkVFfyUt5PuNdQD2k/yYsQ2PBnqjnME3M9D2dLJh9uyTtMCzhSS4zVKij asJQ== 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=6ey6ZYti6NmikTiCFbAyS0/OoBDRN48VTuk8yiWvC+M=; b=ioOU8clA1Peigvq6WLiCmDgQuwrZj4brwD34FYvBAg0wu3FBSJjHQmXQWzN29x7WJG tLt/wtBAwIkvFaghR6XLkmFZ8WzCfxzRE5xol5ucPs0KYAoAmv4k3FpIE4q+E4DTj3vQ TELrewaBpNni2NsEJH4dKJx8w6EsvOrKiMi9qTsj//3MtdS1JFrNxzR75WEg/kEn8LQk TVRWzdUT0HiEZreN7OYhiFoQwqoNpexXY1U/CosKcFd2twJk8NLG6ButOkJZKdTciwCS Z665eqzK2nymsqnjOhqzpwbDRX4wRdP5MsJNcxptJegcLQ+zvDs2gV6gMtHKzsSxWy3h otVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=AdBHZXNG; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12si1256635oti.162.2020.01.25.12.13.31; Sat, 25 Jan 2020 12:13:43 -0800 (PST) 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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=AdBHZXNG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727250AbgAYUMj (ORCPT + 99 others); Sat, 25 Jan 2020 15:12:39 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:34074 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726454AbgAYUMj (ORCPT ); Sat, 25 Jan 2020 15:12:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6ey6ZYti6NmikTiCFbAyS0/OoBDRN48VTuk8yiWvC+M=; b=AdBHZXNGW9f1CstD316qvsE+S jQOafMmhFh9TgQBvwjTAtWSka2cq0zzLGESO6Oydi4g2eGB4J3lJuop6G2+lp0Vrmx4h1lpM6r1jg fCbX3OM0ntOygKPIPhJS87Fr250QTQYNX2y2yz36h730Xw6qe8syxT+EL4w++xWzSpJiwFz0gVGWs 9Mve7AYSyxtoAlprwTrd/pBciXoDlSGielgotg9nZ+zraouLVciPvJSzfl8iX8pJEZR04B9o0xqbN XocwlgBOyktXbrVz3bf0oJkeKKOv7LTvAnJTwcN3uRhQlpKw0WRYkZQK2IWC0+xUPA2OvWkgd0mUh p5OvLh9uQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1ivRnC-0004ZO-B4; Sat, 25 Jan 2020 20:12:30 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id EF466980E4C; Sat, 25 Jan 2020 21:12:21 +0100 (CET) Date: Sat, 25 Jan 2020 21:12:21 +0100 From: Peter Zijlstra To: "Luck, Tony" Cc: Borislav Petkov , Thomas Gleixner , Arvind Sankar , "Christopherson, Sean J" , Ingo Molnar , "Yu, Fenghua" , Ingo Molnar , H Peter Anvin , "Raj, Ashok" , "Shankar, Ravi V" , linux-kernel , x86 Subject: Re: [PATCH v15] x86/split_lock: Enable split lock detection by kernel Message-ID: <20200125201221.GZ11457@worktop.programming.kicks-ass.net> References: <20200122224245.GA2331824@rani.riverdale.lan> <3908561D78D1C84285E8C5FCA982C28F7F54887A@ORSMSX114.amr.corp.intel.com> <20200123004507.GA2403906@rani.riverdale.lan> <20200123035359.GA23659@agluck-desk2.amr.corp.intel.com> <20200123044514.GA2453000@rani.riverdale.lan> <20200123231652.GA4457@agluck-desk2.amr.corp.intel.com> <87h80kmta4.fsf@nanos.tec.linutronix.de> <20200125024727.GA32483@agluck-desk2.amr.corp.intel.com> <20200125104419.GA16136@zn.tnic> <20200125195513.GA15834@agluck-desk2.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200125195513.GA15834@agluck-desk2.amr.corp.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 25, 2020 at 11:55:13AM -0800, Luck, Tony wrote: > > > +static inline bool match_option(const char *arg, int arglen, const char *opt) > > > +{ > > > + int len = strlen(opt); > > > + > > > + return len == arglen && !strncmp(arg, opt, len); > > > +} > > > > There's the same function in arch/x86/kernel/cpu/bugs.c. Why are you > > duplicating it here? > > > > Yeah, this whole chunk looks like it has been "influenced" by the sec > > mitigations in bugs.c :-) > > Blame PeterZ for that. For now I'd like to add the duplicate inline function > and then clean up by putting it into some header file (and maybe hunting down > other places where it could be used). Yeah, I copy/paste cobbled that together. I figured it was easier to 'borrow' something that worked and adapt it than try and write something new in a hurry. > > > + /* > > > + * If this is anything other than the boot-cpu, you've done > > > + * funny things and you get to keep whatever pieces. > > > + */ > > > + pr_warn("MSR fail -- disabled\n"); > > > > What's that for? Guests? > > Also some PeterZ code. As the comment implies we really shouldn't be able > to get here. This whole function should only be called on CPU models that > support the MSR ... but PeterZ is defending against the situation that sometimes > there are special SKUs with the same model number (since we may be here because > of an x86_match_cpu() hit, rather than the architectural enumeration check). My thinking was Virt, virt likes to mess up all msr expectations.