Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7674C6FA99 for ; Tue, 7 Mar 2023 21:13:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231354AbjCGVNl (ORCPT ); Tue, 7 Mar 2023 16:13:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231336AbjCGVNg (ORCPT ); Tue, 7 Mar 2023 16:13:36 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86F3314EBB for ; Tue, 7 Mar 2023 13:13:26 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id s11so57812337edy.8 for ; Tue, 07 Mar 2023 13:13:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1678223604; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=d3EmGp5fzDwlHCmDu7H4pzhEBDJeCZ+kE8lTuXvrdGw=; b=PoP3RKR3gAnIw9J0AeW5MZwfXaW97vmZBQz/t7QTQb5PQmeVbhMwC9I3KSfBnLlIRf 8Vnsr3+JcdVVNhe0Ps351dC26vwbR0eTYEdgU8BxpEEuv7+zeXE6L5avmQOI/3EUcYek vtO0j+Z8Dfi7I4WiogtoFRG5WqCbCw2pu2P3Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678223604; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=d3EmGp5fzDwlHCmDu7H4pzhEBDJeCZ+kE8lTuXvrdGw=; b=CbLknb9yXlRjALxW1aqlXIYNtoN6X14AZprbm+zBwepY1co33aSa6W2UtI0ENgrxxn nLxbrkPbu0komAotVRQgkKHzPH7bOHLD0XL1475wRgsmPUU6dEz8/fEVcs7fgWFGEacI Wv5OYj3peBdyYysarT9A/jqMNYyba0BgfNR3S2ACawTjNoMOqwkNFROd70ep1uXUGN12 wjsUQK2/OxmxMLIdPgMerxjTjh+oxR40HL3etslCM4+u6wsDlNh5xxJcnIG4AjmLtpGz o6SNTiXLokhzJ5/qnjxCTJ5Q8xfMwac184TzJWcb1+uU0M6nxZlKoDsYcGwiWtDY3wQ2 NNnA== X-Gm-Message-State: AO0yUKWpoFCOsNRzEhwvX2ZSbeEODZ4pIZkWdZEW2KH9Nq5T1OTteb3S CFjNUzQamMCFm/YIBnffMXqIZH4uEoC0zLuJ2OQ2xvYA X-Google-Smtp-Source: AK7set/fJsgso6PhqpGoULrDOxSYgkGmDnsS+OvDVtIV1fB59gyXlsGmegnO+jBKODUVKqwwo3JCBg== X-Received: by 2002:a17:906:99c9:b0:8b2:5262:562c with SMTP id s9-20020a17090699c900b008b25262562cmr15874784ejn.34.1678223604277; Tue, 07 Mar 2023 13:13:24 -0800 (PST) Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com. [209.85.208.49]) by smtp.gmail.com with ESMTPSA id uo17-20020a170907cc1100b008b17ed98d05sm6552452ejc.120.2023.03.07.13.13.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Mar 2023 13:13:24 -0800 (PST) Received: by mail-ed1-f49.google.com with SMTP id ay14so54106715edb.11 for ; Tue, 07 Mar 2023 13:13:23 -0800 (PST) X-Received: by 2002:a17:906:398a:b0:877:747e:f076 with SMTP id h10-20020a170906398a00b00877747ef076mr7345032eje.0.1678223206531; Tue, 07 Mar 2023 13:06:46 -0800 (PST) MIME-Version: 1.0 References: <20230303231133.1486085-1-eranian@google.com> <20230306120106.GE1267364@hirez.programming.kicks-ass.net> <20230307113545.GB2017917@hirez.programming.kicks-ass.net> <20230307184315.GS25951@gate.crashing.org> In-Reply-To: From: Linus Torvalds Date: Tue, 7 Mar 2023 13:06:29 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] x86/resctrl: avoid compiler optimization in __resctrl_sched_in To: Jakub Jelinek Cc: Segher Boessenkool , Peter Zijlstra , Nick Desaulniers , Stephane Eranian , linux-kernel@vger.kernel.org, tony.luck@intel.com, reinette.chatre@intel.com, fenghua.yu@intel.com, peternewman@google.com, james.morse@arm.com, babu.moger@amd.com, ananth.narayan@amd.com, vschneid@redhat.com, Nathan Chancellor , clang-built-linux , Borislav Petkov , "H. Peter Anvin" , linux-toolchains@vger.kernel.org Content-Type: multipart/mixed; boundary="000000000000148e7005f655ca63" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000148e7005f655ca63 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Mar 7, 2023 at 12:54=E2=80=AFPM Linus Torvalds wrote: > > I think the problem is that the code is disgusting and > horrible in multiple ways: > > (a) it shouldn't define and declare a static function in a header file > > (b) the resctrl_sched_in() inline function is misdesigned to begin with Ok, so here's a *ttoally* untested and mindless patch to maybe fix what I dislike about that resctl code. Does it fix the code generation issue? I have no idea. But this is what I would suggest is the right answer, without actually knowing the code any better, and just going on a mindless rampage. It seems to compile for me, fwiw. Linus --000000000000148e7005f655ca63 Content-Type: text/x-patch; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_leyqqvgo0 IGFyY2gveDg2L2luY2x1ZGUvYXNtL3Jlc2N0cmwuaCAgICAgICAgIHwgMTIgKysrKysrLS0tLS0t CiBhcmNoL3g4Ni9rZXJuZWwvY3B1L3Jlc2N0cmwvcmR0Z3JvdXAuYyB8ICA0ICsrLS0KIGF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