From patchwork Fri Nov 17 04:30:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huacai Chen X-Patchwork-Id: 10062281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0D6B6601D3 for ; Fri, 17 Nov 2017 04:30:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F30332ABE4 for ; Fri, 17 Nov 2017 04:30:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E63742ABEA; Fri, 17 Nov 2017 04:30:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SBL, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77B2B2ABE4 for ; Fri, 17 Nov 2017 04:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933168AbdKQEax (ORCPT ); Thu, 16 Nov 2017 23:30:53 -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-Google-Smtp-Source: AGs4zMbyRIlQ8nitge4oIZ4LoHC1FYzZ/OnTiqT8Mdvqi7jWWz0Z6jLk3zvZDcs0aDlWywzTT1OGDg== 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-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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]; };