Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp18021542rwd; Tue, 27 Jun 2023 10:26:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6M/6ov0biZOnfC1+5EvuhjZQpcMP8OVKYepM3hv4+/rJDROQJpeN9DzpZ/G0RP94D6h926 X-Received: by 2002:a05:6a00:2384:b0:667:e17e:85b7 with SMTP id f4-20020a056a00238400b00667e17e85b7mr35790852pfc.1.1687886810859; Tue, 27 Jun 2023 10:26:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687886810; cv=none; d=google.com; s=arc-20160816; b=UzhhjlF/0XP7qg0Pk8DRxwUU6pnk7yvYg/74CMnzMiU3VGrXag+H6Tkm9Ob2I4Emxu zz54s5/HKZQooL8eITuR/W5Jv6RXQ7YbdYqxPX0xH+slsNxI6h14KwXjWzDZWK5XXbYF H+mmJzXJ99Kr1FVNHIKm9O5UFuOdXaZ1aMA6RQkpscu3Eg5abLOWThxzwgk0oTzIvSgm UEP6mPLNrxkJBZGhbWRkcpnJ4d3uUQHJMO6xhj1qO2XtTY/sqWgdEZGr64kbS8FmsOOy dyrLW3xKM7W/E4HXXKVMBvMtLa/USUpwRtZAObyAaP2hMjsa2S6r3v4a+ctLdkRzqP/Z orbA== 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 :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature:dkim-filter; bh=eol4JTI8wX7UZd7+77Z/kmpFdoWKbnYccggCXyonl54=; fh=YBJaM1kx90j+ETj9tZdtPKiKksMz9SYtxyt9Xa0GRnw=; b=JK8Ra3dBl8N10Zch4LyU4bnyu5L0OheZbUsDXMRWlOXRE/3CCaIi5ps5MhCOLGc0G5 GhIb1r9+ik/uu35TFhhyvs8bjVINqQg5v6UsxDPJIe801K/hy+WbpK89g1oC4xK1HQAu 2YIvlbG8CPz5jmm4JeZXQFkmvEcS7gRIMToO8HMk+lhLN278Wwee60+Ju60Yh2yK0EJR XKwt/SPZBnpZggIBRCAp749OYb8S6DHvfKtlA9YfgoxfyvdNvP4cESF35zAJ8mhwZe+V XBaabjUkBx6+VepYmArEarZUYS6Pjzrn+OfUCdKPnxPex3kdry5RhCo2spKUQvFYbwL4 CsLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b="Rf/SKH6A"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x27-20020a634a1b000000b00557447d5721si7637407pga.768.2023.06.27.10.26.39; Tue, 27 Jun 2023 10:26:50 -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; dkim=pass header.i=@linux.microsoft.com header.s=default header.b="Rf/SKH6A"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230187AbjF0Q6B (ORCPT + 99 others); Tue, 27 Jun 2023 12:58:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbjF0Q57 (ORCPT ); Tue, 27 Jun 2023 12:57:59 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3E0B210CF; Tue, 27 Jun 2023 09:57:58 -0700 (PDT) Received: from [192.168.0.5] (75-172-40-221.tukw.qwest.net [75.172.40.221]) by linux.microsoft.com (Postfix) with ESMTPSA id 8E0AB20AECAD; Tue, 27 Jun 2023 09:57:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8E0AB20AECAD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1687885077; bh=eol4JTI8wX7UZd7+77Z/kmpFdoWKbnYccggCXyonl54=; h=Date:Subject:To:References:From:In-Reply-To:From; b=Rf/SKH6AuhCao/hUPpDgvhXY9tPNBcqsAfto61A7Hi+M6nAYk7+vuM1eFP42las0C Ur/FuwQCc2K2gL63xVM3q8VVOW3pCtdlIsLh8xcsSBn6Ymwg44L5UPXZofizGQzpEG HzVUI/8RCXiQWIBIkKX8BUxzA7DmRy6ICmThIlpQ= Message-ID: Date: Tue, 27 Jun 2023 09:58:05 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v2] Drivers: hv: Change hv_free_hyperv_page() to take void * argument Content-Language: en-US To: Kameron Carr , arnd@arndb.de, decui@microsoft.com, haiyangz@microsoft.com, kys@microsoft.com, linux-arch@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, wei.liu@kernel.org References: <1687558189-19734-1-git-send-email-kameroncarr@linux.microsoft.com> From: Nuno Das Neves In-Reply-To: <1687558189-19734-1-git-send-email-kameroncarr@linux.microsoft.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-19.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Reviewed-by: Nuno Das Neves On 6/23/2023 3:09 PM, Kameron Carr wrote: > Currently hv_free_hyperv_page() takes an unsigned long argument, which > is inconsistent with the void * return value from the corresponding > hv_alloc_hyperv_page() function and variants. This creates unnecessary > extra casting. > > Change the hv_free_hyperv_page() argument type to void *. > Also remove redundant casts from invocations of > hv_alloc_hyperv_page() and variants. > > Signed-off-by: Kameron Carr > --- > V1 -> V2: Added Signed-off-by > > drivers/hv/connection.c | 13 ++++++------- > drivers/hv/hv_common.c | 10 +++++----- > include/asm-generic/mshyperv.h | 2 +- > 3 files changed, 12 insertions(+), 13 deletions(-) > > diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c > index 5978e9d..ebf15f3 100644 > --- a/drivers/hv/connection.c > +++ b/drivers/hv/connection.c > @@ -209,8 +209,7 @@ int vmbus_connect(void) > * Setup the vmbus event connection for channel interrupt > * abstraction stuff > */ > - vmbus_connection.int_page = > - (void *)hv_alloc_hyperv_zeroed_page(); > + vmbus_connection.int_page = hv_alloc_hyperv_zeroed_page(); > if (vmbus_connection.int_page == NULL) { > ret = -ENOMEM; > goto cleanup; > @@ -225,8 +224,8 @@ int vmbus_connect(void) > * Setup the monitor notification facility. The 1st page for > * parent->child and the 2nd page for child->parent > */ > - vmbus_connection.monitor_pages[0] = (void *)hv_alloc_hyperv_page(); > - vmbus_connection.monitor_pages[1] = (void *)hv_alloc_hyperv_page(); > + vmbus_connection.monitor_pages[0] = hv_alloc_hyperv_page(); > + vmbus_connection.monitor_pages[1] = hv_alloc_hyperv_page(); > if ((vmbus_connection.monitor_pages[0] == NULL) || > (vmbus_connection.monitor_pages[1] == NULL)) { > ret = -ENOMEM; > @@ -333,15 +332,15 @@ void vmbus_disconnect(void) > destroy_workqueue(vmbus_connection.work_queue); > > if (vmbus_connection.int_page) { > - hv_free_hyperv_page((unsigned long)vmbus_connection.int_page); > + hv_free_hyperv_page(vmbus_connection.int_page); > vmbus_connection.int_page = NULL; > } > > set_memory_encrypted((unsigned long)vmbus_connection.monitor_pages[0], 1); > set_memory_encrypted((unsigned long)vmbus_connection.monitor_pages[1], 1); > > - hv_free_hyperv_page((unsigned long)vmbus_connection.monitor_pages[0]); > - hv_free_hyperv_page((unsigned long)vmbus_connection.monitor_pages[1]); > + hv_free_hyperv_page(vmbus_connection.monitor_pages[0]); > + hv_free_hyperv_page(vmbus_connection.monitor_pages[1]); > vmbus_connection.monitor_pages[0] = NULL; > vmbus_connection.monitor_pages[1] = NULL; > } > diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c > index 542a1d5..6a2258f 100644 > --- a/drivers/hv/hv_common.c > +++ b/drivers/hv/hv_common.c > @@ -115,12 +115,12 @@ void *hv_alloc_hyperv_zeroed_page(void) > } > EXPORT_SYMBOL_GPL(hv_alloc_hyperv_zeroed_page); > > -void hv_free_hyperv_page(unsigned long addr) > +void hv_free_hyperv_page(void *addr) > { > if (PAGE_SIZE == HV_HYP_PAGE_SIZE) > - free_page(addr); > + free_page((unsigned long)addr); > else > - kfree((void *)addr); > + kfree(addr); > } > EXPORT_SYMBOL_GPL(hv_free_hyperv_page); > > @@ -253,7 +253,7 @@ static void hv_kmsg_dump_unregister(void) > atomic_notifier_chain_unregister(&panic_notifier_list, > &hyperv_panic_report_block); > > - hv_free_hyperv_page((unsigned long)hv_panic_page); > + hv_free_hyperv_page(hv_panic_page); > hv_panic_page = NULL; > } > > @@ -270,7 +270,7 @@ static void hv_kmsg_dump_register(void) > ret = kmsg_dump_register(&hv_kmsg_dumper); > if (ret) { > pr_err("Hyper-V: kmsg dump register error 0x%x\n", ret); > - hv_free_hyperv_page((unsigned long)hv_panic_page); > + hv_free_hyperv_page(hv_panic_page); > hv_panic_page = NULL; > } > } > diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h > index 402a8c1..a8f4b65 100644 > --- a/include/asm-generic/mshyperv.h > +++ b/include/asm-generic/mshyperv.h > @@ -190,7 +190,7 @@ static inline void vmbus_signal_eom(struct hv_message *msg, u32 old_msg_type) > > void *hv_alloc_hyperv_page(void); > void *hv_alloc_hyperv_zeroed_page(void); > -void hv_free_hyperv_page(unsigned long addr); > +void hv_free_hyperv_page(void *addr); > > /** > * hv_cpu_number_to_vp_number() - Map CPU to VP.