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 mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FBF1C47DD9 for ; Fri, 22 Mar 2024 07:04:44 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 08D5A42DF1; Fri, 22 Mar 2024 08:04:43 +0100 (CET) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id 6EC2B42DE9 for ; Fri, 22 Mar 2024 08:04:41 +0100 (CET) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 91E41175AC for ; Fri, 22 Mar 2024 08:04:40 +0100 (CET) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 841461761B; Fri, 22 Mar 2024 08:04:40 +0100 (CET) Received: from [192.168.1.59] (h-62-63-215-114.A163.priv.bahnhof.se [62.63.215.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id E2EAC1755E; Fri, 22 Mar 2024 08:04:30 +0100 (CET) Message-ID: <281eabd4-6adc-44df-a5be-0d2b5cee9ba8@lysator.liu.se> Date: Fri, 22 Mar 2024 08:04:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 38/45] bus/vmbus: use rte stdatomic API To: Long Li , Tyler Retzlaff , "dev@dpdk.org" Cc: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , =?UTF-8?Q?Morten_Br=C3=B8rup?= , Abdullah Sevincer , Ajit Khaparde , Alok Prasad , Anatoly Burakov , Andrew Rybchenko , Anoob Joseph , Bruce Richardson , Byron Marohn , Chenbo Xia , Chengwen Feng , Ciara Loftus , Ciara Power , Dariusz Sosnowski , David Hunt , Devendra Singh Rawat , Erik Gabriel Carrillo , Guoyang Zhou , Harman Kalra , Harry van Haaren , Honnappa Nagarahalli , Jakub Grajciar , Jerin Jacob , Jeroen de Borst , Jian Wang , Jiawen Wu , Jie Hai , Jingjing Wu , Joshua Washington , Joyce Kong , Junfeng Guo , Kevin Laatz , Konstantin Ananyev , Liang Ma , Maciej Czekaj , Matan Azrad , Maxime Coquelin , Nicolas Chautru , Ori Kam , Pavan Nikhilesh , Peter Mccarthy , Rahul Lakkireddy , Reshma Pattan , Rosen Xu , Ruifeng Wang , Rushil Gupta , Sameh Gobriel , Sivaprasad Tummala , Somnath Kotur , stephen , Suanming Mou , Sunil Kumar Kori , Sunil Uttarwar , Tetsuya Mukawa , Vamsi Attunuru , Slava Ovsiienko , Vladimir Medvedkin , Xiaoyun Wang , Yipeng Wang , Yisen Zhuang , Yuying Zhang , Ziyang Xuan References: <1710967892-7046-1-git-send-email-roretzla@linux.microsoft.com> <1711048652-7512-1-git-send-email-roretzla@linux.microsoft.com> <1711048652-7512-39-git-send-email-roretzla@linux.microsoft.com> Content-Language: en-US From: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 2024-03-21 22:34, Long Li wrote: > >>> static inline void >>> vmbus_set_monitor(const struct vmbus_channel *channel, uint32_t >> monitor_id) >>> { >>> - uint32_t *monitor_addr, monitor_mask; >>> + RTE_ATOMIC(uint32_t) *monitor_addr, monitor_mask; >>> unsigned int trigger_index; >>> >>> trigger_index = monitor_id / HV_MON_TRIG_LEN; >>> monitor_mask = 1u << (monitor_id % HV_MON_TRIG_LEN); >>> >>> - monitor_addr = &channel->monitor_page->trigs[trigger_index].pending; >>> + monitor_addr = >>> + (uint32_t __rte_atomic >>> +*)&channel->monitor_page->trigs[trigger_index].pending; >> >> Why is "pending" not RTE_ATOMIC()? > > The usage is okay. The value is used to notify the VSP (Hyper-V). It's always set (no read) from DPDK. > OK, so my question was not "does it need to be atomic", but rather "why isn't it marked RTE_ATOMIC() when it's treated as atomic". But what you are saying is that it need not be atomic? Just the equivalent of WRITE_ONCE()? Or a relaxed atomic store? > Linux kernel driver does the same thing. > > Long