Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp978997ybe; Thu, 19 Sep 2019 06:55:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDsa2Og7qC3JxB/Ea5auo5SgM+EWMfhd2pgkQQ50JIO2F1OocX9ael9hetqFoohDeffDVY X-Received: by 2002:a50:b582:: with SMTP id a2mr16331072ede.98.1568901331821; Thu, 19 Sep 2019 06:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568901331; cv=none; d=google.com; s=arc-20160816; b=bik/V1SDArSGZaTRiHgtjj4U8UFm7fFDi7e1AbxhAQp8E2jdADVsREuqmrElPZ21NX yu6PMROBQDazEIRrtH31piQk7qk4zcRPzmWWC3UXdmwgJUgQaO5bY5m7ke3nRc0OBEYO xSR0oMmGwg2/D3cBnQYxAaFE7I9d6TzWiPYKMjhl8lZ87KwUwy8HE6bCYlxs16aegmTQ TXv7pw8HVNBg8sFQ96U2NO0cqs5JcstzN6rGPmXXCR2fFLSA0VrKAtT+hSVFdcwl/QZA /h7Fe+b2MjNNCX5dS8RrIq0Jjykr+uJboeCIFscbJo8A8btpHJfu+gCk+6uY8IarMYOs JXrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8r+UmcwsFhZ9VWdz0aPZcHPp1vQPeZJ3k2MKS/v1A2U=; b=Z4wgbTLG57NjZx1ETNTP7rJCCt0+mvYk/i4YusVDQQAx36CcEyPmY5OZeDKnAFlDOv lbVV7PvYxxF2FpcMh3mrIanQEnIy9NrYQZNQgfGWxXpgERbTGm0HFIt+lZdq51uXhdT0 3irSW1+hlH2kjXXK0Ka39g3QsfoGb0b/+7Jk59mWJq3gu/80pm3Fc3b3sP3Kr+gNbCIj MdNm4wfCvVrYOcvsfOmvDzFJZGEvVjvv1vb2heMyZPesn3G3Iy2cGFEEWNHcxh5zBtBM YmCDnPdYiogONnmQ1LKD7LfXv70bWKh4x1W5ATmhdedUYzxKhgOGXeHWBvw4OzdbIHLK XaZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=TgF8fD+c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12si5559470edf.212.2019.09.19.06.55.08; Thu, 19 Sep 2019 06:55:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=TgF8fD+c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390435AbfISMzo (ORCPT + 99 others); Thu, 19 Sep 2019 08:55:44 -0400 Received: from mail.skyhub.de ([5.9.137.197]:37362 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389212AbfISMzo (ORCPT ); Thu, 19 Sep 2019 08:55:44 -0400 Received: from nazgul.tnic (unknown [193.86.95.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id C9A5B1EC04BC; Thu, 19 Sep 2019 14:55:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1568897742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=8r+UmcwsFhZ9VWdz0aPZcHPp1vQPeZJ3k2MKS/v1A2U=; b=TgF8fD+cZ9m2VONduQeIPB8NafkJ6pETyTk6/R9hI9AlhUwkgTKntCCiji3BLDRgIsz/Zv Gtb/mvJADXZMHv2kwU7hjT1oDfVa7rA7osXuAyJvXcUGjkcnA/L/KIZJGk8gNXA5H3E6kk 3MikCL7sJd/slsJOLVUgFiPYcua6+C4= Date: Thu, 19 Sep 2019 14:55:42 +0200 From: Borislav Petkov To: Linus Torvalds Cc: Josh Poimboeuf , x86-ml , Andy Lutomirski , lkml Subject: Re: [RFC] Improve memset Message-ID: <20190919125542.GB18148@nazgul.tnic> References: <20190913072237.GA12381@zn.tnic> <20190917201021.evoxxj7vkcb45rpg@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 17, 2019 at 01:45:20PM -0700, Linus Torvalds wrote: > That sounds better, but I'm a bit nervous about the whole thing > because who knows when the alternatives code itself internally uses > memset() and then we have a nasty little chicken-and-egg problem. You mean memcpy()...? > Also, for it to make sense to inline rep stosb, I think we also need > to just make the calling conventions for the alternative calls be that > they _don't_ clobber other registers than the usual rep ones > (cx/di/si). Otherwise one big code generation advantage of inlining > the thing just goes away. Yah, that is tricky and I have no smart idea how. The ABI puts the operands in rdi,rsi,rdx, ... while REP; STOSB wants them in rax,rcx,rdi. And if it were only that, then we could probably accept the 2 movs and a push but then the old functions clobber three more: "rdx", "r8", "r9". I could try to rewrite the old functions to see if I can save some regs... > On the whole I get the feeling that this is all painful complexity and > we shouldn't do it. At least not without some hard performance numbers > for some huge improvement, which I don't think we've seen. Yap, it is starting to become hairy. > Because I find the thing fascinating conceptually, but am not at all > convinced I want to deal with the pain in practice ;) I hear ya. Thx. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --