linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Michael Davidson <md@google.com>,
	Alexander Potapenko <glider@google.com>,
	Michal Marek <mmarek@suse.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Shaohua Li <shli@kernel.org>,
	Matthias Kaehlcke <mka@chromium.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"open list:KERNEL BUILD + fi..." <linux-kbuild@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-crypto@vger.kernel.org, linux-raid@vger.kernel.org
Subject: Re: [PATCH 6/7] md/raid10, LLVM: get rid of variable length array
Date: Fri, 24 Mar 2017 14:47:15 +0100	[thread overview]
Message-ID: <CACT4Y+awYCAwoCkh8PQ-i2BdkxeuFp9meVXp=Yv6hGY8YjDnQg@mail.gmail.com> (raw)
In-Reply-To: <96158847-4F1F-4293-8435-E111F39E3260@zytor.com>

On Fri, Mar 17, 2017 at 9:04 PM,  <hpa@zytor.com> wrote:
> On March 17, 2017 12:27:46 PM PDT, Peter Zijlstra <peterz@infradead.org> wrote:
>>On Fri, Mar 17, 2017 at 11:52:01AM -0700, Michael Davidson wrote:
>>> On Fri, Mar 17, 2017 at 5:44 AM, Peter Zijlstra
>><peterz@infradead.org> wrote:
>>> >
>>> > Be that as it may; what you construct above is disgusting. Surely
>>the
>>> > code can be refactored to not look like dog vomit?
>>> >
>>> > Also; its not immediately obvious conf->copies is 'small' and this
>>> > doesn't blow up the stack; I feel that deserves a comment
>>somewhere.
>>> >
>>>
>>> I agree that the code is horrible.
>>>
>>> It is, in fact, exactly the same solution that was used to remove
>>> variable length arrays in structs from several of the crypto drivers
>>a
>>> few years ago - see the definition of SHASH_DESC_ON_STACK() in
>>> "crypto/hash.h" - I did not, however, hide the horrors in a macro
>>> preferring to leave the implementation visible as a warning to
>>whoever
>>> might touch the code next.
>>>
>>> I believe that the actual stack usage is exactly the same as it was
>>previously.
>>>
>>> I can certainly wrap this  up in a macro and add comments with
>>> appropriately dire warnings in it if you feel that is both necessary
>>> and sufficient.
>>
>>We got away with ugly in the past, so we should get to do it again?
>
> Seriously, you should have taken the hack the first time that this needs to be fixed.  Just because this is a fairly uncommon construct in the kernel doesn't mean it is not in userspace.


There is a reason why it is fairly uncommon in kernel.
Initially it was used more widely, but then there was a decision to
drop all uses of this feature. Namely:
Linus: "We should definitely drop it. The feature is an abomination".
https://lkml.org/lkml/2013/9/23/500
I really don't understand why you cling onto this last use of the
feature. Having a single use of a compiler extension on an error path
of a non-mandatory driver does not look like a great idea to me. Let's
just kill it off outside of clang discussion.

  reply	other threads:[~2017-03-24 13:47 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-17  0:15 [PATCH 0/7] LLVM: make x86_64 kernel build with clang Michael Davidson
2017-03-17  0:15 ` [PATCH 1/7] Makefile, LLVM: add -no-integrated-as to KBUILD_[AC]FLAGS Michael Davidson
2017-04-03 22:49   ` Matthias Kaehlcke
2017-04-21  7:49   ` Masahiro Yamada
2017-03-17  0:15 ` [PATCH 2/7] Makefile, x86, LLVM: disable unsupported optimization flags Michael Davidson
2017-03-17 21:32   ` H. Peter Anvin
2017-03-17 21:34     ` H. Peter Anvin
2017-04-05 18:08   ` Masahiro Yamada
2017-04-05 19:01     ` Matthias Kaehlcke
2017-04-05 19:11       ` Michael Davidson
2017-04-10 14:54         ` Masahiro Yamada
2017-03-17  0:15 ` [PATCH 3/7] x86, LLVM: suppress clang warnings about unaligned accesses Michael Davidson
2017-03-17 23:50   ` hpa
2017-04-03 23:01     ` Matthias Kaehlcke
2017-04-13 23:14       ` Matthias Kaehlcke
2017-04-13 23:55         ` H. Peter Anvin
2017-04-14  0:23           ` Matthias Kaehlcke
2017-04-14  5:30             ` hpa
2017-03-17  0:15 ` [PATCH 4/7] x86, boot, LLVM: #undef memcpy etc in string.c Michael Davidson
2017-06-22 22:31   ` Matthias Kaehlcke
2017-06-22 22:37     ` H. Peter Anvin
2017-06-30 18:32       ` Matthias Kaehlcke
2017-03-17  0:15 ` [PATCH 5/7] x86, boot, LLVM: Use regparm=0 for memcpy and memset Michael Davidson
2017-03-17 12:08   ` Peter Zijlstra
2017-06-22 22:38     ` H. Peter Anvin
2017-03-17  0:15 ` [PATCH 6/7] md/raid10, LLVM: get rid of variable length array Michael Davidson
2017-03-17 12:08   ` Peter Zijlstra
2017-03-17 12:31     ` Alexander Potapenko
2017-03-17 12:32       ` Alexander Potapenko
2017-03-17 18:03         ` Borislav Petkov
2017-03-17 18:47           ` Dmitry Vyukov
2017-03-17 18:57             ` Borislav Petkov
2017-03-17 19:05               ` Dmitry Vyukov
2017-03-17 19:26                 ` Peter Zijlstra
2017-03-17 19:29                   ` Peter Zijlstra
2017-03-24 13:50                     ` Dmitry Vyukov
2017-03-24 14:10                       ` Peter Zijlstra
2017-03-24 14:22                         ` Dmitry Vyukov
2017-03-18  0:41                 ` Fengguang Wu
2017-03-17 12:44       ` Peter Zijlstra
2017-03-17 18:52         ` Michael Davidson
2017-03-17 19:27           ` Peter Zijlstra
2017-03-17 20:04             ` hpa
2017-03-24 13:47               ` Dmitry Vyukov [this message]
2017-03-24 14:09                 ` Peter Zijlstra
2017-03-17  0:15 ` [PATCH 7/7] crypto, x86, LLVM: aesni - fix token pasting Michael Davidson
2017-04-03 23:14   ` Matthias Kaehlcke
2017-03-17  8:17 ` [PATCH 0/7] LLVM: make x86_64 kernel build with clang Dmitry Vyukov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACT4Y+awYCAwoCkh8PQ-i2BdkxeuFp9meVXp=Yv6hGY8YjDnQg@mail.gmail.com' \
    --to=dvyukov@google.com \
    --cc=davem@davemloft.net \
    --cc=glider@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=md@google.com \
    --cc=mingo@redhat.com \
    --cc=mka@chromium.org \
    --cc=mmarek@suse.com \
    --cc=peterz@infradead.org \
    --cc=shli@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).