Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932592AbcLNLdB convert rfc822-to-8bit (ORCPT ); Wed, 14 Dec 2016 06:33:01 -0500 Received: from dggrg01-dlp ([45.249.212.187]:2320 "EHLO dggrg01-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S932531AbcLNLc7 (ORCPT ); Wed, 14 Dec 2016 06:32:59 -0500 From: "Gonglei (Arei)" To: Halil Pasic CC: "Michael S. Tsirkin" , Herbert Xu , "linux-kernel@vger.kernel.org" , "qemu-devel@nongnu.org" , "virtio-dev@lists.oasis-open.org" , "virtualization@lists.linux-foundation.org" , "linux-crypto@vger.kernel.org" , Luonengjun , "stefanha@redhat.com" , "Huangweidong (C)" , "Wubin (H)" , "xin.zeng@intel.com" , Claudio Fontana , "davem@davemloft.net" , "Zhoujian (jay, Euler)" , "Hanweidong (Randy)" , "arei.gonglei@hotmail.com" , "cornelia.huck@de.ibm.com" , "Xuquan (Quan Xu)" , longpeng , "Wanzongshun (Vincent)" , Cornelia Huck Subject: RE: [PATCH v6 2/2] crypto: add virtio-crypto driver Thread-Topic: [PATCH v6 2/2] crypto: add virtio-crypto driver Thread-Index: AQHSUQzGbIxji49oXUK9tLC+s3NhyaED2Rhw///K0YCAALuIgIABL34AgAHHo6A= Date: Wed, 14 Dec 2016 11:32:12 +0000 Message-ID: <33183CC9F5247A488A2544077AF19020DA15FB3F@DGGEMA505-MBX.china.huawei.com> References: <1481171829-116496-1-git-send-email-arei.gonglei@huawei.com> <1481171829-116496-3-git-send-email-arei.gonglei@huawei.com> <33183CC9F5247A488A2544077AF19020DA15A07C@DGGEMA505-MBX.china.huawei.com> <20161212105407.GA3033@gondor.apana.org.au> <20161212234941-mutt-send-email-mst@kernel.org> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.177.18.62] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.58512DCD.03B0,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=169.254.1.226, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3f321c39af8fad77b27383d3411da95e Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3834 Lines: 100 Hi, > > Subject: Re: [PATCH v6 2/2] crypto: add virtio-crypto driver > > > > On 12/12/2016 11:05 PM, Michael S. Tsirkin wrote: > > On Mon, Dec 12, 2016 at 06:54:07PM +0800, Herbert Xu wrote: > >> On Mon, Dec 12, 2016 at 06:25:12AM +0000, Gonglei (Arei) wrote: > >>> Hi, Michael & Herbert > >>> > >>> Because the virtio-crypto device emulation had been in QEMU 2.8, > >>> would you please merge the virtio-crypto driver for 4.10 if no other > >>> comments? If so, Miachel pls ack and/or review the patch, then > >>> Herbert will take it (I asked him last week). Thank you! > >>> > >>> Ps: Note on 4.10 merge window timing from Linus > >>> https://lkml.org/lkml/2016/12/7/506 > >>> > >>> Dec 23rd is the deadline for 4.10 merge window. > >> > >> Sorry but it's too late for 4.10. It needed to have been in my > >> tree before the merge window opened to make it for this cycle. > >> > >> Cheers, > > > > > > Objections to me merging this? I'm preparing my tree right now. > > Got this when testing the most recent version on s390x > > [ 20.391074] test 0 (128 bit key, 16 byte blocks): [ 20.391078] BUG: using > smp_processor_id() in preemptible [00000000] code: insmod/97 > [ 20.391082] caller is virtio_crypto_ablkcipher_setkey+0x44/0x198 > [ 20.391085] CPU: 0 PID: 97 Comm: insmod Not tainted > 4.9.0-02683-gb62a1ab #46 > [ 20.391088] Hardware name: IBM 2964 NC9 > 704 (KVM) > [ 20.391405] Stack: > [ 20.391407] 000000000c0eb6d0 000000000c0eb760 > 0000000000000003 0000000000000000 > [ 20.391414] 000000000c0eb800 000000000c0eb778 > 000000000c0eb778 0000000000000020 > [ 20.391420] 0000000000000000 000000000000000a > 0000000000000020 000003ff0000000a > [ 20.391426] 000003ff0000000c 000000000c0eb7c8 > 0000000000000000 0000000000000000 > [ 20.391432] 0700000000c173c8 00000000001126ba > 000000000c0eb760 000000000c0eb7b8 > [ 20.391439] Call Trace: > [ 20.391442] ([<000000000011259e>] show_trace+0x8e/0xe0) > [ 20.391446] [<0000000000112670>] show_stack+0x80/0xd8 > [ 20.391449] [<0000000000753ab6>] dump_stack+0x96/0xd8 > [ 20.391453] [<00000000007872e6>] > check_preemption_disabled+0xfe/0x128 > [ 20.391456] [<0000000000839cc4>] > virtio_crypto_ablkcipher_setkey+0x44/0x198 > [ 20.391459] [<0000000000705a40>] > skcipher_setkey_ablkcipher+0x50/0x70 > [ 20.391476] [<000003ff80002a48>] test_skcipher_speed+0x328/0xb98 > [tcrypt] > [ 20.391492] [<000003ff800063dc>] do_test+0x1c24/0x28e0 [tcrypt] > [ 20.391509] [<000003ff8001006a>] tcrypt_mod_init+0x6a/0x1000 > [tcrypt] > [ 20.391512] [<00000000001002cc>] do_one_initcall+0xb4/0x148 > [ 20.391515] [<0000000000298632>] do_init_module+0x7a/0x228 > [ 20.391519] [<00000000001fd380>] load_module+0x2428/0x2de0 > [ 20.391522] [<00000000001fde8a>] SyS_init_module+0x152/0x160 > [ 20.391526] [<00000000009f1306>] system_call+0xd6/0x270 > [ 20.391528] no locks held by insmod/97. > > Gonglei, any idea? Did not look into it myself yet. > Thanks for report. You must open CONFIG_DEBUG_PREEMPT, but I didn't do that before. I open some kernel hacking debug switches to test it as well today, and the following patch can fix it. diff --git a/drivers/crypto/virtio/virtio_crypto_common.h b/drivers/crypto/virtio/virtio_crypto_common.h index 975404b..518dc7ad 100644 --- a/drivers/crypto/virtio/virtio_crypto_common.h +++ b/drivers/crypto/virtio/virtio_crypto_common.h @@ -113,7 +113,13 @@ struct virtio_crypto_request { static inline int virtio_crypto_get_current_node(void) { - return topology_physical_package_id(smp_processor_id()); + int cpu, node; + + cpu = get_cpu(); + node = topology_physical_package_id(cpu); + put_cpu(); + + return node; } Meanwhile I find aother problem, will fix it in the following V7. Regards, -Gonglei