Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp450465imu; Fri, 21 Dec 2018 01:48:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN5or4CGNE6/9u3y4V5k3oCdSdobj0tKps6N/1de6Mg6qgRXBzF4rqBN1PHJ6ahvLKJgPOxl X-Received: by 2002:a17:902:1105:: with SMTP id d5mr1749068pla.47.1545385719727; Fri, 21 Dec 2018 01:48:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545385719; cv=none; d=google.com; s=arc-20160816; b=jJgN0ewEC5XkOw02JoGd3AjPKXJpnEoeiv5e7TDxwiZKjXQ5yEWcZQsbmJNjNHOeVQ zrI752B8x+mz3MPQmX6bAUYru8CzotNe6/wzcJ5L1Bk6c0i/9+ZHerDVwG6XGvKLKh0k N12lmecQb5lD2Mp4kG+sUxgbAoRt+xkDlQEFItvIMGFQYFEg1oBJH559Q3wqeqBw90pZ 1/z8cR8Pyi63Vz+vqYPN23YipxUSybOLI/UYfO4ThhnWBfRWqNQ+r4LdjxqYbX5+W3aH 24ePNi1QYPM1E4+P/j3rn9X2Y2ybuDXrLCoZy+EWU3zI7vyZ4gzpnyuKxXr++P5Xt93+ WkTg== 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=8I7T4f+n6L3Wjg4lbpVX56XHJOL1Cvwoq4XgeQJGfHk=; b=B6cszblTgGDrv2yGnRdVVEpYdcuavK/5d53gTDsiT+gOaHvkODVCZUmeqz42V4DR0S 9b2NfkApyuVeeRXZScKtXfYbOX40ydqPfpBfpQxMteSJyGELs9BnzgZO8C8SxhkndCcC LZzeNzGkNxcIYQno31o+d3QBFVlEWxkOVEOT8hTiDDwuGHgDYuMBNHna3ZJ+Qu8SWqmO y0lr/fvw0gAiNKfBBSUwzBh3f3UOaVqrLnQtf5prvUHDrbapCL+ygajXG0kpoeq6adVb Ch3iN0l7rbtPmL3/wVQknlSe4ktHpwYmeBK1s1hPspd0+VvawGkfhmLlV8Ynr9hEhIGv gLVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=p7hE4BDF; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 133si21812338pfc.61.2018.12.21.01.48.24; Fri, 21 Dec 2018 01:48:39 -0800 (PST) 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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=p7hE4BDF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731323AbeLTT17 (ORCPT + 99 others); Thu, 20 Dec 2018 14:27:59 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:52958 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729721AbeLTT17 (ORCPT ); Thu, 20 Dec 2018 14:27:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8I7T4f+n6L3Wjg4lbpVX56XHJOL1Cvwoq4XgeQJGfHk=; b=p7hE4BDF7/Jlh4w8tSdepkr2O rhKokZ1nRsyCUDfkgtU2p3mahXZfnBsD9p8cOOsuGohPigzWH9zlGYEln+vdUfGr1YpduTt+KGqmX k/yDOzVTAmq8qen0sUzGAIM9pktuNKwZ5hMZ5IUTr1b7cyFXNP3c1bUimLqWiORJNRE7dkf/kBIyh eD77F2trw8Hjgcj14lYqfYONxjha2dDy+r9CgIp5CcaxOUFfBTlQWmjSbA8RMHhrrm+yFfW9mlZrs nl2XheEg0hlBqfQTVuMH37owMhQMCydysBz1eqxEKBUJ1KTDYSCTSczJ0WrNN5U/o42rhX2ohGV7T gjjsqetHQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1ga3z7-0000Ti-RX; Thu, 20 Dec 2018 19:27:53 +0000 Date: Thu, 20 Dec 2018 11:27:53 -0800 From: Matthew Wilcox To: Igor Stoppa Cc: Andy Lutomirski , Peter Zijlstra , Dave Hansen , Mimi Zohar , igor.stoppa@huawei.com, Nadav Amit , Kees Cook , linux-integrity@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 04/12] __wr_after_init: x86_64: __wr_op Message-ID: <20181220192753.GZ10600@bombadil.infradead.org> References: <20181219213338.26619-1-igor.stoppa@huawei.com> <20181219213338.26619-5-igor.stoppa@huawei.com> <20181220184917.GY10600@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 20, 2018 at 09:19:15PM +0200, Igor Stoppa wrote: > On 20/12/2018 20:49, Matthew Wilcox wrote: > > I think you're causing yourself more headaches by implementing this "op" > > function. > > I probably misinterpreted the initial criticism on my first patchset, about > duplication. Somehow, I'm still thinking to the endgame of having > higher-level functions, like list management. > > > Here's some generic code: > > thank you, I have one question, below > > > void *wr_memcpy(void *dst, void *src, unsigned int len) > > { > > wr_state_t wr_state; > > void *wr_poking_addr = __wr_addr(dst); > > > > local_irq_disable(); > > wr_enable(&wr_state); > > __wr_memcpy(wr_poking_addr, src, len); > > Is __wraddr() invoked inside wm_memcpy() instead of being invoked privately > within __wr_memcpy() because the code is generic, or is there some other > reason? I was assuming that __wr_addr() might be costly, and we were trying to minimise the number of instructions executed while write-rare was enabled.