Received: by 10.223.164.202 with SMTP id h10csp533937wrb; Fri, 17 Nov 2017 04:47:29 -0800 (PST) X-Google-Smtp-Source: AGs4zMbapQlCF6ioHt6qBz2ueAkZhIgXCnVgsZTMsn6+rFcKdYFWBSAyT15qhNCZ9DwehGmwZ9z5 X-Received: by 10.84.241.65 with SMTP id u1mr4918171plm.28.1510922849504; Fri, 17 Nov 2017 04:47:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510922849; cv=none; d=google.com; s=arc-20160816; b=jpBvC7bnKwcy5r6JdsI741eKLHQXWWyYrxZkPqySaMqQEYNjm0NfVRe/m9HTYRK/x0 RKr8D24CTjIJcun6wewwvxy7RwTGnJWqFAQ9snVVBErpKwXEA0hXUiEjnMMq4iZVA7T0 BTTiKaDkvC1Df9IoJX0iHugR1XE3CoTaDCK1pBHpSsE9LU0aiRgcftcjlIFvQ0I6kyCW bDXHrYG4jA+vfOSaPgApUKxeYO5+YYe5ydNzzNRh4MRyps89csbS0m6aypxCMNGRvQR1 SY1xUbmdDC0ru2nrW/Z4H9nl0jorJyHoTW318adeS2XfhYHiaVGRrgKVJPIizz+s+j1c +aHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=knWGb7v5cZX6e2s/N6Z8ILpWA5fZwEqNB5wXTDRykdk=; b=uQ40AXrBFLAiIIiyj+/bVcmm3/p111yPdyAAhRbSv7KpJPlaYsath3NUJ37QAFoRxf 0kNJqplqchZENA6DpTPgDAO3MyykuyIVByFHkjIxULgu+o6dBW6+eaQPTiJzULUe9Nec jFaZlxoho87VHPHACCNTiSw8XxAG0p7BFMiUViSKYNP4uaqToppqdUvimkNdG3LPHC4t qeaUcko34rocyEjYramBSu/6xuPXQP/eOZo6Fb8yhkmQB2VZthAaN57jVqYDVIuOccJX cubsfPT03xLSSiSWzTTJwq/QysxMhX+V6iW2zxlYZb/JC4glgfK3bqJKYvWgkyimK/1P 68VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=dlnQWRt0; 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 w82si2980917pfj.266.2017.11.17.04.47.15; Fri, 17 Nov 2017 04:47:29 -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=@gmail.com header.s=20161025 header.b=dlnQWRt0; 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 S933200AbdKQEbA (ORCPT + 91 others); Thu, 16 Nov 2017 23:31:00 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:35634 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932720AbdKQEav (ORCPT ); Thu, 16 Nov 2017 23:30:51 -0500 Received: by mail-pg0-f66.google.com with SMTP id l19so1055886pgo.2; Thu, 16 Nov 2017 20:30:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=knWGb7v5cZX6e2s/N6Z8ILpWA5fZwEqNB5wXTDRykdk=; b=dlnQWRt0rTsRCrd/gbIcSsoMcCveWtfnLZ0I5yMSwZuJUvXtOSLuzq8/3UhSXsfreO Rac+Rw3SWwbI7klcedvhshdEmDhfbKhK+W5xdhv5NL4ZM6aP/HNgyx9R2PoIiDJhLy30 P2THtSbm+6ONOOYkg0DHbs6GqXQYOyXC/B/tbfsM58OoHs0HDntPtl5iqrG8I2WMOFnN mefSZ0zbaVwKqIwhdRKLINwkRmtUKYF3zM8Wb38y9m6+CNhTZm+ZGJcUMftCgFh4At4a glG3YbVWuevQqofSxy6OAWCUW9SBWPGxe3huWVsbVpCRQvej3rLFSX0dxIoL5/gj7dow /BwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=knWGb7v5cZX6e2s/N6Z8ILpWA5fZwEqNB5wXTDRykdk=; b=jW4h0ywGMdEJKCh205MIBsXlER5UDszbj9p/XBxHmjaWSRlMFNnZhaZPhbtlG/Bmrl eJEhJntpxSalDY529ACinVk053bII+MqZ1g6kJQvfI8hvnzcG9xNuTRFon/ve7UD1B10 QOv4KMrMyPa9BiLtZ1+cVmeF0uaEt+rMeHdokKz2OS6yM00oh4gH+tqaSDJMQJftwENZ btc2F9blSw4ugRopPDHMIL+2NQzf/6Qn1eg/YITFRpLJxHsutXrEAsi1DOSISHzSoGQx fAyFOUwN/fWGw06bymeDAceIlMg7NJ3uKU3fNPdcycahNKaHzDu/eBT0GgZgib8qGu6J QZFQ== X-Gm-Message-State: AJaThX6yaaQ4taeXKqChK/jr/3kFj5MU/ZyzEcsltaYNXm+CU+LL297u lm77Z5IX7MtH8N2ZU+Y+5SM= X-Received: by 10.159.207.149 with SMTP id z21mr3940379plo.258.1510893051227; Thu, 16 Nov 2017 20:30:51 -0800 (PST) Received: from software.domain.org ([172.247.34.138]) by smtp.gmail.com with ESMTPSA id a7sm4084984pgc.81.2017.11.16.20.30.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Nov 2017 20:30:50 -0800 (PST) From: Huacai Chen To: Christoph Hellwig Cc: Marek Szyprowski , Robin Murphy , Andrew Morton , Fuxin Zhang , linux-mips@linux-mips.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Huacai Chen , stable@vger.kernel.org Subject: [PATCH V10 4/4] libsas: Align sata_device's rps_resp on a cacheline Date: Fri, 17 Nov 2017 12:30:51 +0800 Message-Id: <1510893051-376-1-git-send-email-chenhc@lemote.com> X-Mailer: git-send-email 2.7.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The rps_resp buffer in ata_device is a DMA target, but it isn't explicitly cacheline aligned. Due to this, adjacent fields can be overwritten with stale data from memory on non-coherent architectures. As a result, the kernel is sometimes unable to communicate with an SATA device behind a SAS expander. Fix this by ensuring that the rps_resp buffer is cacheline aligned. This issue is similar to that fixed by Commit 84bda12af31f93 ("libata: align ap->sector_buf") and Commit 4ee34ea3a12396f35b26 ("libata: Align ata_device's id on a cacheline"). Cc: stable@vger.kernel.org Signed-off-by: Huacai Chen --- include/scsi/libsas.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 0f9cbf9..6df6fe0 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -159,11 +159,11 @@ struct expander_device { struct sata_device { unsigned int class; - struct smp_resp rps_resp; /* report_phy_sata_resp */ u8 port_no; /* port number, if this is a PM (Port) */ struct ata_port *ap; struct ata_host ata_host; + struct smp_resp rps_resp ____cacheline_aligned; /* report_phy_sata_resp */ u8 fis[ATA_RESP_FIS_SIZE]; }; -- 2.7.0 From 1584250562781276894@xxx Thu Nov 16 19:04:32 +0000 2017 X-GM-THRID: 1584174462071892702 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread