From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B3C2C25B7F for ; Wed, 16 Aug 2023 21:40:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=07T13p4x/wtCMWJtQRMPioxSZWm5wx0nNb1eeOoWejo=; b=hulue8XekIsohN cj2AHOdmSLxELE8Es4XGtun3E473s94TaEElRbRLgD1nCwOdt+5sq8dfBW5V8OMpMwxcIVGSt+qUI ushKsmBEVtxYtuEpnOvYa2jgdDGDZBjyrNogGfUJDq+B0Wk7uFi/uArFvMwFtY55qSzBkkyoAvuHW 3NSzDoFA4hJMzqlo5bXWsy3Z251Z+0jFiEeoanbTWdMrPpU+AVbVzY+h9I6ZL+Gysx0LwOX5Iv+EX KACqjdzZi6fKMy/DUiIjnOPOmccFz0+jTM+O1dWgfmb1nso2et7yxB70/Ju5nVqr+zsOkX26r+Izg GwBKPPeEWbLuR8G/F97Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWOFi-0052rB-2Y; Wed, 16 Aug 2023 21:40:30 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWOFg-0052qA-1F for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 21:40:29 +0000 Received: from [192.168.0.5] (71-212-112-68.tukw.qwest.net [71.212.112.68]) by linux.microsoft.com (Postfix) with ESMTPSA id 2773D211F61E; Wed, 16 Aug 2023 14:40:22 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2773D211F61E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1692222022; bh=9J/siSd3e/xutkmYyU6ZjncKl7A8brtIRyLjlPr7NQk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=EAIUIfVe8yo9voVpcR0wcfbQTBkAzHT2MfPwE3SnkJKRFvWlgm2iXpJiY436zg/T0 84aFRGn23krhc6Yp6eC9K9SDlvdJbykQqFcY2YovRqUqyizMC4uSugh+joiqkH5hFy E555jsvZHXGPoXi8qqynNsun/x/NO7ozodn6MbYc= Message-ID: Date: Wed, 16 Aug 2023 14:40:21 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 08/15] Drivers: hv: Introduce per-cpu event ring tail Content-Language: en-US To: Wei Liu Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, mikelley@microsoft.com, kys@microsoft.com, haiyangz@microsoft.com, decui@microsoft.com, ssengar@linux.microsoft.com, mukeshrathor@microsoft.com, stanislav.kinsburskiy@gmail.com, jinankjain@linux.microsoft.com, apais@linux.microsoft.com, Tianyu.Lan@microsoft.com, vkuznets@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, will@kernel.org, catalin.marinas@arm.com References: <1690487690-2428-1-git-send-email-nunodasneves@linux.microsoft.com> <1690487690-2428-9-git-send-email-nunodasneves@linux.microsoft.com> From: Nuno Das Neves In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230816_144028_516659_3641B827 X-CRM114-Status: GOOD ( 11.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org >> +/* >> + * Per-cpu array holding the tail pointer for the SynIC event ring buffer >> + * for each SINT. >> + * >> + * We cannot maintain this in mshv driver because the tail pointer should >> + * persist even if the mshv driver is unloaded. >> + */ >> +u8 __percpu **hv_synic_eventring_tail; >> +EXPORT_SYMBOL_GPL(hv_synic_eventring_tail); >> + >> /* >> * Hyper-V specific initialization and shutdown code that is >> * common across all architectures. Called from architecture >> @@ -332,6 +342,8 @@ int __init hv_common_init(void) >> if (hv_root_partition) { >> hyperv_pcpu_output_arg = alloc_percpu(void *); >> BUG_ON(!hyperv_pcpu_output_arg); >> + hv_synic_eventring_tail = alloc_percpu(u8 *); >> + BUG_ON(hv_synic_eventring_tail == NULL); >> } >> >> hv_vp_index = kmalloc_array(num_possible_cpus(), sizeof(*hv_vp_index), >> @@ -356,6 +368,7 @@ int __init hv_common_init(void) >> int hv_common_cpu_init(unsigned int cpu) >> { >> void **inputarg, **outputarg; >> + u8 **synic_eventring_tail; >> u64 msr_vp_index; >> gfp_t flags; >> int pgcount = hv_root_partition ? 2 : 1; >> @@ -371,6 +384,14 @@ int hv_common_cpu_init(unsigned int cpu) >> if (hv_root_partition) { >> outputarg = (void **)this_cpu_ptr(hyperv_pcpu_output_arg); >> *outputarg = (char *)(*inputarg) + HV_HYP_PAGE_SIZE; >> + synic_eventring_tail = (u8 **)this_cpu_ptr(hv_synic_eventring_tail); >> + *synic_eventring_tail = kcalloc(HV_SYNIC_SINT_COUNT, sizeof(u8), >> + flags); >> + >> + if (unlikely(!*synic_eventring_tail)) { >> + kfree(*inputarg); >> + return -ENOMEM; >> + } >> } >> >> msr_vp_index = hv_get_register(HV_MSR_VP_INDEX); >> @@ -387,6 +408,7 @@ int hv_common_cpu_die(unsigned int cpu) >> { >> unsigned long flags; >> void **inputarg, **outputarg; >> + u8 **synic_eventring_tail; >> void *mem; >> >> local_irq_save(flags); >> @@ -398,6 +420,9 @@ int hv_common_cpu_die(unsigned int cpu) >> if (hv_root_partition) { >> outputarg = (void **)this_cpu_ptr(hyperv_pcpu_output_arg); >> *outputarg = NULL; >> + synic_eventring_tail = (u8 **)this_cpu_ptr(hv_synic_eventring_tail); >> + kfree(*synic_eventring_tail); >> + *synic_eventring_tail = NULL; > > The upstream code looks different now. See 9636be85cc. > Thanks, I have rebased for v2, and fixed this. >> } >> >> local_irq_restore(flags); >> diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h >> index 0c94d20b4d44..9118d678b27a 100644 >> --- a/include/asm-generic/mshyperv.h >> +++ b/include/asm-generic/mshyperv.h >> @@ -73,6 +73,8 @@ extern bool hv_nested; >> extern void * __percpu *hyperv_pcpu_input_arg; >> extern void * __percpu *hyperv_pcpu_output_arg; >> >> +extern u8 __percpu **hv_synic_eventring_tail; >> + >> extern u64 hv_do_hypercall(u64 control, void *inputaddr, void *outputaddr); >> extern u64 hv_do_fast_hypercall8(u16 control, u64 input8); >> extern bool hv_isolation_type_snp(void); >> -- >> 2.25.1 >> _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel