Received: by 10.213.65.68 with SMTP id h4csp1414183imn; Wed, 21 Mar 2018 10:04:18 -0700 (PDT) X-Google-Smtp-Source: AG47ELuCih/qee85P/QQYn/bmu0qjQfRHPD9CtlvsHdiPPYRlnrth7HgSQx0gASjds8jwZ5tMc/l X-Received: by 2002:a17:902:9:: with SMTP id 9-v6mr22251296pla.42.1521651858786; Wed, 21 Mar 2018 10:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521651858; cv=none; d=google.com; s=arc-20160816; b=wvUQ3M0wh0cjw7o1/oh8JyjgdMXlSzBtQGnm/HhUBJulxCAlIC3fJlppKhGfmYg/hV 1y9/KYqu6AWfeB8R+N8oDqy5KJuTIACYFEHMMxM6glIDuCCt02pPYqAANFJUsLlOsSyt 0k5Gha5g5WRH+wPbh45ReDG7H20xtvUVZcmPDXPedh/sKUa1x8i7VwjiziqE+XrMyzXh KpHiZ7T1KI44AYuKi/uIYR5Sp+NnzFcGXrV8NsyN6oNhDDv6ZSlKLxdQlaXFXCpZkpgv F0mDOId7E62UG9/6/pxaQANBShwmZR3YSimihWFUwoRlFt1XUirc0X8r4ChaD+K+LfQ9 xLwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=CsRgHKhRuWzl0hgfPRyFtf5KQ6B44DahFAVrPZS0mTY=; b=vPJt+ZgBs/QqvmWiC6x2lBhm0rGdXmLSwbQNVeA6wY6LOjZaKBVDgxO1mYezzpuz2V hCNAsh26uGTwhOo8AEriKhxhvplatvci50PW4dYgK4AwKAWLRuZjeQjstpQqfh5C41gd ReqAYuyZPLxVZxRH0tHSj5XjgqCCFpsRmQpvh2g+yxS4YomYZVtb64ftFTcSyQjafIzb 2UKGo65iZC9BG4KevWhczITgmDmz5smOFGt7qb0StEUDhB82D2dIvKgtrCnfll+1V7v+ j/CBKF6m4HbYMlZb2lq6aCSZQr9vv1iaWU9CCPK7iaeeemjFxf/XL4X8PHhIdgn2FboC wKAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=e1TMbHcN; 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 h6-v6si4168275pll.328.2018.03.21.10.03.55; Wed, 21 Mar 2018 10:04:18 -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=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=e1TMbHcN; 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 S1752307AbeCURCP (ORCPT + 99 others); Wed, 21 Mar 2018 13:02:15 -0400 Received: from mail-io0-f175.google.com ([209.85.223.175]:35943 "EHLO mail-io0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751837AbeCURCK (ORCPT ); Wed, 21 Mar 2018 13:02:10 -0400 Received: by mail-io0-f175.google.com with SMTP id o4so7480560iod.3 for ; Wed, 21 Mar 2018 10:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=CsRgHKhRuWzl0hgfPRyFtf5KQ6B44DahFAVrPZS0mTY=; b=e1TMbHcNOSJLshS8u2f6oz0wPvXqjuo09a0s5t/nMdHdpC4n2gJDMitf4AI7co9tG1 yDInjFQC+x6QXzMTDv8BliCcH8YNYjXGv0Gj9y3+hOtToWHmu2F9QqiG1f7uNCarKVmJ YxJM9XOijHq3+pkqJJdULUK/qzD5jUpi0BaSDuosBmi6vvzYLRd+7Yv5Hn2pZcn8Legi /tNbXnd3PhKmEBVwXdl6D9XR8ymfRNHLxaeYF7YidT0nXWX5lDVZczVSd320MRoHElfr 6nYRZDgnd49xiHhDhY/ZEKxEbviqrEKE2ZGcoSy+bQcpBHE6juIXrwE9jL8gBJIAD9ad HGgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=CsRgHKhRuWzl0hgfPRyFtf5KQ6B44DahFAVrPZS0mTY=; b=SQSab95UUel+Sa0WAjl2E++pOzMlIQrbY/o/iPUb+H8AvsqFeeMdP0/Hj1v5cUQ976 jhgG99U9tExhN+0ba2gNW/P9h3B0hWkQuXjIxeAiKf97EJ272+Tc4eGVdFdIv9NFLrb7 /u7p9e+DLiFOEf98KtIDl4BvRdD0F1VPYOXpbHBK4vZwqxzYcdcIybREYuPDB2Cqio6+ /rKrrUwEGfunaLbcUJbtXZ4Bw1wFQavalWbx8jslA5dC1sfI7tXTvJFwKDeW/h0GhPVD 7C88EFG70iLk6ZhQ/81HjJNipzTvgxoG3Sf1KPE0qdexq9v2c8V9teForRtpXF9/GzvV Wckg== X-Gm-Message-State: AElRT7G9+UIdllPUA2GOauDY6y1Poqp0gZka5QQ3uEI32KcKfbigIFo3 WA3DmRf65EyYKXcETO3PXQPeOy2fT6U= X-Received: by 10.107.157.75 with SMTP id g72mr22404265ioe.240.1521651729473; Wed, 21 Mar 2018 10:02:09 -0700 (PDT) Received: from [192.168.1.154] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id e142-v6sm3683511ite.3.2018.03.21.10.02.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 10:02:08 -0700 (PDT) Subject: Re: [PATCH] block: use 32-bit blk_status_t on Alpha To: Mikulas Patocka Cc: Richard Henderson , Ivan Kokshaysky , Matt Turner , Mike Snitzer , linux-block@vger.kernel.org, dm-devel@redhat.com, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org References: <502b7c1e-a95c-ff8d-64cd-9cbdd275fa1d@kernel.dk> From: Jens Axboe Message-ID: <9cd0ef78-68e0-2c08-ca37-775c931fa159@kernel.dk> Date: Wed, 21 Mar 2018 11:02:06 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Thunderbird/59.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/21/18 11:00 AM, Mikulas Patocka wrote: > > > On Wed, 21 Mar 2018, Jens Axboe wrote: > >> On 3/21/18 10:42 AM, Mikulas Patocka wrote: >>> Early alpha processors cannot write a single byte or word; they read 8 >>> bytes, modify the value in registers and write back 8 bytes. >>> >>> The type blk_status_t is defined as one byte, it is often written >>> asynchronously by I/O completion routines, this asynchronous modification >>> can corrupt content of nearby bytes if these nearby bytes can be written >>> simultaneously by another CPU. >>> >>> - one example of such corruption is the structure dm_io where >>> "blk_status_t status" is written by an asynchronous completion routine >>> and "atomic_t io_count" is modified synchronously >>> - another example is the structure dm_buffer where "unsigned hold_count" >>> is modified synchronously from process context and "blk_status_t >>> write_error" is modified asynchronously from bio completion routine >>> >>> This patch fixes the bug by changing the type blk_status_t to 32 bits if >>> we are on Alpha and if we are compiling for a processor that doesn't have >>> the byte-word-extension. >> >> That's nasty. Is alpha the only problematic arch here? > > Yes. All the other architectures supported by Linux have byte writes. > >> As to the patch in question, normally I'd just say we should make it >> unconditionally u32. But we pack so nicely in the bio, and I don't think >> the bio itself has this issue as the rest of the members that share this >> word are all set before the bio is submitted. But callers embedding >> the status var in other structures don't necessarily have that >> guarantee, as your dm examples show. >> >> -- >> Jens Axboe > > Keeping blk_status_t 8-bit for most architectures will save a few bytes in > some of device mapper structures. And more importantly, it won't screw up the bio layout, I'm somewhat more concerned about that than random driver structures. If alpha is the odd one out here, then I think your patch is fine as-is. -- Jens Axboe