[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH 2/2] Arm32: tidy the memset() macro


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Fri, 19 Aug 2022 09:41:50 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=D80xj0N6In7EC1i1ZDHyHZhg7/0s3Vu7H4GF4h6jeFw=; b=jeM9ocTYr8etnSBKKCNWCpfGMJ0mYmPtCxzVfQknoZmdWH+OAl3u3nOBX2pwlnehMvNALnuTMrWAabDNHRxxmTFCkXTeKn9VDVPH6wziNnVCiQK4QL26eBiPcREJVhyEmL9WxSjUB5p8yjLdbJT0/89303KAufO9DFBNE5wnyBL9x96LbXdqEUkdCGsYExDJKWvHryVeCJg4AO/Sf0ypZA6vbKW/p6Lb7UCnANk4mwcfz78b1/LRYFVm/HNL1zREhL3aBwRe6TBIfGjwqYbEKFVn6Gb9QNd7JQZ6NJgWoEHqAo8RkqUrZwG0HSjZvztUyWY35F91SsalVoDg+uqmJw==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=D80xj0N6In7EC1i1ZDHyHZhg7/0s3Vu7H4GF4h6jeFw=; b=UgWWYhWNCDmQuDlrct337vHc0pWZRmcqMG4S/wvfbpeedCNb4T9+W8KIhwH91PkK19BH+uqhrBQCAWfxuRSs04kNImvJJalzEQdnmQYYCYADGKR99UQjRhdjeHhniCCFom4aXYoVc8a0W2APh3vG6qjao3YwvXP4m+yw3EvTwM5te0xkEd5wG4PGaKaKJ9AxHpawWqgFPc21mLDFN7elMfTABhJwNr60GR9tGZMbgSco3ImPQ4eNhVBYY9yLHknNiJntoL6Wpo4am6FKcIEd4awK8B88BlIUQrVPTTRaExOu3y8KFn86M8kgPubPv8SrbD/LhvEoFEDT+oZ4ZJ4eYQ==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=lHKHHoh6cQyAQ9fBnXS5LVMe5S4/ie7nUttqxaGs9jZgLLigFkxDkRLE+SEd5mtxRzwRAj7xGKshOtEiY2D6k6G1YZzpsNP64zT4aNHcm5XUBs2ECRpOZb7PjN5uc2xeCv32xmJHW6NlavYJ/TshpHQZAMcAa8GDOnZatGFtOr0igUxob4Zfob8vs9QM1D3XhkP90bFy4NseGvBu+JUZz3PlG/ujSLvnWUiOgpFd+0c+O2CFXSANUzh/SlRkh6wD/9XDbj1UYTuSeEYGAPeHt1GIS5EeHEEGigbbmc1tBrcr5NCnNRC4sSux97yy/NP8QnJ0fpwMaxp6obQWgZLdlg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JyEgiof4OT6VHvUeghYfbnCZxZAFxXtRpMmZinTbM/k8FSf4/2F4qGZUhsW2JAKVba5YwiVPrG6rx+YWTJw0ZEaq3pQKytxA/HIuGQ1l73c2z/E/mwQwzFZndJR8fVbESs9HDTXb75UbjMGPqLlq33CbXZyjTDsDfmDL7FMniaKxNKWbCsrNegKm7biUqYBOH7VR7Ci+5xUD31An7jyf8lxn6JcUdu2Bzc+8IVKuBQ8vhMGbDreJIqT3CmKSbqRpE2tbdNFL5ArUjFjUQv+Yp2E/RID9gQje70/ZB18nC2u+gSxZuUDaFTB1UV+t3Qfb8DymisM/2LP3JsvVJs7gmA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 19 Aug 2022 09:42:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYs6BtEnYIw9a2QEK+U+CB1vg/Xq21221AgAABzYCAABfasA==
  • Thread-topic: [PATCH 2/2] Arm32: tidy the memset() macro

Hi Jan,

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: 2022年8月19日 16:04
> To: Wei Chen <Wei.Chen@xxxxxxx>
> Cc: Julien Grall <julien@xxxxxxx>; Stefano Stabellini
> <sstabellini@xxxxxxxxxx>; Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>;
> Bertrand Marquis <Bertrand.Marquis@xxxxxxx>; xen-
> devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH 2/2] Arm32: tidy the memset() macro
> 
> On 19.08.2022 09:59, Wei Chen wrote:
> >> -----Original Message-----
> >> From: Xen-devel <xen-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of
> Jan
> >> Beulich
> >> Sent: 2022年8月19日 15:50
> >>
> >> - add parentheses where they were missing (MISRA)
> >> - make sure to evaluate also v exactly once (MISRA)
> >> - remove excess parentheses
> >> - rename local variables to not have leading underscores
> >> - apply Xen coding style
> >>
> >> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> >> ---
> >> I wonder whether "if ( n_ )" is really helpful: It's extra code in all
> >> callers passing a non-constant size, just to cover a pretty rare case
> >> which memset() is required to deal with correctly anyway, and which
> >
> > What rare case we need to use n_ that can make memset happy?
> 
> I'm afraid I don't understand the question.
> 

Sorry I didn't describe the problem clearly in the last email. You mentioned
whether if (n_) is useful in your patch comments. I looked at the implementation
of the current memset macro, and I didn't feel it was too useful.

Then in the comments you mentioned that if (n_) is just to cover a very rare 
case.
Does the rare case is memset(p, v, 0)? If this is the case, I agree with you,
memset itself should be able to handle with size=0.

Sorry again for confusing you!

Thanks,
Wei Chen

> Jan
> 
> > As your
> > comment, I read the code again, but it seems to work fine without n_.
> >
> > Cheers,
> > Wei Chen

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.