Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3491244rdb; Wed, 13 Sep 2023 13:48:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBJw77Wk5Otp5jhAf9gzLuwrMGyVw6PmsRiaoci1H2i+o0uoWEWzGQPKO722+PfFTUJ0Ut X-Received: by 2002:a17:902:9f96:b0:1bf:78d:5cd9 with SMTP id g22-20020a1709029f9600b001bf078d5cd9mr3692146plq.67.1694638095535; Wed, 13 Sep 2023 13:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694638095; cv=none; d=google.com; s=arc-20160816; b=L+A9hAyOHlsgscO+DWfAcLpAMlM/b9+s+NmynHPOVTWjOpMm6NZt4WPHMTVXy529S0 BVzXTA1aFE0d8Vs5PrKgHtKewsSBQa/mUyQNdA9SYNCEnAyinqAEs1Ig4D5afUYiz9J9 LhOSkidTIDXcuHN8uCZORP3WTExVNinOHWenDhAQcPWGw+bwgPERD2egQ+OlnZ3Nd+RH Htnup1Z/8q053nQVyM72ruEIzpzg0PoYxudB5lyBZ5LgrBhfaacKaByKsFXK9c/gGYIs 9vz8nGkn1tlkOLiTfvf4U/9px4TLIEQgdFS3k0s6VhpvbeySFUQnv/7/h+9ObBF5rIBZ ngAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Rb8UC+tm5KMJfYE6aFVhYiKKfOMEDoFxStg0uI7kmV0=; fh=9lqzfMv2TT5lLahVoIh+CO/bhGEAdaT3drkShWkVL/g=; b=ldn3jgT89KMUU0CoqHEKWgNg8s4v34mgLgxPKxKbyXYZRpeaAHzDdVa63j5aVIX4fe VjK31ekdBPJXPhJAogdtup3qZbINm9GL0Cwl+a5+lQc90IH+1mKe9ee22r6rJR72VYtl zXH43MCbj8nT8uJWGqJsClYsrbMGs8qsZWbPBsdv5RmY7d/lArJNG0mrTWnt4rd+Wd58 b2HWqimJC8wYUVp61uew3l9adi63g8WXsxh69GfSDU6P7C2pCfx7z/XIy8cDgJFSl+jK MUUrVyNagmiWD3iCQsc7OQE6h2PUvSg8W326h71wLIcw1gyCwNMTgY6RAWZ85Jtyvhow D6vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ib2QrV6+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id j6-20020a170903024600b001c3be32bc4dsi113425plh.23.2023.09.13.13.48.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 13:48:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ib2QrV6+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id F06418026811; Wed, 13 Sep 2023 10:02:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229913AbjIMRCa (ORCPT + 99 others); Wed, 13 Sep 2023 13:02:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjIMRCa (ORCPT ); Wed, 13 Sep 2023 13:02:30 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 05B7AB7 for ; Wed, 13 Sep 2023 10:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694624498; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rb8UC+tm5KMJfYE6aFVhYiKKfOMEDoFxStg0uI7kmV0=; b=ib2QrV6+Wjv0U8vBTQQD9kK5YSka9CH/7pJ///Fn4tDoK/kSONs3BtqduCMdS6on8nUsER ymHqk+026QsVeRY2uNQt2RaNrqI0QEcJIXRT7lkeMgKCxN1cP40A6xsl8UtrIGdGHn6M9/ 2Zp8cOMyZDa2YDFXscqY6hTz57JD/p8= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-225-twOzCWlwMbCE6PFGyKb9eQ-1; Wed, 13 Sep 2023 13:01:35 -0400 X-MC-Unique: twOzCWlwMbCE6PFGyKb9eQ-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-5007ac1c653so7539285e87.2 for ; Wed, 13 Sep 2023 10:01:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694624493; x=1695229293; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Rb8UC+tm5KMJfYE6aFVhYiKKfOMEDoFxStg0uI7kmV0=; b=VIIvfy30ZBY7i034oCZaxKcYvrPdJ7X+uEskPFPnkMuFfS3UFWojhDNTYHRyY0Yodn 0/GTEFvvfz3S4RRqHiy6pAJv7E/vHlNg+AvnU2SFw4eiDzHby4SGycU5J2j/WVuDlQ7e 88fUWZHZJE9VNFq+wJLpSbgfABj4nABGjhy17fovrDC//4WwLy9N2bDB4kcw2bJTDx/3 pSfspcf4HfBwOIsuf29soTsTDu4L4KLdTDAZm3hVXu3uB0oyjUPHDDTi6tebjhC3mLGL FMW+Qh2MtfPzhXBbEJRV2BinzZlz62Ek0YBlXOw9XH8GfL3ZgEAxQOCq+G1qSAi2z8oj 27JQ== X-Gm-Message-State: AOJu0YyfcmlDMD+gAaeLBlWIxHLOocBrXbTTc0LQRZKwtAPI7Vo9n+uT FaC83F8nVxcEHSvch+8A807WjEqxAS111DdroySqulrbBRLqh+N0Bipkpxv2XmBguVX3LJk/fno UIIsrDFfcQc0khQ8vETAojS5m X-Received: by 2002:a05:6512:34c6:b0:501:c1d4:cf68 with SMTP id w6-20020a05651234c600b00501c1d4cf68mr2415289lfr.15.1694624493114; Wed, 13 Sep 2023 10:01:33 -0700 (PDT) X-Received: by 2002:a05:6512:34c6:b0:501:c1d4:cf68 with SMTP id w6-20020a05651234c600b00501c1d4cf68mr2415265lfr.15.1694624492777; Wed, 13 Sep 2023 10:01:32 -0700 (PDT) Received: from ?IPV6:2001:1c00:c32:7800:5bfa:a036:83f0:f9ec? (2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:5bfa:a036:83f0:f9ec]) by smtp.gmail.com with ESMTPSA id pv26-20020a170907209a00b00992d122af63sm8668947ejb.89.2023.09.13.10.01.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Sep 2023 10:01:32 -0700 (PDT) Message-ID: <4f41e78e-5e47-0726-c64a-82559d1f799b@redhat.com> Date: Wed, 13 Sep 2023 19:01:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] x86/platform/uv: Use sysfs_match_string() for string parsing in param_set_action() To: Steve Wahl Cc: Justin Ernst , Kyle Meyer , Dimitri Sivanich , Russ Anderson , Darren Hart , Andy Shevchenko , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Justin Stitt References: <20230913151656.52792-1-hdegoede@redhat.com> Content-Language: en-US, nl From: Hans de Goede In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 13 Sep 2023 10:02:32 -0700 (PDT) X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Hi Steve, On 9/13/23 18:56, Steve Wahl wrote: > On Wed, Sep 13, 2023 at 05:16:56PM +0200, Hans de Goede wrote: >> Remove the custom, hard to read code to: >> >> 1. Make a copy of "val" with any potential '\n' at the end stripped >> 2. Compare the copy against an array of allowed string values >> >> Linux has the sysfs_match_string() helper exactly for cases like this, >> switch to this. > > Hans, > > I like this patch, compiling and testing now. > > I was wondering, as long as we're in the neighborhood, how you feel > about changing the stored variable uv_nmi_action to an int or enum > rather than a string, since it can only be one of 6 values, and the > string compare while processing an NMI strikes me as inefficent. > > It could extend this patch, or be done as a follow on. And I'm > willing to supply the effort if you want me to. I must admit I did not look at the code consuming uv_nmi_action and I did wonder why this was not an enum from day 1. I'll prepare a v2 of this patch which changes uv_nmi_action to an enum. Note I can compile test this only, so I gope you will be able to test the v2 a bit more thoroughly :) Regards, Hans