Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp398968pxb; Sat, 11 Sep 2021 08:26:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAOg55mG9SfbM83qEPuCR6iKkqR27NLBhvms4QKx0W5jkSAuzRcQNv1aVJ5DvvUKeLuM7A X-Received: by 2002:a50:998f:: with SMTP id m15mr3762434edb.193.1631374018155; Sat, 11 Sep 2021 08:26:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631374018; cv=none; d=google.com; s=arc-20160816; b=1CTSHHU87FsX5rGZnHMkeZFW6i3nWN2MO2xlD2p7urObfYsJIk5v/FBIOisYLoek+s SjLBcQdy5h6TfLZo0c05c7vGFHMlUeZdM9iyIe2FJWm9IOTtw85y3W28m5IVKiy0KUux rxYT6zD/2HDeusVBeg1cfCETaW0Pw1GigEhUExS2BtkvkFUURUykqnHv3oXDh6YSIQNW UKHbhNJTQHLsgDMtJ/O6Db2BsskskBovr6DZ6pAJ+iHiIZMfgLuwvztOk3jeglkcqWQd zeqv8ioAAvcgJ8LFnaoBv1sOR6JEbOhXQ/6vkML2qnxdozc5Ccs8pdmcc513EWGg6kfe fzNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=CAiPuDJAAVYjx3qqXgXVw9eLdaUeuisrPgsvTgrXXpg=; b=lmglKvCa+Us6R1+QUOITY/rpPG+ssosO1STuAmzfnwNHJqLLkjD/8gTiskwq+O5dYR cq2T4zhc2jMb2OppfQ2sDzq1RQUxaSNL2KRa3NNF2k7Fv4JfBvVX5FLQFjpBYW54NtQS jnIC1xpIGhXLTcoa73F3tPSrjsok2FjXRFCY+/Q0pl1lmcalsXDH9/xT5epgVyDuUW8w R35vT9G6C6fFQOJ+Cjwa4Cytt789HksckptjfK4P1ts0aq1scHkc5I77EgXn6EfUXeBF 6R0MqnbclSD9dNMwZ/R5Fl08of/txVSFqFwb1EMEBmwa3mVDRdsG/aoROBRBLh000ToT EEeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a30si1994477edf.614.2021.09.11.08.26.20; Sat, 11 Sep 2021 08:26:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231844AbhIKPZn (ORCPT + 99 others); Sat, 11 Sep 2021 11:25:43 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]:37512 "EHLO mail-wr1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbhIKPZm (ORCPT ); Sat, 11 Sep 2021 11:25:42 -0400 Received: by mail-wr1-f43.google.com with SMTP id t8so2225096wrq.4; Sat, 11 Sep 2021 08:24:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CAiPuDJAAVYjx3qqXgXVw9eLdaUeuisrPgsvTgrXXpg=; b=keAV9UTFqGKutiCY04kAlxKXLQoFNI+FMXnwRlKGao7WUcZHj7H6zb9eKWTecig5ZO /vHzdjhgV9bXcc4xO/ZoqK/auLI3i2h2dnhJECNGiktavV805aRYBgYLE9Owru5kR8aS KgebCaJGGNiKTjHmmGNx53YN4H8tBqQ1c9+3mIEeVPWSSZXgjBODoqJBnm76Lpx6r5fc 49A61RRV6gBv/bdIaWoPJU9r0XuPxXtyxdkvUFu3nkd9g6SwmybDb7YSQT/wT74hBIKa kmon5Jppz8jK2avBnqf4ssQtiytEpvPBvsG3FOnCH8Lpo6Hk83gRRdU9I32MgucWRtIj 6U7Q== X-Gm-Message-State: AOAM5314pJ99Nb6LZCZzDCc0SCOYnDnNcwvBVU6psuH20tvhFl6+p3gQ kwgq9qewZoxYLbprajeTFb0gkfAEjK8= X-Received: by 2002:a5d:404b:: with SMTP id w11mr3555259wrp.437.1631373868609; Sat, 11 Sep 2021 08:24:28 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id y1sm1897003wmq.43.2021.09.11.08.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Sep 2021 08:24:28 -0700 (PDT) Date: Sat, 11 Sep 2021 15:24:26 +0000 From: Wei Liu To: Michael Kelley Cc: Wei Liu , Linux on Hyper-V List , KY Srinivasan , Haiyang Zhang , Dexuan Cui , Stephen Hemminger , Linus Torvalds , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Subject: Re: [PATCH v2 2/2] x86/hyperv: remove on-stack cpumask from hv_send_ipi_mask_allbutself Message-ID: <20210911152426.gq34cigqteqvzms2@liuwe-devbox-debian-v2> References: <20210910185714.299411-1-wei.liu@kernel.org> <20210910185714.299411-3-wei.liu@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 11, 2021 at 03:09:50PM +0000, Michael Kelley wrote: > From: Wei Liu Sent: Friday, September 10, 2021 11:57 AM [...] > > -static bool __send_ipi_mask(const struct cpumask *mask, int vector) > > +static bool __send_ipi_mask(const struct cpumask *mask, int vector, > > + bool exclude_self) > > { > > - int cur_cpu, vcpu; > > + int cur_cpu, vcpu, this_cpu = smp_processor_id(); > > struct hv_send_ipi ipi_arg; > > u64 status; > > + unsigned int weight; > > > > trace_hyperv_send_ipi_mask(mask, vector); > > > > - if (cpumask_empty(mask)) > > + weight = cpumask_weight(mask); > > + > > + /* > > + * Do nothing if > > + * 1. the mask is empty > > + * 2. the mask only contains self when exclude_self is true > > + */ > > + if (weight == 0 || > > + (exclude_self && weight == 1 && cpumask_first(mask) == this_cpu)) > > Nit: cpumask_test_cpu(this_cpu, mask) would seem to be a better fit for this > use case than cpumask_first(). But either works. I will adjust the code when I commit this patch. Wei.