Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1074266ioo; Sun, 22 May 2022 02:55:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1UCaLGPmbNz36gdxg3J6S6dI1nJ6nR9qSTNB5hJrArA/Sztbg7jVs0s+jLDyzAzzVl++Y X-Received: by 2002:a17:902:c2c1:b0:162:3a9:2819 with SMTP id c1-20020a170902c2c100b0016203a92819mr7009313pla.38.1653213309381; Sun, 22 May 2022 02:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653213309; cv=none; d=google.com; s=arc-20160816; b=MGlMAdpXTmxPhDWGfTTl/Z5vJZDu+pSe7i+M7nmmeJ2Fw3d5N3WKQ9Dkcv9cJXvi3q XqI5y1a/nrAgKU/ppbmuSQcAe6haiN3wQkdvOcImABaF9j8m4fjVU1pJ2SzqXsnwIA9c LD9ZmoIMrH1zDpXkOoUD0Kgh1t0Pd/VGPrTuez9Z62wiwb/bZPEup6QsBrIQ4M9oljUu Uwf1d5InseCkapx4jDQdqwN2RvBpb1V21Ft+bFhFcioZXe+HfU2YhtCApu0EkOrssUhB 6jEyso8tjyQP1cnfqO8TB49mQoUzy/KGJbm5ojLDHIRe9gt9BKIU0lvjN0cS0f25MquO 9vYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to; bh=8IHZpvO856FaA/6UJRnXoaeowJV7RtxtHepPW+ifceo=; b=XQXtJmFppiBcs8/sW3SChyAY3hQDZHi8qyNUYNhSv+bwFNxZ6DDDuZ2Td6s7J0pt03 0j1mLBjDysL+CWyGbJScEBBNzRU/yU1gw0ZRc99plPV90rKjA3sL/U1b0Ky7vktgHBZY hOGUSOhvB/R34H+nzD9b696rRf7q6qjD72KJMlPWh86Kzslm02zokjv9qzu/cP+8TpNq MKo7BFmT37kv0mTLZm65oo/ChZRU8B3WxgHFnxaYgMIP0x6tYQnb3oJZOJgbzzz6xPli TLxNme1ensYFWRxD729QsIRyzBGbNUOjrqHv1+G85slA5wA2ig5wJqpnxhZ6/qGdBVia Im9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=csail.mit.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v2-20020a1709029a0200b00162188be343si2364310plp.264.2022.05.22.02.54.55; Sun, 22 May 2022 02:55:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=csail.mit.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237426AbiETPlc (ORCPT + 99 others); Fri, 20 May 2022 11:41:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245547AbiETPla (ORCPT ); Fri, 20 May 2022 11:41:30 -0400 Received: from outgoing-stata.csail.mit.edu (outgoing-stata.csail.mit.edu [128.30.2.210]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 94DA7163285 for ; Fri, 20 May 2022 08:41:27 -0700 (PDT) Received: from [77.23.249.31] (helo=srivatsab-a02.vmware.com) by outgoing-stata.csail.mit.edu with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ns4kk-000Jtb-1u; Fri, 20 May 2022 11:41:22 -0400 To: Shreenidhi Shedi , amakhalov@vmware.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com Cc: virtualization@lists.linux-foundation.org, pv-drivers@vmware.com, x86@kernel.org, linux-kernel@vger.kernel.org, Shreenidhi Shedi References: <20220520140954.597725-1-sshedi@vmware.com> From: "Srivatsa S. Bhat" Subject: Re: [PATCH v2] x86/vmware: use unsigned integer for shifting Message-ID: Date: Fri, 20 May 2022 17:41:18 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20220520140954.597725-1-sshedi@vmware.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/20/22 7:09 AM, Shreenidhi Shedi wrote: > From: Shreenidhi Shedi > > From: Shreenidhi Shedi > > Shifting signed 32-bit value by 31 bits is implementation-defined > behaviour. Using unsigned is better option for this. > > Fixes: 4cca6ea04d31 ("x86/apic: Allow x2apic without IR on VMware platform") > > Signed-off-by: Shreenidhi Shedi > --- > arch/x86/kernel/cpu/vmware.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c > index c04b933f48d3..cd809c5b17f0 100644 > --- a/arch/x86/kernel/cpu/vmware.c > +++ b/arch/x86/kernel/cpu/vmware.c > @@ -28,6 +28,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -476,8 +477,8 @@ static bool __init vmware_legacy_x2apic_available(void) > { > uint32_t eax, ebx, ecx, edx; > VMWARE_CMD(GETVCPU_INFO, eax, ebx, ecx, edx); > - return (eax & (1 << VMWARE_CMD_VCPU_RESERVED)) == 0 && > - (eax & (1 << VMWARE_CMD_LEGACY_X2APIC)) != 0; > + return !(eax & BIT(VMWARE_CMD_VCPU_RESERVED)) && > + (eax & BIT(VMWARE_CMD_LEGACY_X2APIC)) This patch has clearly not been tested, and not even compiled! (It is missing a semicolon at the end of the return statement). Please take your time to revise and test your patch based on the review feedback; there is no hurry! :) (Also, while at it, the double From: at the beginning of the patch needs to be fixed too). Regards, Srivatsa