Received: by 10.192.165.148 with SMTP id m20csp28618imm; Thu, 26 Apr 2018 15:18:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx48DhjheqmCsM98KbiSMJG8cXY+GdBkeYAhhgROLtGutXs5uDLy5HL64U4Ml8KAz+j928ppA X-Received: by 10.98.180.2 with SMTP id h2mr34089513pfn.189.1524781103845; Thu, 26 Apr 2018 15:18:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524781103; cv=none; d=google.com; s=arc-20160816; b=oTfeotD6kay7BAH0oE9SIzg9fNfzvMAMFZRddV0iDT+6ZfM4HygVRQPMpiv37VExUc hZAvz1MHLTjiJuqT2RrSbC0X+2hOEEyGYbA4hSFSeitu3KHAsVSPIZgNwPbjSoYEjZD6 O62kUGC0uqm93Tvm9l0gUPwj9P9fGi2mF2w1jxUrrK98L6EU+CWtyHqmuFAccpTMKgX2 j1ywx8tTNBC2CmdEZE2OkTXTPHOlrkqhJ4K2Ln8Kz9D1ToEP3s8nkrsstGZfX4pCZv5N NC3BPFo2AQvvdcH1jxl6RPUiHGiuyk2WP8sBgbAZT9Z21SplqAtATqbvr+RrG7vGrxvl /6Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=xl5X11vEEuwL+FzoOssNN/RaDfKYuFtTXt1bjtZRRBc=; b=W9dIeqSuvUPa2G25Mg2AB5SBR/4XdRI2BlcDWM01VSGJSRkDamoBArccRz9iCb1Vrr 6VUTTkm5IAUehneWJhj9SmAOilxUFF7CUEQjiLqQAKFZTP+U68oN60mycsJiNNUTcvBQ FRGxNsUR1/S7i2wK6yEeJVbvTg6EX9m+SwLs4MsXsOS02dTt494uORhoo80Y4iNi3Pmv PpC4bvfRA9DaDiu8j4Zg9pTLSjX8O6Zbz2Ui5LZSmxtKKEJXvSVTfmZul1GeAcLkG2vT PNOd8jceszaHVjpaGWP2EH3EVf5sZ2w7fXLxQukrBGWCRiWyHfjjoUAzaopsl6I2hoA7 GmwA== ARC-Authentication-Results: i=1; mx.google.com; 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 z6si7501980pfk.194.2018.04.26.15.18.09; Thu, 26 Apr 2018 15:18:23 -0700 (PDT) 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; 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 S1757202AbeDZWQz (ORCPT + 99 others); Thu, 26 Apr 2018 18:16:55 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:50469 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757131AbeDZWQx (ORCPT ); Thu, 26 Apr 2018 18:16:53 -0400 Received: from p5492e61e.dip0.t-ipconnect.de ([84.146.230.30] helo=nanos.glx-home) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fBpC7-0004sV-LJ; Fri, 27 Apr 2018 00:16:51 +0200 Date: Fri, 27 Apr 2018 00:16:51 +0200 (CEST) From: Thomas Gleixner To: "K. Y. Srinivasan" cc: x86@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com, hpa@zytor.com, sthemmin@microsoft.com, Michael.H.Kelley@microsoft.com, vkuznets@redhat.com Subject: Re: [PATCH 3/5] X86: Hyper-V: Enhanced IPI enlightenment In-Reply-To: <20180425181250.8740-3-kys@linuxonhyperv.com> Message-ID: References: <20180425181110.8683-1-kys@linuxonhyperv.com> <20180425181250.8740-1-kys@linuxonhyperv.com> <20180425181250.8740-3-kys@linuxonhyperv.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 25 Apr 2018, kys@linuxonhyperv.com wrote: > > +struct ipi_arg_ex { > + u32 vector; > + u32 reserved; > + struct hv_vpset vp_set; Please align that in tabular fashion for easy of reading u32 vector; u32 reserved; struct hv_vpset vp_set; > +}; > + > static struct apic orig_apic; > > static u64 hv_apic_icr_read(void) > @@ -97,6 +103,40 @@ static void hv_apic_eoi_write(u32 reg, u32 val) > * IPI implementation on Hyper-V. > */ > > +static int __send_ipi_mask_ex(const struct cpumask *mask, int vector) > +{ > + int nr_bank = 0; > + struct ipi_arg_ex **arg; > + struct ipi_arg_ex *ipi_arg; > + int ret = 1; > + unsigned long flags; This is really horrible to read. struct ipi_arg_ex *ipi_arg; struct ipi_arg_ex **arg; unsigned long flags; bool ret = false; int nr_bank = 0; is really more conveniant for quick reading. So the other more limited function has a lot more sanity checks vs. vector number and other things. Why are they not required here? Comment please. > + local_irq_save(flags); > + arg = (struct ipi_arg_ex **)this_cpu_ptr(hyperv_pcpu_input_arg); > + > + ipi_arg = *arg; > + if (unlikely(!ipi_arg)) > + goto ipi_mask_ex_done; > + > + ipi_arg->vector = vector; > + ipi_arg->reserved = 0; > + ipi_arg->vp_set.valid_bank_mask = 0; > + > + if (!cpumask_equal(mask, cpu_present_mask)) { > + ipi_arg->vp_set.format = HV_GENERIC_SET_SPARCE_4K; > + nr_bank = cpumask_to_vpset(&(ipi_arg->vp_set), mask); nr_bank really confused me. bank_nr is what you mean, not number of banks, right? > + } > + if (!nr_bank) > + ipi_arg->vp_set.format = HV_GENERIC_SET_ALL; > + > + ret = hv_do_rep_hypercall(HVCALL_SEND_IPI_EX, 0, nr_bank, > + ipi_arg, NULL); > + > +ipi_mask_ex_done: > + local_irq_restore(flags); > + return ret; > +} Thanks, tglx